Lock device orientation - React Native (Android)

Provash Shoumma picture Provash Shoumma · Jul 27, 2016 · Viewed 10.9k times · Source

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?

Answer

Felipe Martim picture Felipe Martim · Jul 28, 2016

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