expo: Expo Camera - Incorrect orientation of captured photo if device orientation is locked
Summary
When capturing a photo via the Expo Camera component, if the device is orientation locked in Portrait for example, and you then rotate to Landscape, the resulting photo is captured in Portrait. The iOS camera app and native SDK will ignore the system portrait lock setting when capturing photos.
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
44.0.0
Environment
expo-env-info 1.0.2 environment info: System: OS: macOS 12.2.1 Shell: 5.8 - /bin/zsh Binaries: Node: 17.4.0 - /usr/local/bin/node Yarn: 1.22.11 - /usr/local/bin/yarn npm: 8.3.1 - /usr/local/bin/npm Watchman: 2022.01.31.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /Users/nick/.rvm/gems/ruby-3.0.0/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7678000 Xcode: 13.3/13E113 - /usr/bin/xcodebuild npmPackages: @expo/webpack-config: ~0.16.2 => 0.16.16 expo: ^44.0.0 => 44.0.5 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: eas-cli: 0.39.0 expo-cli: 5.0.3 Expo Workflow: managed
Reproducible demo
Embed this component into any view and then enable rotation lock on your device, then take a photo.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16
I was able to fix this on iOS with the
expo-image-manipulator. It’s a little hacky but it works.Hi there! It looks like your issue requires a minimal reproducible example, but it is invalid or absent. Please prepare such an example and share it in a new issue.
The best way to get attention to your issue is to provide a clean and easy way for a developer to reproduce the issue on their own machine. Please do not provide your entire project, or a project with more code than is necessary to reproduce the issue.
A side benefit of going through the process of narrowing down the minimal amount of code needed to reproduce the issue is that you may get lucky and discover that the bug is due to a mistake in your application code that you can quickly fix on your own.
Resources
Common concerns
“I’ve only been able to reproduce it in private, proprietary code”
You may not have spent enough time narrowing down the root cause of the issue. Try out the techniques discussed in this manual debugging guide to learn how to isolate the problem from the rest of your codebase.
“I didn’t have time to create one”
That’s understandable, it can take some time to prepare. We ask that you hold off on filing an issue until you are able to fully complete the required fields in the issue template.
“You can reproduce it by yourself by creating a project and following these steps”
This is useful knowledge, but it’s still valuable to have the resulting project that is produced from running the steps, where you have verified you can reproduce the issue.
@yohamta Nothing I’ve seen. I’m thinking of making a Flutter app instead and hoping that doesn’t have the same problem
We ended up switching to React Native Camera. It is old and deprecated, but works. You could look at React Native Vision Camera.
Here’s my workaround, it’s been working so far for me whether the phone’s orientation itself was locked or not.
Then if
orientationis3or4(landscape) I rotate the image withexpo-image-manipulatorby 180 degrees.I guess the workaround is to detect if Orientation is locked (using ScreenOrientation.getOrientationLockAsync() ), and notify the user to unlock? Not a good user experience, so I really hope the expo Camera team will fix this soon.