mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Fixed threading issues in RCTSurfacePresenter
Summary: RCTComponentViewRegistry is not a thread-safe class and must be accessed only from the main thread. Reviewed By: JoshuaGross Differential Revision: D15296475 fbshipit-source-id: 67192abd6290191f3b8119972efc41cec48a793a
This commit is contained in:
committed by
Facebook Github Bot
parent
55db1d05fb
commit
9e3856fd99
@@ -250,8 +250,11 @@ using namespace facebook::react;
|
||||
|
||||
- (void)_startSurface:(RCTFabricSurface *)surface
|
||||
{
|
||||
[_mountingManager.componentViewRegistry dequeueComponentViewWithComponentHandle:RootShadowNode::Handle()
|
||||
tag:surface.rootTag];
|
||||
RCTMountingManager *mountingManager = _mountingManager;
|
||||
RCTExecuteOnMainQueue(^{
|
||||
[mountingManager.componentViewRegistry dequeueComponentViewWithComponentHandle:RootShadowNode::Handle()
|
||||
tag:surface.rootTag];
|
||||
});
|
||||
|
||||
LayoutContext layoutContext = {
|
||||
.pointScaleFactor = RCTScreenScale()
|
||||
@@ -273,11 +276,14 @@ using namespace facebook::react;
|
||||
{
|
||||
[self._scheduler stopSurfaceWithSurfaceId:surface.rootTag];
|
||||
|
||||
UIView<RCTComponentViewProtocol> *rootView =
|
||||
[_mountingManager.componentViewRegistry componentViewByTag:surface.rootTag];
|
||||
[_mountingManager.componentViewRegistry enqueueComponentViewWithComponentHandle:RootShadowNode::Handle()
|
||||
tag:surface.rootTag
|
||||
componentView:rootView];
|
||||
RCTMountingManager *mountingManager = _mountingManager;
|
||||
RCTExecuteOnMainQueue(^{
|
||||
UIView<RCTComponentViewProtocol> *rootView =
|
||||
[mountingManager.componentViewRegistry componentViewByTag:surface.rootTag];
|
||||
[mountingManager.componentViewRegistry enqueueComponentViewWithComponentHandle:RootShadowNode::Handle()
|
||||
tag:surface.rootTag
|
||||
componentView:rootView];
|
||||
});
|
||||
|
||||
[surface _unsetStage:(RCTSurfaceStagePrepared | RCTSurfaceStageMounted)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user