Do not attach root view until size is available

Summary:
Changelog: [internal]

# Why is text laid out twice in Fabric?

Layout constraints (min and max size) change during startup of Fabric surface.
1. `Scheduler::startSurface` is called with max size being {inf, inf}.
2. `Scheduler::constraintSurfaceLayout` is called with max size equal to viewport.

These are two operations that don't happen one after the other and on Android, CompleteRoot is called from JS before second operation is called. This triggers layout with max size {inf, inf} and later when second operation is called. Layout happens again now with correct size.

# Fix
Make sure `Scheduler::startSurface` is called with proper values and not {inf, inf}.

Reviewed By: JoshuaGross, yungsters

Differential Revision: D23866735

fbshipit-source-id: b16307543cc75c689d0c1f0a16aa581458f7417d
This commit is contained in:
Samuel Susla
2020-09-28 04:18:49 -07:00
committed by Facebook GitHub Bot
parent e5006b3436
commit 2c896d3578
@@ -382,8 +382,6 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
mReactInstanceManager.createReactContextInBackground();
attachToReactInstanceManager();
} finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}