mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Set layout metrics during initial render of Fabric
Summary: This diff refactors the initial render of Fabric in order to set the layout metrics as we start the surface. This prevents to create an additional fabric commit during initial render. Also this migth help fixing T63495589 (I wasn't able to repro T63495589 again when using this diff) changelog: [Internal][Android] Internal change to reduce the amount of commits during initial render of Fabric Reviewed By: JoshuaGross Differential Revision: D21330072 fbshipit-source-id: 758c49b52ea4c12d5623b7c7d68c7318f4a6cd83
This commit is contained in:
committed by
Facebook GitHub Bot
parent
09487e4e95
commit
65d52a59b0
@@ -1150,21 +1150,29 @@ public class ReactInstanceManager {
|
||||
|
||||
@Nullable Bundle initialProperties = reactRoot.getAppProperties();
|
||||
|
||||
final int rootTag =
|
||||
uiManager.addRootView(
|
||||
reactRoot.getRootViewGroup(),
|
||||
initialProperties == null
|
||||
? new WritableNativeMap()
|
||||
: Arguments.fromBundle(initialProperties),
|
||||
reactRoot.getInitialUITemplate());
|
||||
reactRoot.setRootViewTag(rootTag);
|
||||
final int rootTag;
|
||||
|
||||
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());
|
||||
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();
|
||||
}
|
||||
Systrace.beginAsyncSection(
|
||||
|
||||
Reference in New Issue
Block a user