Do you have to manually rotate your app when orientation changes or does Expo handle it by default?

Viewed 1670

I have an Expo / React Native and I havn't done anything with orientation.

When I rotate a device the app doesn't rotate. Is this not handled by default or do I have a bug?

From the docs it seems you can set the orientation and respond to orientation change events: https://docs.expo.io/versions/latest/sdk/screen-orientation/

Do I have to manually set the orientation of the app when I detect the orientation has changed?

2 Answers

Turns out the orientation was set in the app.json. Removing this line makes it work as expected.

Alternatively, you can also set the orientation to default on your app.json instead of removing it, like this:

"orientation": "default"

Note: Make sure you restart your expo server/bundler (by pressing r on your terminal) and then close and reopen the Expo Go app on your simulator/real device to see the effect of these changes.

Related