首页 > 解决方案 > React Native Orientation 不监听当前系统自动旋转状态

问题描述

我正在使用react-native-orientation. 我想以纵向模式锁定初始登录屏幕。所以我Orientation.lockToPortrait()在 app.tsx 和Orientation.unlockAllOrientations()屏幕的构造函数中使用过,我想再次启用旋转。

但问题是当设备/模拟器系统自动旋转从通知栏禁用时它仍然旋转。如果设备/模拟器系统自动旋转启用,我想旋转。否则不是。

那么有什么方法可以监听系统/设备轮换状态吗?或任何建议?

标签: react-nativeorientationscreen-orientationautorotate

解决方案


react-native-orientation 这个包没有这样的功能 react-native-orientation-locker 解决了我的问题。


推荐阅读