react-native - React Native Orientation 不监听当前系统自动旋转状态
问题描述
我正在使用react-native-orientation
. 我想以纵向模式锁定初始登录屏幕。所以我Orientation.lockToPortrait()
在 app.tsx 和Orientation.unlockAllOrientations()
屏幕的构造函数中使用过,我想再次启用旋转。
但问题是当设备/模拟器系统自动旋转从通知栏禁用时它仍然旋转。如果设备/模拟器系统自动旋转启用,我想旋转。否则不是。
那么有什么方法可以监听系统/设备轮换状态吗?或任何建议?
解决方案
react-native-orientation 这个包没有这样的功能 react-native-orientation-locker 解决了我的问题。
推荐阅读
- python - python如何计算if语句中的虚拟变量
- c# - Angular - 如何在 subscribe() 上从 Web API 下载文件
- python - 熊猫在df中找到与前一行具有相同值的最后一行
- sybase - Sybase - 如何从具有重复字符串的字段中提取部分文本?
- java - JSONPath 和 Traverson 过滤:单元素数组
- python - pip 8.1 的自定义 pip.conf 位置
- python - 如何在 conda 中安装 anaconda 中不可用的软件包
- c# - 在 Nunit 中测试异常
- ember.js - 用 moment.js 更新 Ember.js,失去了凉亭,现在?
- javascript - 如何从我的网站启动我的 Windows 10 应用程序(使用 JavaScript?)