wonday / react-native-orientation-locker

A react-native module that can listen on orientation changing of device, get current orientation, lock to preferred orientation.
MIT License
740 stars 273 forks source link

System Auto-Rotate off/on ignored on Android. #255

Open klemanjar0 opened 1 year ago

klemanjar0 commented 1 year ago

Android device ignores system auto-rotation setting, which can be switched on/off in settings. If auto-rotate is off, device keeps changing it's orientation.

public void onOrientationChanged(int orientation) function should be modified, it should has code on top, which I provide below.

final ContentResolver resolver = ctx.getContentResolver(); boolean rotateLock = android.provider.Settings.System.getInt( resolver, android.provider.Settings.System.ACCELEROMETER_ROTATION, 0) == 1; if (!rotateLock) { return; }

saikiranm33 commented 4 months ago
Screenshot 2024-03-05 at 8 54 35 AM

Reference :- https://developer.android.com/reference/android/R.attr#screenOrientation