simple example of orientation?

Can anyone share an example of how to use orientation?

I have looked at the docs but there is not a simple example there; and I have studied this snack. I was able to replicate this example in my App.tsx file but it locks the orientation so that when I change orientation it remains the same; But I don’t want to lock orientation.

I want to have orientation change when the user changes the orientation.

Expo CLI 4.0.17 environment info:
      OS: macOS 10.15.7
      Shell: 5.7.1 - /bin/zsh
      Node: 14.13.0 - /usr/local/bin/node
      Yarn: 1.22.5 - /usr/local/bin/yarn
      npm: 6.14.11 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
      CocoaPods: 1.9.3 - /usr/local/bin/pod
      iOS SDK:
        Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
      Android SDK:
        API Levels: 29
        Build Tools: 29.0.3, 30.0.0, 30.0.3
        System Images: android-R | Google Play Intel x86 Atom
      Android Studio: 4.1 AI-201.8743.12.41.6953283
      Xcode: 12.3/12C33 - /usr/bin/xcodebuild
      expo: ^40.0.0 => 40.0.0 
      react: 16.13.1 => 16.13.1 
      react-dom: 16.13.1 => 16.13.1 
      react-native: ^0.63.4 => 0.63.4 
      react-native-web: ~0.13.12 => 0.13.18 
      expo-cli: 4.0.17
    Expo Workflow: managed

can you explain what you are trying to do very specifically?

@notbrent thx for the reply.

I just want all screens on my app to go to landscape when user rotates device to landscape. And to return to portrait when user rotates to portrait. To be able to switch orientation when user rotates either way.

this is what I was looking for.

useEffect(() => {
  }, []);

  const lockOrientation = async () => {
    await ScreenOrientation.unlockAsync();

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