You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The app crashes when trying to take a photo or use frame processors using the New Renderer Interop Layer.
Reproduceable Code
// react-native.config.jsmodule.exports={project: {android: {unstable_reactLegacyComponentNames: ["CameraView"]},ios: {unstable_reactLegacyComponentNames: ["CameraView"]}},};// expo app.config.jsexportdefault{// ...plugins: [["expo-build-properties",{ios: {newArchEnabled: true},android: {newArchEnabled: true}}],["react-native-vision-camera",{"cameraPermissionText": "$(PRODUCT_NAME) needs access to your Camera."}]]}exportdefaultfunctionCameraScreen(){constcamera=useRef<Camera>(null)const[isCameraInitialized,setIsCameraInitialized]=useState(false)constdevice=useCameraDevice('back')constframeProcessor=useFrameProcessor((frame)=>{'worklet'console.log(`Frame processed...`)},[])constonInitialized=useCallback(()=>{setIsCameraInitialized(true)},[])constonMediaCaptured=useCallback((media: PhotoFile|VideoFile,type: 'photo'|'video')=>{console.log(`Media captured! ${JSON.stringify(media)}`)},[])if(device==null)returnnull;return(<Viewstyle={styles.container}><Cameraref={camera}frameProcessor={frameProcessor}style={StyleSheet.absoluteFill}device={device}isActive={true}photo={true}enableZoomGesture={false}exposure={0}onInitialized={onInitialized}/><Viewstyle={styles.captureButton}><Buttontitle="Capture"disabled={!isCameraInitialized}onPress={async()=>{try{if(camera.current==null)thrownewError('Camera ref is null!')console.log('Taking photo...')constphoto=awaitcamera.current.takePhoto()onMediaCaptured(photo,'photo')}catch(e){console.error('Failed to take photo!',e)}}}/></View></View>);}conststyles=StyleSheet.create({container: {flex: 1,alignItems: 'center',justifyContent: 'center',},captureButton: {position: 'absolute',alignSelf: 'center',bottom: 30,},});
Relevant log output
# When using frame processors
com.facebook.react.uimanager.IllegalViewOperationException: Trying to resolve view with tag 116 which doesnt exist
at com.facebook.react.uimanager.NativeViewHierarchyManager.resolveView(NativeViewHierarchyManager.java:102)
at com.facebook.react.uimanager.UlManagerModule.resolveView(UlManagerModule.java:870)
at com.mrousavy.camera.frameprocessor.VisionCameraProxy.findCameraViewByld(VisionCameraProxy.kt:43)
at com.mrousavy.camera.frameprocessor.VisionCameraProxy.setFrameProcessor$lambda$0(VisionCameraProxy.kt:52)
at com.mrousavy.camera.frameprocessor.VisionCameraProxy.$r8$lambdaSILGATtBMqfunZ4A7y30ByA5WOoQ(Unknown Source:0)
at com.mrousavy.camera.frameprocessor.VisionCameraProxy$$ExternalSyntheticLambda0.run(Unknown Source:6)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:222)
at android.os.Looper.loop(Looper.java:314)
at android.app.ActivityThread.main(ActivityThread.java)
# When taking a photo
com.facebook.react.uimanager.IllegalViewOperationException: Trying to resolve view with tag 116 which doesnt exist
at com.facebook.react.uimanager.NativeViewHierarchyManager.resolveView(NativeViewHierarchyManag er.java:102)
at com.facebook.react.uimanager.UlManagerModule.resolveView(UlManagerModule.java:870)
at com.mrousavy.camera.CameraViewModule$findCameraView$2$1.run(CameraViewModule.kt:62)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessageHandler.java:99)
at android.os.Looper.loopOnce(Looper.java:222)
at android.os.Looper.loop(Looper.java:314)
at android.app.ActivityThread.main(ActivityThread.java:8592)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Runtimelnit$MethodAndArgsCaller.run(Runtimelnit.java:565)
at com.android.internal.os.Zygotelnit.main(Zygotelnit.java:1081)
privategethandle(): number {constnodeHandle=findNodeHandle(this.ref.current)if(nodeHandle==null||nodeHandle===-1){thrownewCameraRuntimeError('system/view-not-found',"Could not get the Camera's native view tag! Does the Camera View exist in the native view-tree?",)}returnnodeHandle}
Apparently the new Renderer interop layer doesn't have support for that yet, so I'd need to manually migrate that to Fabric/TurboModules.
What's happening?
The app crashes when trying to take a photo or use frame processors using the New Renderer Interop Layer.
Reproduceable Code
Relevant log output
Camera Device
Device
Xiaomi POCO X6 Pro
VisionCamera Version
3.9.0
Can you reproduce this issue in the VisionCamera Example app?
I didn't try (⚠️ your issue might get ignored & closed if you don't try this)
Additional information
The text was updated successfully, but these errors were encountered: