【问题标题】:Supported orientations has no common orientation with the application, and [RCTModalHostViewController shouldAutorotate] is returning YES支持的方向与应用程序没有共同的方向,并且 [RCTModalHostViewController shouldAutorotate] 返回 YES
【发布时间】:2018-10-25 12:01:54
【问题描述】:

我有应用程序在 iOS 上进行本机反应,我通过这样做将其锁定为横向模式:

componentDidMount() {
Orientation.lockToLandscape()
}

我添加了一个弹出窗口,但是当我按下它时,我得到了这个错误:

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

在 app.delegate 上我添加了这个函数:

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

 return [Orientation getOrientation];
   }

在纵向上没有发生此错误

我该如何解决...谢谢

【问题讨论】:

    标签: ios react-native popover landscape


    【解决方案1】:

    我找到了这个问题的根本原因。这发生在模态窗口中。我的视频在模态窗口中打开,当我从纵向更改为横向时,出现此错误。

    解决方案:

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

    【讨论】:

      猜你喜欢
      • 2012-09-14
      • 2014-11-19
      • 1970-01-01
      • 2013-01-05
      • 1970-01-01
      • 2015-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多