From c0aa398550bb64f0ebe068ad3b603c4d703309aa 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 --- .../ios/renderer/component/modal/HippyModalHostView.m | 7 ++++++- .../component/modal/HippyModalTransitioningDelegate.m | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) 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]; } }