mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use MC to Start Fabric surfaces using layoutMetrics or not
Summary: This diff uses a new MC to Start Fabric surfaces using layoutMetrics or not. The motivation is to verify if the new initialization of fabric surfaces is regressing in production changelog: [Internal] Internal change in fabric Reviewed By: JoshuaGross Differential Revision: D21606971 fbshipit-source-id: ed1f6937ffd0f1e6c54e3ebc34595d75b6c5f6e1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8d548d8c92
commit
6a96a9f655
@@ -1152,18 +1152,30 @@ public class ReactInstanceManager {
|
||||
|
||||
final int rootTag;
|
||||
|
||||
if (reactRoot.getUIManagerType() == FABRIC) {
|
||||
rootTag =
|
||||
uiManager.startSurface(
|
||||
reactRoot.getRootViewGroup(),
|
||||
reactRoot.getJSModuleName(),
|
||||
initialProperties == null
|
||||
? new WritableNativeMap()
|
||||
: Arguments.fromBundle(initialProperties),
|
||||
reactRoot.getWidthMeasureSpec(),
|
||||
reactRoot.getHeightMeasureSpec());
|
||||
reactRoot.setRootViewTag(rootTag);
|
||||
reactRoot.setShouldLogContentAppeared(true);
|
||||
if (ReactFeatureFlags.enableFabricStartSurfaceWithLayoutMetrics) {
|
||||
if (reactRoot.getUIManagerType() == FABRIC) {
|
||||
rootTag =
|
||||
uiManager.startSurface(
|
||||
reactRoot.getRootViewGroup(),
|
||||
reactRoot.getJSModuleName(),
|
||||
initialProperties == null
|
||||
? new WritableNativeMap()
|
||||
: Arguments.fromBundle(initialProperties),
|
||||
reactRoot.getWidthMeasureSpec(),
|
||||
reactRoot.getHeightMeasureSpec());
|
||||
reactRoot.setRootViewTag(rootTag);
|
||||
reactRoot.setShouldLogContentAppeared(true);
|
||||
} else {
|
||||
rootTag =
|
||||
uiManager.addRootView(
|
||||
reactRoot.getRootViewGroup(),
|
||||
initialProperties == null
|
||||
? new WritableNativeMap()
|
||||
: Arguments.fromBundle(initialProperties),
|
||||
reactRoot.getInitialUITemplate());
|
||||
reactRoot.setRootViewTag(rootTag);
|
||||
reactRoot.runApplication();
|
||||
}
|
||||
} else {
|
||||
rootTag =
|
||||
uiManager.addRootView(
|
||||
@@ -1173,8 +1185,17 @@ public class ReactInstanceManager {
|
||||
: Arguments.fromBundle(initialProperties),
|
||||
reactRoot.getInitialUITemplate());
|
||||
reactRoot.setRootViewTag(rootTag);
|
||||
reactRoot.runApplication();
|
||||
if (reactRoot.getUIManagerType() == FABRIC) {
|
||||
// Fabric requires to call updateRootLayoutSpecs before starting JS Application,
|
||||
// this ensures the root will hace the correct pointScaleFactor.
|
||||
uiManager.updateRootLayoutSpecs(
|
||||
rootTag, reactRoot.getWidthMeasureSpec(), reactRoot.getHeightMeasureSpec());
|
||||
reactRoot.setShouldLogContentAppeared(true);
|
||||
} else {
|
||||
reactRoot.runApplication();
|
||||
}
|
||||
}
|
||||
|
||||
Systrace.beginAsyncSection(
|
||||
TRACE_TAG_REACT_JAVA_BRIDGE, "pre_rootView.onAttachedToReactInstance", rootTag);
|
||||
UiThreadUtil.runOnUiThread(
|
||||
|
||||
Reference in New Issue
Block a user