Open erdouzun opened 5 years ago
checking the this url https://github.com/yamill/react-native-orientation/issues/121
Or use a react-native-orientation-locker module with normal support ! :+1:
Try this configuration in AppDelegate.m:
#import "Orientation.h" // <--- import
@implementation AppDelegate
// ...
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications]) {
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
}
return [Orientation getOrientation];
}
@end
Try this configuration in AppDelegate.m:
#import "Orientation.h" // <--- import @implementation AppDelegate // ... - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications]) { [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; } return [Orientation getOrientation]; } @end
This worked for me, thank you!
Hi,
I'm trying to lock the screen on portrait mode. I applied every rule correctly according to https://github.com/yamill/react-native-orientation
componentDidMount() { Orientation.lockToPortrait(); Orientation.addOrientationListener(this._onOrientationDidChange); //Orientation.lockToLandscape() }
componentWillMount() { var initial = Orientation.getInitialOrientation(); if (initial === 'PORTRAIT') { //do stuff } else { //do other stuff } }
_onOrientationDidChange = (orientation) => { if (orientation == 'LANDSCAPE') { // } else { //do something with portrait layout } }
RN version 0.58 "react-native-orientation": "^3.1.3",
Can anyone help me about this issue? I searched the issues, found the similars but nothing helps me