Skip to content

Commit

Permalink
fix(ios): make use of darkStatusBarText property in modal controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ruifanyuan committed Nov 6, 2023
1 parent 46b4e77 commit c0aa398
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ - (void)didMoveToWindow {
[_delegate presentModalHostView:self withViewController:_modalViewController animated:[self hasAnimationType]];
_isPresented = YES;
originStyle = _modalViewController.preferredStatusBarStyle;
UIStatusBarStyle theStyle = self.darkStatusBarText ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent;
UIStatusBarStyle theStyle;
if (@available(iOS 13.0, *)) {
theStyle = self.darkStatusBarText ? UIStatusBarStyleDarkContent : UIStatusBarStyleLightContent;
} else {
theStyle = self.darkStatusBarText ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent;
}
[_modalViewController setPreferredStatusBarStyle:theStyle];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ - (void)presentModalHostView:(HippyModalHostView *)modalHostView
_presentationBlock([modalHostView hippyViewController], viewController, animated, completionBlock);
} else {
if ([modalHostView.hideStatusBar boolValue]) {
viewController.modalPresentationCapturesStatusBarAppearance = YES;
viewController.hideStatusBar = [modalHostView hideStatusBar];
}
viewController.modalPresentationCapturesStatusBarAppearance = YES;
[[modalHostView hippyViewController] presentViewController:viewController animated:animated completion:completionBlock];
}
}
Expand Down

0 comments on commit c0aa398

Please sign in to comment.