Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6581

How to detect auto-rotation status (enabled/disabled) without actually rotating the screen?

$
0
0

I'm trying to check the auto-rotation status of the device in React Native for both Android and iOS.

I need this to handle the logic: when a user rotates their device & auto-rotation is enabled -> the app will enter full screen mode. If auto-rotation is disabled, it won't do anything.

I've tried 2 approaches:

using getAutoRotateState from react-native-orientation-locker -> only works on Androidchecking if the screen rotates when the user rotates the device -> can only check after the screen has already rotated

What I want is to be able to check the auto-rotation status (on/off) before the user rotates their device, and have it work on both Android and iOS. I'd prefer not to use Native Modules if possible.


Viewing all articles
Browse latest Browse all 6581

Latest Images

Trending Articles



Latest Images