Created
March 4, 2024 14:44
-
-
Save aleqsio/b1cb8bd24f34ed697e21b0f28a1efe68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/react-native-screens/ios/RNSScreen.mm b/node_modules/react-native-screens/ios/RNSScreen.mm | |
index 4b24cff..b025349 100644 | |
--- a/node_modules/react-native-screens/ios/RNSScreen.mm | |
+++ b/node_modules/react-native-screens/ios/RNSScreen.mm | |
@@ -1220,6 +1220,18 @@ - (UIViewController *)findChildVCForConfigAndTrait:(RNSWindowTrait)trait includi | |
UIViewController *lastViewController = [[self childViewControllers] lastObject]; | |
if ([self.presentedViewController isKindOfClass:[RNSScreen class]]) { | |
lastViewController = self.presentedViewController; | |
+ | |
+ // In case of fullScreenModal we want to ask for orientation specifically the screen underneath, | |
+ // so that when the modal is dismissed the controller underneath is already in expected orientation, | |
+ // without the need to first wait for the dimissal to complete and only then to rotate. | |
+ // See: https://github.com/software-mansion/react-native-screens/pull/1848/ | |
+ // Also note, that on simulator some weird visual glitch can bee seen (see the PR ^ for details), | |
+ // however it looks like it does not exist on real device. | |
+ RNSScreen *modalScreen = (RNSScreen *)lastViewController; | |
+ if (modalScreen.screenView.stackPresentation == RNSScreenStackPresentationFullScreenModal) { | |
+ return self; | |
+ } | |
+ | |
// we don't want to allow controlling of status bar appearance when we present non-fullScreen modal | |
// and it is not possible if `modalPresentationCapturesStatusBarAppearance` is not set to YES, so even | |
// if we went into a modal here and ask it, it wouldn't take any effect. For fullScreen modals, the system |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment