Refined -[RCTUIManager createView:]
Summary: Now we do not add newly created view to the registry at the preluminary step. Reviewed By: mmmulani Differential Revision: D6641403 fbshipit-source-id: c69077aaba871f3cdb3500c75e1efe07546e1b7f
This commit is contained in:
parent
c491b22233
commit
e46ea8c737
|
@ -967,21 +967,19 @@ RCT_EXPORT_METHOD(createView:(nonnull NSNumber *)reactTag
|
||||||
|
|
||||||
// Dispatch view creation directly to the main thread instead of adding to
|
// Dispatch view creation directly to the main thread instead of adding to
|
||||||
// UIBlocks array. This way, it doesn't get deferred until after layout.
|
// UIBlocks array. This way, it doesn't get deferred until after layout.
|
||||||
__weak RCTUIManager *weakManager = self;
|
__block UIView *preliminaryCreatedView;
|
||||||
|
|
||||||
RCTExecuteOnMainQueue(^{
|
RCTExecuteOnMainQueue(^{
|
||||||
RCTUIManager *uiManager = weakManager;
|
preliminaryCreatedView = [componentData createViewWithTag:reactTag];
|
||||||
if (!uiManager) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
UIView *view = [componentData createViewWithTag:reactTag];
|
|
||||||
if (view) {
|
|
||||||
uiManager->_viewRegistry[reactTag] = view;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
[self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
[self addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||||
UIView *view = viewRegistry[reactTag];
|
if (!preliminaryCreatedView) {
|
||||||
[componentData setProps:props forView:view];
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uiManager->_viewRegistry[reactTag] = preliminaryCreatedView;
|
||||||
|
[componentData setProps:props forView:preliminaryCreatedView];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self _shadowView:shadowView didReceiveUpdatedProps:[props allKeys]];
|
[self _shadowView:shadowView didReceiveUpdatedProps:[props allKeys]];
|
||||||
|
|
Loading…
Reference in New Issue