Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Latest commit

 

History

History
32 lines (19 loc) · 899 Bytes

lock-device-orientation.mo.md

File metadata and controls

32 lines (19 loc) · 899 Bytes

[MO] Lock the device screen

Prerequisites

  • A running React Native app, preferably started with the generator

Steps

  • Follow this to install react-native-orientation

⚠️ Do not forget to rebuild your app

Lock all the app pages

⚠️ Do not lock the screen rotation on react-native-camera or other native modules which needs screen rotation

We need to lock all the app pages, to do so import react-native-orientation in our top component:

import Orientation from 'react-native-orientation

Add those lines to lock the orientation:

componentWillMount () {
  Orientation.lockToPortrait()
}
  • Refresh your app, and try to rotate your screen

  • Star the repo if it works ;)