diff --git a/Libraries/ReactNative/renderApplication.js b/Libraries/ReactNative/renderApplication.js index a1e96f30dbb3ca..41e25c1c1ccc7f 100644 --- a/Libraries/ReactNative/renderApplication.js +++ b/Libraries/ReactNative/renderApplication.js @@ -30,12 +30,32 @@ function renderApplication( ) { invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag); - ReactNative.render( + let renderable = ( - , - rootTag, + ); + + // If the root component is async, the user probably wants the initial render + // to be async also. To do this, wrap AppContainer with an async marker. + // For more info see https://fburl.com/tjpe0gpx + if ( + RootComponent.prototype != null && + RootComponent.prototype.unstable_isAsyncReactComponent === true + ) { + // $FlowFixMe This is not yet part of the official public API + class AppContainerAsyncWrapper extends React.unstable_AsyncComponent { + render() { + return this.props.children; + } + } + + renderable = ( + {renderable} + ); + } + + ReactNative.render(renderable, rootTag); } module.exports = renderApplication;