react-native-orientation-locker
react-native-orientation-locker copied to clipboard
[IOS] addDeviceOrientationListener not working on IOS device when Auto-rotate turn off
I want to listen to orientation changes when the AUTO rotate turn off. The fact that I wasn't getting addDeviceOrientationListener on IOS even when it was working on Android
RN: 0.61.5
+1, Is there a solution?
+1
Any update on this? I have it working on Android but the same code doesn't work on IOS (Testing on an Iphone 11).
For anyone interested. If you use Orientation.lockToPortrait() to lock into portrait mode instead of using the phone's rotation lock menu setting, then it works.
Having the same exact issue...
Resolved it by patching this on my local react-native-orientation-locker
package:
https://gist.github.com/jzxchiang1/bd7e906038eb9a2c57857b5f1a0d6a3f
Use npx patch-package
to do that. Make sure to rebuild your app's native code after doing this using typical npm run ios
or Xcode run.
Code copied from react-native-camera
, which implements this correctly: https://github.com/react-native-camera/react-native-camera/blob/941536592cb8ad6f65f3cb50e2fe814b7c70c093/ios/RCT/RCTSensorOrientationChecker.m
Hope this helps!
Unfortunately I'm using react-native-orientation-locker 1.6, and after running "npx patch-package" and "npm run ios" it still doesn't work even though the above process doesn't error.
I have the same problem, auto rotate works on android but not on ios, any solution?
Not fixed in 1.7.0
@jzxchiang1 It doesn't work in my case (I use 1.5 version, but it shouldn't matter)