Skip to content

Commit

Permalink
Revert D6641403: [RN] Refined -[RCTUIManager createView:]
Browse files Browse the repository at this point in the history
Differential Revision: D6641403

fbshipit-source-id: f478810413aa49b44c060db898e7e8698bddb8e1
  • Loading branch information
shergin authored and facebook-github-bot committed Jan 10, 2018
1 parent b0319f3 commit b9b7fab
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -967,19 +967,21 @@ - (void)_manageChildren:(NSNumber *)containerTag

// Dispatch view creation directly to the main thread instead of adding to
// UIBlocks array. This way, it doesn't get deferred until after layout.
__block UIView *preliminaryCreatedView;

__weak RCTUIManager *weakManager = self;
RCTExecuteOnMainQueue(^{
preliminaryCreatedView = [componentData createViewWithTag:reactTag];
});

[self addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
if (!preliminaryCreatedView) {
RCTUIManager *uiManager = weakManager;
if (!uiManager) {
return;
}
UIView *view = [componentData createViewWithTag:reactTag];
if (view) {
uiManager->_viewRegistry[reactTag] = view;
}
});

uiManager->_viewRegistry[reactTag] = preliminaryCreatedView;
[componentData setProps:props forView:preliminaryCreatedView];
[self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
UIView *view = viewRegistry[reactTag];
[componentData setProps:props forView:view];
}];

[self _shadowView:shadowView didReceiveUpdatedProps:[props allKeys]];
Expand Down

1 comment on commit b9b7fab

@aleclarson
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if you could explain your revert commits in the future. 😄

Please sign in to comment.