React-native-orientation: ios Orientation.lockToLandscape() Error

Created on 19 Feb 2018  路  9Comments  路  Source: yamill/react-native-orientation

* Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [RCCTabBarController shouldAutorotate] is returning YES'
*
First throw call stack:
What problem?
please help me

Most helpful comment

I got this error while using a Modal and the solution at https://github.com/yamill/react-native-orientation/issues/246#issuecomment-347427696 fixed it for me.

All 9 comments

Same issue here.

Can you allow both portrait and landscape but still lock it on only one of them ?

I'm having the same issue. Did anyone find a solution?

Hey @andyesp, my workaround was create a timeout before lockToLandscape, Something like this

setTimeout(function(){ Orientation.lockToLandscape(); }, 100)

I am using a component with webview and setTimeout did not solve =/

Got the same error.

There is my analysis (I know nothing on iOS native development, so this is mainly trial/error, code reading and logic) :

  • You request to lock to landscape so supportedInterfaceOrientationsForWindow returns now 'Landscape'.
  • You're phone is still in Portrait position. Portrait is not Landscape : Supported orientations has no common orientation with the application
  • Some controller somewhere says : You should be able to autorotate. [RCCTabBarController shouldAutorotate] is returning YES
  • iOS catches the incoherence and crashes.

As a workaround, I edit my controller.

  • Import "Orientation.h"
  • Changes return YES by return [Orientation getOrientation] == UIInterfaceOrientationMaskAllButUpsideDown
    Dirty but it works.

+1

I got this error while using a Modal and the solution at https://github.com/yamill/react-native-orientation/issues/246#issuecomment-347427696 fixed it for me.

I got this error while using a Modal and the solution at #246 (comment) fixed it for me.

Thanks. Error with modal for me.

Was this page helpful?
0 / 5 - 0 ratings