[android] Orientation.unlockAllOrientations () does not work
See original GitHub issueI’m using react-navigation, In the previous screen, I used lockToPortrait () to prevent landscape.
In the next screen, I was working on unlockAllOrientations () to make the landscape change possible.
But unlockAllOrientations () does not work on Android! The addDeviceOrientationListener obviously changes, but the UI does not change.
Is there a way to solve it? I need help
The problem only occurs with Android. iOS works fine.
lock landscape screen
componentDidMount = () => {
this.getFeedData();
setTimeout(() => {
Orientation.lockToPortrait();
}, 10);
};
I was going to go to the next screen and unlock it using unlockAllOrientations ().
unlock screen
componentDidMount = () => {
BackHandler.addEventListener('hardwareBackPress', this.handleBackPress);
Orientation.addDeviceOrientationListener(this.onOrientationDidChange);
Orientation.unlockAllOrientations();
}
android version
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
I run it with version 8.1 Android emulator. react-native-orientation-locker, use 1.1.1 version now
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:6 (1 by maintainers)
Top Results From Across the Web
React Native Orientation does not listening Current System ...
Im using react-native-orientation . I want to lock initial login screen in portrait mode. so i have used Orientation.lockToPortrait() in app.tsx ...
Read more >react-native-orientation-locker - npm
A react-native module that can listen on orientation changing of device, get current orientation, lock to preferred orientation.
Read more >42-react-native-orientation-locker - NPM Package Overview
A react-native module that can listen on orientation changing of device, get current orientation, lock to preferred orientation.
Read more >Set or Get Preferred Device Orientation in React Native
Hello guys, This is an Example to Get Device Orientation and Set Preferred Orientation ... Open node_modules/react-native-orientation/android/build.gradle.
Read more >Fixing orientation problems on react-native ... - MitrahSoft Blog
Solution For ReactNative Barcode Scanning Mobile App Orientation Problems ... natively rendering mobile applications for iOS and Android.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
found!
In styles.xml on Android <item name = "android: windowIsTranslucent"> true </ item>
If you comment out this, it works perfectly on Android.
Hi guys I am using react-native camera for barCode scan. When componentMount I lock the device orientation into Landscape. When componentWillUnmount I used unlockAllOrientations. But the device remains the Landscape only in IOS. In android it works fine. Anyway to fix this in IOS.