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);
}
}
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
supportedOrientations={['portrait', 'landscape']}
>
@vijay-dadhich09 where should I add this piece of code?
@tal987 You should add props to your react-native modals
Most helpful comment
found solution... Thanks
https://github.com/facebook/react-native/issues/11036
supportedOrientations={['portrait', 'landscape']}
>