expo-screen-orientation throws error
See original GitHub issue🐛 Bug Report
Summary of Issue (just a few sentences)
When executing ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.ALL)
or any other ScreenOrientation.OrientationLock
on iOS or Android the following error is thrown:
“The method or property ScreenOrientation.lockAsync is not available on ios, are you sure you’ve linked all the native dependencies properly?”
Environment - output of expo diagnostics
& the platform(s) you’re targeting
Expo CLI 3.21.5 environment info: System: OS: macOS 10.15.5 Shell: 3.2.57 - /bin/bash Binaries: Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node Yarn: 1.16.0 - /usr/local/bin/yarn npm: 6.9.0 - ~/.nvm/versions/node/v12.6.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman IDEs: Android Studio: 3.6 AI-192.7142.36.36.6241897 Xcode: 11.5/11E608c - /usr/bin/xcodebuild npmPackages: expo: ~37.0.12 => 37.0.12 react: ~16.13.1 => 16.13.1 react-dom: ~16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz => 0.61.4 react-native-web: ~0.12.2 => 0.12.2 npmGlobalPackages: expo-cli: 3.21.5
Steps to Reproduce
useEffect(() => {
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.ALL)
})
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Hi @byCedric! The missing dependency array was a sloppy mistake, but that does not cause the issue for me since the error still occurs even after changing it to:
I will have to see if I can produce this in a minimal project since this is now part of a pretty big Expo managed project and the error might be happening in combination with something else.
This all seems to have related to an outdated dependency to react-native, I was running version
0.37
and when updating to0.38
this all just worked.