How can I set the screen orientation without locking it?

  1. SDK Version: 48.0.15
  2. Platforms(Android/iOS/web/all): Android / iOS

I would like to set the screen orientation to landscape without locking the orientation to landscape. I tried to use expo-screen-orientation to do this like so:

import * as ScreenOrientation from "expo-screen-orientation"

. …
await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT)

But then the user can’t rotate the device to get back to the portrait orientation which is not what I want. I just want the orientation to go to landscape and still allow the user to rotate the device back to portrait if they want to.

The YouTube app is a good example of this. If you go to a video on iOS and click the “fullscreen” icon it will go to landscape mode but allow you to rotate the device back to portrait mode. How can I achieve this behaviour?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.