I have been facing a problem with React Native screen orentation. I am using expo and run my app through expo go on an Android device. According to the documentation:
Multiple screen orientations should work fine by default unless you're using Dimensions API and don't handle orientation changes. If you don't want to support multiple screen orientations, you can lock the screen orientation to either portrait or landscape.
The way I understand it is that the window should rotate automatically according to the device orientation by default. The problem is that screen orientation is locked to portrait mode even when I don't use Dimensions API or handle orientation changes with Dimensions.addEventListener
.
The only way I can get the landscape mode is changing the orientation
field in app.json
to:
"orientation": "landscape"
but then the orientation is locked to landscape which is not what I want. I have also tried creating a new expo project but the orientation is locked as well.
Thanks to user18309290 for their comment. The way to achieve automatic oreintation with expo is to set the orientation field to default in app.json:
"orientation" : "default"