Categories
React Native Answers

How to prevent rotation of screen with React Native?

Spread the love

To prevent rotation of screen with React Native, we can use the orientation field in your app.json file if our app is built with Expo.

For example, we write

{
  "expo": {
    "name": "My app",
    "slug": "my-app",
    "sdkVersion": "21.0.0",
    "privacy": "public",
    "orientation": "portrait"
  }
}

to set the orientation to portrait.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *