如何在 React Native 中禁用旋转? [英] how to disable rotation in React Native?

查看:58
本文介绍了如何在 React Native 中禁用旋转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想支持纵向视图.如何让 React Native 应用程序不自动旋转?我尝试搜索文档和 Github 问题,但没有找到任何有用的信息.

I would like to support only portrait view. How can I make a React Native app not to autorotate? I tried searching documentation and Github issues, but I didn't find anything helpful.

推荐答案

React Native 应用程序几乎只是一个普通的 iOS 应用程序,因此您可以按照与所有其他应用程序完全相同的方式进行操作.只需取消选中(在 XCode 中)Landscape Left"和Landscape Right"作为常规应用程序属性中允许的设备方向:

React Native app is pretty much just a normal iOS application, so you can do it in exactly the same way as you do for all other apps. Simply uncheck (in XCode) the "Landscape Left" and "Landscape Right" as allowed Device Orientations in the General application properties:

这篇关于如何在 React Native 中禁用旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆