Reputation: 3086
I had locked my react application to landscape by adding the following code to Application tag(in Manifest) and inside every activities tag
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|screenSize
It was working fine, until i added the modules for file reading react-native-fs
Now when the app starts the screen is rotated to landscape, but if the user rotates the phone to portrait, the screen also rotates to portrait (it should remain in landscape instead).
Things i tried
Still it's not locked to landscape.
The app should be locked to landscape even if rotated to portrait.
Upvotes: 0
Views: 828
Reputation: 3086
I figured out the problem. The React-Native-Navigation library was causing the issue. It had a class ActivityCallBacks inside Controller package . Adding the following code inside onActivityCreated() resolved the issue :
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Upvotes: 0
Reputation: 2620
I'm not completely sure, but I think you need to use android:configChanges="keyboardHidden|orientation|screenSize"
Upvotes: 1