react-native-view-shot
react-native-view-shot copied to clipboard
Failed to snapshot view tag XXXX
@gorhom/[email protected]
│ ├─┬ @gorhom/[email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├─┬ @miblanchard/[email protected]
│ └── [email protected] deduped
├─┬ @notifee/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-async-storage/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-community/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-community/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-community/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-firebase/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-google-signin/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-menu/[email protected]
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ ├─┬ @react-navigation/[email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ └── [email protected] deduped
├─┬ @testing-library/[email protected]
│ └── [email protected] deduped
├─┬ @testing-library/[email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └─┬ @react-native/[email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
└─┬ [email protected]
└── [email protected] deduped
[email protected]
react-native-view-shot": "^3.8.0"
Platform: Android
Expected Behavior The captureScreen function in react-native-view-shot should capture an image of the screen and return the URI of the captured image.
Actual Behavior When calling captureScreen, the following error occurs: Failed to snapshot view tag 2730.
Steps to Reproduce the Behavior Install the latest version of react-native-view-shot. Set up and implement screen capture with captureScreen.
Run the app on Android with React Native version 0.76.1.
The error Failed to snapshot view tag 2730 appears when trying to capture the screen.
still same error for me also , in the version of [email protected](Bridgeless) also, in the version 0.74.5 (normal) it is worked fine iam also surfing for the solution from couple of days, the error is (NOBRIDGE) ERROR Error capturing view: [Error: Failed to snapshot view tag 872]
I got the same error, here's my log cat:
Failed to snapshot view tag xxxx
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.react.uimanager.UIManagerModule.addUIBlock(com.facebook.react.uimanager.UIBlock)' on a null object reference
at fr.greweb.reactnativeviewshot.RNViewShotModule.captureRef(RNViewShotModule.java:104)
at com.facebook.jni.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl.lambda$startNewBackgroundThread$2(MessageQueueThreadImpl.java:217)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)
at java.lang.Thread.run(Thread.java:1012)
Hello
Same error here with latest react-native.
What s the best RN version to use for this module ?
Thanks
@gre have an idear please ? this is the last step to finish my app and i fail on this , so frustrating lol
thanks
@gre have an idear please ? this is the last step to finish my app and i fail on this , so frustrating lol
thanks
I had to switch packages because it was urgent. I changed to @shopify/react-native-skia, snapshot.
@FernandoAOborges yeah i tried it yesterday but it returned "Textnodes are not yet supported", strange...
Hello
Same error here with latest react-native.
What s the best RN version to use for this module ?
Thanks
Iam currently using this in the RN version 0.74.5 in this version this is working fine as it suppose to! ,even i upgraded to next version of this this isn't working,iam also waiting for this fix to upgrade to RN latest no bridge architecture, everything is working except this package, hope this will be fixed soon!
I got the same error
Same error
Receive this error when switching to Expo 52
Same issue when I upgraded to Expo53
same issue.
Same issue: (NOBRIDGE) LOG [Error: Failed to snapshot view tag 36]
expo: 52.0.11 react-native: 0.76.3 react-native-view-shot: 4.0.2
Same here
Same error:Failed to snapshot view tag 36 iOS works well, but Android doesn't work as well.
same issue here on friday it was working with expo: "^51.0.38", react-native: "0.74.5" and react-native-view-shot: "^3.8.0" yesterday we updated to expo: "^52.0.0", react-native: "0.76.3", react-native-view-shot: "^4.0.2" and it stopped working on Android haven't been able to test on iOS yet
I have created a patch to fix this issue, see: https://github.com/gre/react-native-view-shot/issues/555
I am on react-native-view-shot: "^4.0.3" and "expo": "~52.0.9", and it works for me on Android (Samsung, Android 14) . There is no change between 4.0.2 and 4.0.3 on Android. So I wonder if it never works for you guys? Or at what use cases? What phone devices?
Same here
I am on
react-native-view-shot: "^4.0.3"and"expo": "~52.0.9",and it works for me on Android (Samsung, Android 14) . There is no change between 4.0.2 and 4.0.3 on Android. So I wonder if it never works for you guys? Or at what use cases? What phone devices?
Can you share your implementation? I am on react-native-view-shot: "^4.0.3" and "expo": "~52.0.31". It works great on iOS but I get this same error on Android.
Pretty basic:
function CaptureView() {
const viewShotRef = useRef<ViewShot | null>(null);
return (
<View style={{ flex: 1 }}>
<ViewShot
ref={viewShotRef}
options={props.imageOptions || DEFAULT_IMAGE_OPTIONS}
style={styles.flex}
>
<View
style={{
flex: 1,
backgroundColor: 'green',
justifyContent: 'center',
alignItems: 'center',
}}
>
<View style={{ width: 100, height: 100, backgroundColor: 'red' }} />
</View>
</ViewShot>
<Button
title="Capture"
onPress={() => {
viewShotRef.current
?.capture?.()
.then((uri) => {
console.log(uri);
})
.catch(console.error);
}}
/>
</View>
);
}
I have not run it on production build yet, but I see no mention it's just a production problem. You guys are using new arch, right?
@CptFabulouso Was able to get it working thanks! Seems to be fixed in this release now.
I've fixed this error, by removing "fileName" property from "options".
I fixed by wrapping my component with this
<ViewShot ref={viewShotRef} options={{ format: 'jpg', quality: 0.9 }}> and using
const imageURI = await viewShotRef.current.capture();
it worked for me after many days of debugging, i hope this will help someone
y
I got the same error, here's my log cat:
Failed to snapshot view tag xxxx java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.react.uimanager.UIManagerModule.addUIBlock(com.facebook.react.uimanager.UIBlock)' on a null object reference at fr.greweb.reactnativeviewshot.RNViewShotModule.captureRef(RNViewShotModule.java:104) at com.facebook.jni.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:959) at android.os.Handler.dispatchMessage(Handler.java:100) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at com.facebook.react.bridge.queue.MessageQueueThreadImpl.lambda$startNewBackgroundThread$2(MessageQueueThreadImpl.java:217) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0) at java.lang.Thread.run(Thread.java:1012)
I experienced the same as well! this fixed it for me. I had to manually apply the patch though. https://github.com/gre/react-native-view-shot/issues/555#issue-2792705792