From 7aedc7ccf2b6754cb5ba90417072611d8c28df3c Mon Sep 17 00:00:00 2001 From: ruifanyuan Date: Mon, 6 Nov 2023 21:00:57 +0800 Subject: [PATCH] fix(ios): make use of darkStatusBarText property in modal controller --- framework/examples/ios-demo/HippyDemo/Info.plist | 4 +--- .../ios/renderer/component/modal/HippyModalHostView.m | 7 ++++++- .../component/modal/HippyModalTransitioningDelegate.m | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/framework/examples/ios-demo/HippyDemo/Info.plist b/framework/examples/ios-demo/HippyDemo/Info.plist index 5f9fba50749..b381cdad8cd 100644 --- a/framework/examples/ios-demo/HippyDemo/Info.plist +++ b/framework/examples/ios-demo/HippyDemo/Info.plist @@ -10,8 +10,6 @@ $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 - CFBundleName - $(PRODUCT_NAME) CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString @@ -53,6 +51,6 @@ UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance - + diff --git a/renderer/native/ios/renderer/component/modal/HippyModalHostView.m b/renderer/native/ios/renderer/component/modal/HippyModalHostView.m index 7682b6c1e87..d79873080b6 100644 --- a/renderer/native/ios/renderer/component/modal/HippyModalHostView.m +++ b/renderer/native/ios/renderer/component/modal/HippyModalHostView.m @@ -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]; } } diff --git a/renderer/native/ios/renderer/component/modal/HippyModalTransitioningDelegate.m b/renderer/native/ios/renderer/component/modal/HippyModalTransitioningDelegate.m index d93e799d23b..0115e7c44c5 100644 --- a/renderer/native/ios/renderer/component/modal/HippyModalTransitioningDelegate.m +++ b/renderer/native/ios/renderer/component/modal/HippyModalTransitioningDelegate.m @@ -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]; } }