React Native将 ipad 端软件设置为横屏显示后关闭 Modal 弹窗报错

问题:

将 ipad 端软件设置为横屏显示后,关闭 Modal 弹窗报错。

Modal was presented with 0x2 orientations mask but the application only supports 0x18.Add more interface orientations to your app's Info.plist to fix this.NOTE: This will crash in non-dev mode.

解决:

supportedOrientations={['portrait', 'landscape']}

typescript 复制代码
<Modal supportedOrientations={['portrait', 'landscape']} />

supportedOrientations

用于指定在设备切换横竖屏方向时,modal 会在哪些屏幕朝向下跟随旋转。在 iOS上,除了本属性外,还会受到应用的 Info.plist 文件中UISupportedInterfaceOrientations的限制。如果还设置了presentationStyle属性为pageSheet或formSheet,则在 iOS 上本属性将被忽略。

参考:
https://github.com/facebook/react-native/issues/13951
https://reactnative.cn/docs/modal#supportedorientations

相关推荐
YFF菲菲兔7 小时前
React 事件系统:listenToAllSupportedEvents
react.js
光影少年13 小时前
RN 渲染原理:不依赖WebView,原生控件渲染
前端·react native·react.js·前端框架
LaughingZhu1 天前
智能体经典范式构建:ReAct、Plan-and-Solve 与 Reflection
前端·react.js·前端框架
飞天狗1 天前
长列表滚动卡顿怎么破:虚拟列表选型 + react-virtuoso 实战调优指南
react.js·性能优化
binbin_521 天前
React 井字棋教程:用一个小游戏理解组件和状态
前端·react.js·前端框架
张元清1 天前
React useObjectUrl Hook:预览文件与 Blob,不留内存泄漏(2026)
javascript·react.js
2501_916007472 天前
iPad 怎么抓包 从代理模式到暴力抓包的操作方法
android·ios·小程序·uni-app·代理模式·iphone·ipad
我是大卫2 天前
【图】React源码解析-第五部分:底层数据结构与内存模型
react.js·源码阅读
真的想不出名儿2 天前
Md编辑器整合-react
前端·react.js·编辑器
牛仔只喝牛奶2 天前
多端跨端技术选型:小程序 + H5 + App 的两栈拆分落地
react native·react.js