Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions React/Base/RCTRootContentView.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ - (void)updateAvailableSize
return;
}

//unnecessary to update avaliableSize, it's triggered by setBounds: from RCTUIManager
if (self.superview) {
CGRect superviewFrame = self.superview.bounds;
if (!CGRectEqualToRect(superviewFrame, self.frame)) {

@shergin shergin Nov 21, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, but what is an idea/reasoning behind this changeset?
Comparing view.frame with superview.bounds makes no any sense, I am afraid.

@fishmwei fishmwei Nov 22, 2017

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@shergin
I always think that the size of content view should be equal to its super view's size. That's why you set content's frame in the function layoutSubviews of rootView ?

- (void)layoutSubviews
{
  [super layoutSubviews];
  _contentView.frame = self.bounds;  // here
  _loadingView.center = (CGPoint){
    CGRectGetMidX(self.bounds),
    CGRectGetMidY(self.bounds)
  };
}

if view.frame != superview.bounds, it's invalidate. If update avaliableSize in the case, it will lead to set view.bounds with a size which does not equal to superview.bounds later, so the bug occurs.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@shergin what's your opinion?

return;
}
}

[_bridge.uiManager setAvailableSize:self.availableSize forRootView:self];
}

Expand Down