(React Native) lock the screen in the landscape

I am new to React Native and I cannot find a way to block the page view in landscape mode. Is there any way to do this?

Thanks.

+4
source share
2 answers

Do you want the app to always be in landscape mode? Android or iOS?

There is a hardware mode that allows you to rotate your simulator. If you want to use application lock in the landscape, there is a way to use the node module. This link should help. https://www.npmjs.com/package/react-native-orientation

+4
source

Install: npm install reaction-native-orientation -save

in AppDelegate.m Add these two lines:

#import "../../node_modules/react-native-orientation/iOS/RCTOrientation/Orientation.h"

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return [Orientation getOrientation];
  }

componentDidMount(){


     Orientation.lockToLandscape();  


 }
0

Source: https://habr.com/ru/post/1607320/


All Articles