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

相关推荐
一个扣子2 天前
降低 Android APK 体积:Hermes 的字节码格式与资源压缩
react native·字节码·构建优化·包体积优化·android性能·hermes·apk瘦身
cn_mengbei2 天前
用React Native开发OpenHarmony应用:Reanimated共享元素过渡
javascript·react native·react.js
We་ct2 天前
React 性能优化精讲
前端·javascript·react.js·性能优化·前端框架·html·浏览器
光影少年3 天前
前端在页面渲染优化和组件优化经验?
前端·vue.js·react.js·前端框架
Wect3 天前
React 性能优化精讲
前端·react.js·性能优化
CHHC18804 天前
eSIM SGP32/SGP22 EUICC.SDK - IPAd
ipad·esim·sgp32
Digitally4 天前
如何将 iPad 上的视频无损传输到 Mac
macos·音视频·ipad
光影少年4 天前
react性能优化比较好的办法有哪些?
前端·react.js·性能优化
Ww.xh4 天前
Figma设计稿转React代码:ClaudeCode+MCP实战教程
前端·react.js·figma
朝阳394 天前
react【实战】自定义下拉框、单选、多选、输入框
前端·javascript·react.js