Skip to content

fix: Update iOS preview rotation by using RotationCoordinator - #4237

Open
Jakef14 wants to merge 1 commit into
margelo:mainfrom
Jakef14:fix/ios-preview-rotation-coordinator
Open

Jakef14 wants to merge 1 commit into
margelo:mainfrom
Jakef14:fix/ios-preview-rotation-coordinator

Conversation

@Jakef14

@Jakef14 Jakef14 commented Oct 28, 2026

Copy link
Copy Markdown

On iOS 17+, the preview's rotation now comes from AVCaptureDevice.RotationCoordinator (videoRotationAngleForHorizonLevelPreview) instead of the interface orientation. The interface orientation is 90° off on displays that aren't aligned with the camera, like the iPhone Duo's inner display, so the preview showed up rotated. Below iOS 17 it still uses HybridInterfaceOrientationManager.

Fixes #4236

@vercel

vercel Bot commented Oct 28, 2026

Copy link
Copy Markdown

@JakeF14-SN is attempting to deploy a commit to the Margelo Team on Vercel.

A member of the Team first needs to authorize it.

@ismaelsousa

Copy link
Copy Markdown
Contributor

@Jakef14, this is perfectly aligned with my PR #4224 where I expose that rotation

@ismaelsousa

Copy link
Copy Markdown
Contributor

we also should start to use the RotationCoordinator to every output out there

@Jakef14

Jakef14 commented Oct 28, 2026

Copy link
Copy Markdown
Author

@ismaelsousa Amazing! I didnt see that PR before putting up my issue and pr, please feel free to close this one. Great to see that it was already being handled! I am happy to provide some physical device test coverage if you dont have an iPhone Duo (the device I was having issues with)

@ismaelsousa

Copy link
Copy Markdown
Contributor

@Jakef14, actually, this PR is exactly the next step of mine, we can combine both

@Jakef14

Jakef14 commented Oct 28, 2026

Copy link
Copy Markdown
Author

Great I will leave this PR up then! Let me know if anything is needed

ismaelsousa added a commit to ismaelsousa/react-native-vision-camera that referenced this pull request Oct 28, 2026
Use AVCaptureDevice.RotationCoordinator on iOS 17 and later, creating the interface orientation manager only on older versions. Apply preview rotation updates synchronously and clean up observation on reconfiguration and deinit.

Related PR: margelo#4237

Validation: VisionCamera iOS target build, Swift formatting, and git diff --check passed.
@ismaelsousa

ismaelsousa commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

@Jakef14 just ported the rotation coordinator into my branch and also removing on the unmount of the component.
See ismaelsousa@11283c1

ismaelsousa added a commit to ismaelsousa/react-native-vision-camera that referenced this pull request Oct 29, 2026
Use AVCaptureDevice.RotationCoordinator on iOS 17 and later, creating the interface orientation manager only on older versions. Apply preview rotation updates synchronously and clean up observation on reconfiguration and deinit.

Related PR: margelo#4237

Validation: VisionCamera iOS target build, Swift formatting, and git diff --check passed.
@ismaelsousa

Copy link
Copy Markdown
Contributor

@Jakef14

Jakef14 commented Nov 4, 2026

Copy link
Copy Markdown
Author

@ismaelsousa I like that the preview updates are a module, however I feel the actual preview rotation should not come with a secondary module but should instead be a part of the base library

@ismaelsousa

Copy link
Copy Markdown
Contributor

@Jakef14 Oh, definitely, it's just a quick step while we are waiting for the fix that will come soon. The whole orientation needs to change, so probably the fix will come in the next iteration of the library. Meanwhile, we can extend it :)

@Jakef14
Jakef14 force-pushed the fix/ios-preview-rotation-coordinator branch from fb47f2d to b102859 Compare November 11, 2026 11:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [iPhone Duo] Cameras are rotated 90° clockwise when using the camera on the inner display

3 participants