expo: After lock orientation view doesn't get rotated

🐛 Bug Report

  Expo CLI 2.18.4 environment info:
    System:
      OS: macOS 10.14.5
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.7.0 - ~/.nvm/versions/node/v10.7.0/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.1.0 - ~/.nvm/versions/node/v10.7.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      @types/expo: ^32.0.13 => 32.0.13 
      @types/react: ^16.8.20 => 16.8.20 
      @types/react-native: ^0.57.63 => 0.57.63 
      @types/react-navigation: ^3.0.7 => 3.0.7 
      expo: ^33.0.0 => 33.0.5 
      react: 16.8.3 => 16.8.3 
      react-native: https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz => 0.59.8 
      react-navigation: ^3.11.0 => 3.11.0 
    npmGlobalPackages:
      expo-cli: 2.18.4

iOS 11, latest Expo client. Android works ok.

When locking orientation to a different orientation than currently locked, screen doesn’t get rotated.

For example, when locked to landscape orientation I do

componentDidMount() {
  ScreenOrientation.lockAsync(OrientationLock.PORTRAIT);
}

My app is not get rotated. To see the app in the portrait mode, I need to rotate the phone to landscape and then back.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 19 (7 by maintainers)

Most upvoted comments

I experienced the same issue @vasyas … it isn’t the most correct fix, I know, but I was able to get it to lock to portrait up …

ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP)

I also needed to use lockPlatformAsync. I still get an error message for lockAsync:

ScreenOrientation.lockPlatformAsync({ screenOrientationArrayIOS: [ ScreenOrientation.Orientation.PORTRAIT_UP, ScreenOrientation.Orientation.LANDSCAPE_LEFT, ScreenOrientation.Orientation.LANDSCAPE_RIGHT, ], })

I’ve built an .ipa for testing our app with apple’s testflight and I can confirm it’s working as expected We can narrow down the issue to the Expo Client, as working with an older version of our project on the newest Expo client version is broken as well, that wasn’t the case before 😃