expo: [expo-camera/next][ios] crash with `facing="front"` & `useRef`
Minimal reproducible example
https://github.com/younes0/expo-camera-front-ios-crash
What platform(s) does this occur on?
iOS
Did you reproduce this issue in a development build?
Yes
Summary
happens with expo-camera since version 14.0.5.
export default function App() {
const cameraRef = React.useRef();
return (
<CameraView
facing="front"
ref={cameraRef}
style={StyleSheet.absoluteFill}
/>
);
}
will result in a crash on ios.
removing facing="front" or ref={cameraRef} prevents the crash.
on my project, sentry would report:
"opacity > setAlpha: > Attempted to dereference garbage pointer at 0x10."
Environment
expo-env-info 1.2.0 environment info: System: OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish) Shell: 3.3.1 - /usr/bin/fish Binaries: Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node Yarn: 1.22.19 - /mnt/c/Users/youne/AppData/Roaming/npm/yarn npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm npmPackages: expo: ~50.0.8 => 50.0.8 react: 18.2.0 => 18.2.0 react-native: 0.73.4 => 0.73.4 Expo Workflow: managed
Expo Doctor Diagnostics
✔ Check Expo config for common issues ✔ Check package.json for common issues ✔ Check dependencies for packages that should not be installed directly ✔ Check for common project setup issues ✔ Check for issues with metro config ✔ Check npm/ yarn versions ✔ Check that packages match versions required by installed Expo SDK ✔ Check Expo config (app.json/ app.config.js) schema ✔ Check for legacy global CLI installed locally ✔ Check that native modules do not use incompatible support packages ✔ Check that native modules use compatible support package versions for installed Expo SDK
Didn’t find any issues with the project!
About this issue
- Original URL
- State: closed
- Created 4 months ago
- Reactions: 1
- Comments: 24
Hi everyone, this was a regression in 14.1.2. 14.1.3 will be released later today. Sorry for the inconvenience
still not working for me on ios, with expo-camera 14.1.2, not matter if my dev-client is presenting or not, when I try to open the screen where my camera is, it just crashes
Will the release include the fix for the android crash that has been merge (but apparently not package released) https://github.com/expo/expo/pull/27126 ?
I’ve updated the repo to showcase the crash: https://github.com/younes0/expo-camera-front-ios-crash
@sergeushenecz @toni1703 14.1.2 introduced this crash indeed. Would it be possible to check the XCode logs to help @alanjhughes ? I will but not before tomorrow.
I 've reverted to 14.1.1 and all works
@olivermihaly same issue hare.
@alanjhughes it’s fixed now, thanks! I used
patch-packageand built a new dev client.For me it reproduces everytime, it happens in release production builds also so im not sure how the dev menu would be the cause there.
For my situation I can get around this problem by only switching to the front facing camera after the ‘onCameraReady’ event in fired.
Confirm I have the exact same behaviour, im currently on 14.0.5.
My crash refers to onAppForegrounded() as the parent function.
I presume when using the forward facing camera, the barcode scanner is unavailable resulting in a blocking function call and that asynchronous function is taking the full 0.5 seconds before releasing and commiting the configuration?
Perhaps the function should check if its initiated in ‘front’ orientation and run the old version of the code instead.
Hi @alanjhughes - crash remains with a new dev client using yarn and latest version 14.0.6 Note that crash will only happen on launch. If you comment
facingorrefbefore and uncomment after launch, it won’t crash.I get the same error whenever the
facingprop is set. Removing it seems to solve the issue.Probably related to this commit https://github.com/expo/expo/commit/b8d9a92a5f69429ee7bfffe98a930255856f6206