Evanss
Evanss

Reputation: 23213

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

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?

Upvotes: 8

Views: 4138

Answers (2)

Zeddrix Fabian
Zeddrix Fabian

Reputation: 2566

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.

Upvotes: 9

Evanss
Evanss

Reputation: 23213

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

Upvotes: 16

Related Questions