react-native-orientation icon indicating copy to clipboard operation
react-native-orientation copied to clipboard

ios Orientation.lockToLandscape() Error

Open andrei0807 opened this issue 7 years ago • 11 comments

*** 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

andrei0807 avatar Feb 19 '18 15:02 andrei0807

Same issue here.

diegotsi avatar Mar 08 '18 20:03 diegotsi

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

Kouznetsov avatar Mar 09 '18 09:03 Kouznetsov

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

andyesp avatar Jun 08 '18 17:06 andyesp

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

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

diegotsi avatar Jun 19 '18 18:06 diegotsi

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

rafaelbusetti avatar Jun 19 '18 19:06 rafaelbusetti

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.

Charlynux avatar Jul 06 '18 15:07 Charlynux

+1

jvitorr avatar Feb 07 '19 17:02 jvitorr

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.

tonygentilcore avatar Apr 08 '19 20:04 tonygentilcore

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

Thanks. Error with modal for me.

Surangaup avatar Feb 13 '21 08:02 Surangaup

the issue still unresolved for 4 Years :))

jafar-jabr avatar Nov 20 '22 02:11 jafar-jabr

yes, I am facing the same issue. Can anyone help me to resolve this?

I have updated all of my Modals like below:

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

please, any help?

Muhammad-AhmadRafique avatar Dec 06 '22 11:12 Muhammad-AhmadRafique