React-native-orientation: ios: getting error with modal window: Exception thrown while executing UI block: Supported orientations has no common orientation with the application, and [RCTModalHostViewController shouldAutorate] is returning YES

Created on 27 Nov 2017  路  5Comments  路  Source: yamill/react-native-orientation

I am getting following error when calling Orientation.lockToLandscape(); Any Solution?
Error:
Exception thrown while executing UI block: Supported orientations has no common orientation with the application, and [RCTModalHostViewController shouldAutorate] is returning YES

Code:
componentDidMount() {
const initial = Orientation.getInitialOrientation();
Orientation.unlockAllOrientations();
if (initial === 'PORTRAIT') {
console.log('Prtrate: ', initial);
Orientation.lockToLandscape();
} else {
console.log('landscape: ', initial);
}
}

Most helpful comment

found solution... Thanks
https://github.com/facebook/react-native/issues/11036

visible={true}
supportedOrientations={['portrait', 'landscape']}
>

All 5 comments

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

found solution... Thanks
https://github.com/facebook/react-native/issues/11036

visible={true}
supportedOrientations={['portrait', 'landscape']}
>

@vijay-dadhich09 where should I add this piece of code?

@tal987 You should add props to your react-native modals

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DriesVS picture DriesVS  路  7Comments

wellyshen picture wellyshen  路  3Comments

shaikhussian picture shaikhussian  路  8Comments

Mactub07 picture Mactub07  路  7Comments

44326334 picture 44326334  路  8Comments