oblador / react-native-pinchable

Instagram like pinch to zoom for React Native
MIT License
224 stars 23 forks source link

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

Open saheem128 opened 9 months ago

saheem128 commented 9 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 1 month ago

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

saheem128 commented 2 weeks ago

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

No!