-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with createRoot for latest concurrent mode #1529
Comments
I'll update the implementation once a stable release of concurrent mode is available |
This is possible if we change renderApplication like this function renderApplication<Props: Object>(
RootComponent: ComponentType<Props>,
WrapperComponent?: ?ComponentType<*>,
callback?: () => void,
options: {
initialProps: Props,
rootTag: any,
mode: 'Concurrent' | 'Blocking' | 'Legacy',
},
) {
const {initialProps, rootTag, mode} = options;
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);
const App = (
<AppContainer rootTag={rootTag} WrapperComponent={WrapperComponent}>
<RootComponent {...initialProps} />
</AppContainer>
);
if (mode === 'Concurrent') {
ReactDOM.createRoot(rootTag).render(App, callback);
} else if (mode === 'Blocking') {
ReactDOM.createBlockingRoot(rootTag).render(App, callback);
} else {
ReactDOM.render(App, rootTag, callback);
}
} |
I want to test react experimental on react-native-web this code help me. |
I see this was removed from the 0.16 milestone, but not added to any subsequent one. Any idea when this might be target for getting into a release? We'd love to be able to leverage these concurrent capabilities everywhere from our RN codebase. |
Hi! Any updates on this? |
Using
react-native-web
relies onAppRegistry.runApplication
which doesn't useReactDOM.createRoot
. It means that using suspense withreact-native-web
is only possible using the previous Suspense API (<React.unstable_ConcurrentMode>
), since then the React had released great new concurrent APIs such asuseTransition
, oruseDeferredValue
.Supporting concurrent mode with
react-native-web
will require:ReactDOM.createRoot
inrenderApplication
I think a potential solution in the short term could be to use
ReactDOM.createRoot
when an option is passed toAppRegistry.runApplication
so that it supports both latest and older react versions.I'd be happy to open a PR for such changes if you agree with such implementation :)
The text was updated successfully, but these errors were encountered: