Skip to content

Commit b90c1cf

Browse files
sherginfacebook-github-bot
authored andcommitted
RCTSurface: Optional sync ShadowView/View registing
Summary: See the comment in code. If we on the main thread on registering time, we can/will break sequentiality of registering and mounting processes doing registration asynchronously. We need this to make sync mouting eventually possible. Reviewed By: fkgozali Differential Revision: D7014176 fbshipit-source-id: 110ad5e5d86e3422eac15c3b1bdb29ae04acd7e6
1 parent 8c036ce commit b90c1cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

React/Base/Surface/RCTSurface.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,9 @@ - (void)_registerRootView
321321

322322
RCTUIManager *uiManager = batchedBridge.uiManager;
323323

324-
RCTExecuteOnUIManagerQueue(^{
324+
// If we are on the main queue now, we have to proceed synchronously.
325+
// Otherwise, we cannot perform synchronous waiting for some stages later.
326+
(RCTIsMainQueue() ? RCTUnsafeExecuteOnUIManagerQueueSync : RCTExecuteOnUIManagerQueue)(^{
325327
[uiManager registerRootViewTag:self->_rootViewTag];
326328

327329
RCTSurfaceRootShadowView *rootShadowView =

0 commit comments

Comments
 (0)