Skip to content

Commit

Permalink
Fix applying drawBehind through mergeOptions (#5951)
Browse files Browse the repository at this point in the history
mergeOptions did not handle bottomTabs.drawBehind options properly - the ReactRootView wasn't remeasured.
  • Loading branch information
yogevbd authored Feb 23, 2020
1 parent 2b87be7 commit e002a68
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/ios/RNNComponentPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,13 @@ - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigat

if (options.topBar.drawBehind.hasValue) {
[viewController setDrawBehindTopBar:options.topBar.drawBehind.get];
}
}

if (options.bottomTabs.drawBehind.hasValue) {
[viewController setDrawBehindTabBar:options.bottomTabs.drawBehind.get];
}

if (options.topBar.title.text.hasValue) {
if (options.topBar.title.text.hasValue) {
[viewController setNavigationItemTitle:options.topBar.title.text.get];
}

Expand Down
10 changes: 10 additions & 0 deletions lib/ios/UIViewController+RNNOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ - (void)setDrawBehindTopBar:(BOOL)drawBehind {
} else {
self.edgesForExtendedLayout &= ~UIRectEdgeTop;
}

if (self.isViewLoaded) {
[self.view setNeedsLayout];
[self.view layoutIfNeeded];
}
}

- (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar {
Expand All @@ -70,6 +75,11 @@ - (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar {
} else {
self.edgesForExtendedLayout &= ~UIRectEdgeBottom;
}

if (self.isViewLoaded) {
[self.view setNeedsLayout];
[self.view layoutIfNeeded];
}
}

- (void)setTabBarItemBadge:(NSString *)badge {
Expand Down

0 comments on commit e002a68

Please sign in to comment.