Skip to content

Commit

Permalink
Fix condition that detected whether we should update screen fram… (#336)
Browse files Browse the repository at this point in the history
The previous condition was broken as under certain circumstances we would've receive a setReactFrame with no active screen rendered to only get the screen activate in a while. This resulted in the view dimention not being properly updated. This diff changes the condition and verifies whether a screen is mounted under UINavController or not. When not, we assume it is mounted under regular screen container and allow the frame to be adjusted from react.
  • Loading branch information
kmagiera committed Feb 17, 2020
1 parent 4f792b4 commit e6ed417
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ios/RNSScreen.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge

- (void)reactSetFrame:(CGRect)frame
{
if (_active) {
if (![self.reactViewController.parentViewController
isKindOfClass:[UINavigationController class]]) {
[super reactSetFrame:frame];
}
// ignore setFrame call from react, the frame of this view
// is controlled by the UIViewController it is contained in
// when screen is mounted under UINavigationController it's size is controller
// by the navigation controller itself. That is, it is set to fill space of
// the controller. In that case we ignore react layout system from managing
// the screen dimentions and we wait for the screen VC to update and then we
// pass the dimentions to ui view manager to take into account when laying out
// subviews
}

- (void)updateBounds
Expand Down

0 comments on commit e6ed417

Please sign in to comment.