margelo / margelo/react-native-vision-camera

🐛 (iOS) SkiaCamera canvas is unexpectedly rotated

Open
#4,153 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 bug
Dominant language
TypeScript
Stars
9.6k
Forks
1.4k
Avg merge
1d 28m
Merged PRs (30d)
4

Description

Prerequisites
Reproduction

https://github.com/matthew8sweeney/SkiaCamera-test-app

Steps to reproduce
  1. Clone https://github.com/matthew8sweeney/SkiaCamera-test-app
  2. Follow the steps in the README to run the app on iOS.
  3. Rotate the screen orientation to anything other than upright portrait.
  4. Initially, the SkiaCamera component will not be rendered. Press the "Toggle SkiaCamera" button to mount the SkiaCamera. On this very first mount, the rotation of the canvas displays as expected.
  5. Press the "Toggle SkiaCamera" button to unmount the SkiaCamera.
  6. Press the "Toggle SkiaCamera" button to mount the SkiaCamera for the 2nd time. This time and all subsequent times, the canvas is rotated.
What did you expect to happen?

Unmounting and re-mounting a SkiaCamera component should not change the rotation of its canvas.

What actually happened?

Unmounting and re-mounting a SkiaCamera component may change the rotation of its canvas.

Affected platforms

iOS (device)

Device(s) affected

iPhone 12 (iOS 26.5.2), iPad Pro (11-inch) (3rd generation) (iPadOS 26.5.2)

VisionCamera version

5.2.2

React Native version

0.86.2

React Native architecture

New Architecture (Fabric / bridgeless)

Features being used
  • Preview
  • Photo capture
  • Video capture
  • Frame Processors (worklets)
  • Skia Frame Processors
  • Code/Barcode Scanner
  • Location metadata
  • Multi-cam
  • Depth data
  • HDR / custom dynamic range
  • Custom format / FPS / resolution
Relevant logs / stack trace
N/A
Additional context

Here's an example of what I expect the SkiaCamera to show in landscape orientation with the top of the device to the left:
Image

Here's what it looks like when this issue occurs:
Image

Over all the times I've ever inspected the Frame.orientation property, I've noticed it has the value "left" when the screen orientation is upright portrait, and the other three values correspond to the other three screen orientations. I'm not sure whether that's always supposed to be the case, but I noticed that when this issue happens it has a value of "left" even though I expected a different value due to having a different screen orientation.

Submission
  • The reproduction I linked is either (preferred) a PR against this repo that adds a failing harness test following the harness-tests README, or (fallback) a public repo that reproduces the bug on a fresh clone. I understand the issue will be closed without one.
  • I pasted logs as text (not screenshots).
  • I wrote this report in my own words. I did not paste AI-generated descriptions of the bug.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked SkiaCamera-test-app and follow its README to reproduce the issue on iOS. Compare the canvas rotation and Frame.orientation across the first mount and subsequent unmount/remount cycles. Done means remounting SkiaCamera preserves the expected canvas rotation in every supported screen orientation.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, typescript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.