Skip to content

Commit

Permalink
Fix statusBar visibility through mergeOptions (#6437)
Browse files Browse the repository at this point in the history
`mergeOptions` with `statusBar.visible` didn't work on iOS. This PR fix it.
  • Loading branch information
yogevbd authored Jul 27, 2020
1 parent c9e5309 commit 36e0e81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ios/RNNBasePresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigat
if (options.window.backgroundColor.hasValue) {
UIApplication.sharedApplication.delegate.window.backgroundColor = withDefault.window.backgroundColor.get;
}

if (options.statusBar.visible.hasValue) {
[self.boundViewController setNeedsStatusBarAppearanceUpdate];
}
}

- (void)renderComponents:(RNNNavigationOptions *)options perform:(RNNReactViewReadyCompletionBlock)readyBlock {
Expand Down
9 changes: 9 additions & 0 deletions playground/ios/NavigationTests/RNNBasePresenterTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,13 @@ - (void)testHidesBottomBarWhenPushed_resolveChildHidesBarBeforeParent {
XCTAssertTrue(_boundViewController.hidesBottomBarWhenPushed);
}

- (void)testMergeOptions_updatesStatusBarVisibility {
RNNNavigationOptions* mergeOptions = [RNNNavigationOptions emptyOptions];
mergeOptions.statusBar.visible = [Bool withValue:@(0)];

[[self.mockBoundViewController expect] setNeedsStatusBarAppearanceUpdate];
[self.uut mergeOptions:mergeOptions resolvedOptions:nil];
[self.mockBoundViewController verify];
}

@end

0 comments on commit 36e0e81

Please sign in to comment.