oblador / react-native-pinchable

Instagram like pinch to zoom for React Native
MIT License
229 stars 26 forks source link

[Android]: Replace deprecated drawing cache with Canvas #20

Open saheem128 opened 11 months ago

saheem128 commented 11 months ago

What's in here: This commit modifies the startGesture method in the PinchableView class to use a Canvas for creating a bitmap snapshot of the view. The previous implementation used the now-deprecated drawing cache, which could lead to compatibility and performance issues, especially in newer Android versions.

My motivation: Whenever I pinch an image and then change the image dynamically, it would return the old image on the next pinch geasture. Now, that could be solved by simply writing v.invalidate() in the startGesture method to kind of make it redraw the view, but doing it in Canvas already solved my issue.

s

frodriguez-hu commented 3 months ago

Were you able to zoom the image from the pivot point instead of the center using Canvas?

saheem128 commented 2 months ago

Were you able to zoom the image from the pivot point instead of the center using Canvas?

No!