Unforked renderApplication()

Summary: This allows toggling fabric renderer via the same renderApplication()

Reviewed By: mdvacca

Differential Revision: D7682524

fbshipit-source-id: 59be1d2bea15f5e13e64e2d72304d79f9cb7d084
This commit is contained in:
Kevin Gozali
2018-04-19 11:03:50 -07:00
committed by Facebook Github Bot
parent dc836780cb
commit 60b05133ba
4 changed files with 10 additions and 80 deletions

View File

@@ -13,6 +13,7 @@
const AppContainer = require('AppContainer');
const React = require('React');
const ReactFabric = require('ReactFabric');
const ReactNative = require('ReactNative');
const invariant = require('fbjs/lib/invariant');
@@ -25,6 +26,7 @@ function renderApplication<Props: Object>(
initialProps: Props,
rootTag: any,
WrapperComponent?: ?React.ComponentType<*>,
fabric?: boolean,
) {
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);
@@ -49,7 +51,11 @@ function renderApplication<Props: Object>(
renderable = <AsyncMode>{renderable}</AsyncMode>;
}
ReactNative.render(renderable, rootTag);
if (fabric) {
ReactFabric.render(renderable, rootTag);
} else {
ReactNative.render(renderable, rootTag);
}
}
module.exports = renderApplication;