Supported orientations has no common orientation with the application, and [RCTModalHostViewController shouldAutorotate] is returning YES
Asked Answered
D

1

6

I have app in react native on iOS which I locked it on landscape mode by doing this:

componentDidMount() {
Orientation.lockToLandscape()
}

I added a popover window but when I press on it im getting this error:

 Exception thrown while executing UI block:
 Supported orientations has no common orientation with the application,
 and [RCTModalHostViewController shouldAutorotate] is returning YES

on app.delegate I added this function:

 - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications]) {
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
 }

 return [Orientation getOrientation];
   }

on portrait this error doesn't happened

How can I fix it... thank you

Davie answered 25/10, 2018 at 12:1 Comment(0)
S
11

I found root cause of this issue. This is happening with modal window. My video is opening in the Modal Window and when I am changing from Portrait to landscape it getting this error.

Solution:

<Modal
  visible={true}
  supportedOrientations={['portrait', 'landscape']}
>
Sheridansherie answered 4/12, 2018 at 11:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.