Skip to content

Commit

Permalink
RCTSurface: Optional sync ShadowView/View registing
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shergin authored and facebook-github-bot committed Feb 21, 2018
1 parent 8c036ce commit b90c1cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion React/Base/Surface/RCTSurface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ - (void)_registerRootView

RCTUIManager *uiManager = batchedBridge.uiManager;

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

RCTSurfaceRootShadowView *rootShadowView =
Expand Down

0 comments on commit b90c1cf

Please sign in to comment.