-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2100 from reduxjs/feature/9.0-react-native
Add an RN-specific bundle and consolidate imports
- Loading branch information
Showing
14 changed files
with
57 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// The primary entry point assumes we are working with React 18, and thus have | ||
// useSyncExternalStore available. We can import that directly from React itself. | ||
// The useSyncExternalStoreWithSelector has to be imported, but we can use the | ||
// non-shim version. This shaves off the byte size of the shim. | ||
|
||
import { React } from './utils/react' | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector.js' | ||
|
||
import { unstable_batchedUpdates as batchInternal } from './utils/reactBatchedUpdates.native' | ||
import { setBatch } from './utils/batch' | ||
|
||
import { initializeUseSelector } from './hooks/useSelector' | ||
import { initializeConnect } from './components/connect' | ||
|
||
initializeUseSelector(useSyncExternalStoreWithSelector) | ||
initializeConnect(React.useSyncExternalStore) | ||
|
||
// Enable batched updates in our subscriptions for use | ||
// with standard React renderers (ReactDOM, React Native) | ||
setBatch(batchInternal) | ||
|
||
// Avoid needing `react-dom` in the final TS types | ||
// by providing a simpler type for `batch` | ||
const batch: (cb: () => void) => void = batchInternal | ||
|
||
export { batch } | ||
|
||
export * from './exports' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as ReactOriginal from 'react' | ||
import type * as ReactNamespace from 'react' | ||
|
||
export const React: typeof ReactNamespace = | ||
// prettier-ignore | ||
// @ts-ignore | ||
'default' in ReactOriginal ? ReactOriginal['default'] : ReactOriginal as any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters