Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking Change: makeImageFromView API incompatibility between versions 1.90 and 1.10.1 #2902

Open
1 task
maneesh-techversant opened this issue Jan 16, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@maneesh-techversant
Copy link

Description

There's a breaking change in the API for capturing canvas snapshots between @shopify/react-native-skia versions 1.90 and 1.10.1. The makeImageFromView function used in v1.90 no longer works in v1.10.1, and needs to be replaced with viewRef.current.makeImageSnapshot().
This causes runtime errors for applications that upgrade from v1.90 to v1.10.1 without updating their code.
Current Behavior
In version 1.90:
const snapshot = await makeImageFromView(viewRef);
works correctly.
In version 1.10.1:
The above code throws the following error:
Error: Argument appears to not be a ReactComponent. Keys: makeImageSnapshot,makeImageSnapshotAsync,redraw,getNativeId

  • Must use viewRef.current.makeImageSnapshot() instead

React Native Skia Version

1.10.1

React Native Version

0.76.6

Using New Architecture

  • Enabled

Steps to Reproduce

Create a React Native project with @shopify/react-native-skia v1.90
Implement canvas snapshot functionality using makeImageFromView
Upgrade @shopify/react-native-skia to version 1.10.1
Try to capture canvas snapshot

Snack, Code Example, Screenshot, or Link to Repository

// Working in v1.90
import { makeImageFromView } from '@shopify/react-native-skia';
const getSignature = async () => {
const snapshot = await makeImageFromView(viewRef);
const imageData = snapshot.encodeToBase64();
};

// Required for v1.10.1
const getSignature = async () => {
const snapshot = await viewRef.current.makeImageSnapshot();
const imageData = snapshot.encodeToBase64();
};

@maneesh-techversant maneesh-techversant added the bug Something isn't working label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant