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 authored and hippy-actions[bot] committed Nov 6, 2023
1 parent b6b22bb commit 7aedc7c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions framework/examples/ios-demo/HippyDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
Expand Down Expand Up @@ -53,6 +51,6 @@
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<true/>
</dict>
</plist>
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 7aedc7c

Please sign in to comment.