Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lock device orientation - React Native (Android)

I'm using React Native 0.29 and developing for Android. I'm trying to lock the device orientation. What I need is to lock the screen in portrait mode. I tried with this repository https://github.com/yamill/react-native-orientation but it is not supporting RN 0.29 yet.

Is there any way I can lock the device orientation? Maybe any native Android hack with android studio?

like image 490
Provash Shoumma Avatar asked Jul 27 '16 20:07

Provash Shoumma


People also ask

How does react native determine orientation?

In XCode you need to go to target and then in the Deployment Info -> Device Orientation enable the orientaitons your app should support. For android you'll have to modify your AndroidManifest file and set the screenOrientation on the activity tag.

How do I use splash screen in react native?

Manually set a blank, single-color splash screen background on the native side. On iOS, set the background color of the React Native root view to that same color. As soon as React Native loads, add a View with the same color in React Native and fade in the app logo on it. Once the app loads, fade out the splash screen.


1 Answers

Just add android:screenOrientation="portrait" to the activity in the AndroidManifest.xml.

like image 114
Felipe Martim Avatar answered Oct 12 '22 15:10

Felipe Martim