antonKalinin / react-native-image-view

Modal component to view images with zoom
https://expo.io/@antonkalinin/react-native-image-view
MIT License
323 stars 102 forks source link

added support for new reanimated version #95

Open jailsonpaca opened 1 year ago

jailsonpaca commented 1 year ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch react-native-image-view@2.1.9 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-image-view/src/ImageView.js b/node_modules/react-native-image-view/src/ImageView.js
index f0c1992..5f69756 100644
--- a/node_modules/react-native-image-view/src/ImageView.js
+++ b/node_modules/react-native-image-view/src/ImageView.js
@@ -204,13 +204,14 @@ export default class ImageView extends Component<PropsType, StateType> {
                 Animated.timing(this.modalAnimation, {
                     duration: 400,
                     toValue: 1,
+                    useNativeDriver: false,
                 }).start();
             }
         }
     }

     componentWillUnmount() {
-        Dimensions.removeEventListener('change', this.onChangeDimension);
+        Dimensions.removeEventListener?.('change', this.onChangeDimension);

         if (this.glideAlwaysTimer) {
             clearTimeout(this.glideAlwaysTimer);
@@ -436,6 +437,7 @@ export default class ImageView extends Component<PropsType, StateType> {
                 Animated.timing(this.imageScaleValue, {
                     toValue: scale,
                     duration: 300,
+                    useNativeDriver: false,
                 }).start();

                 this.togglePanels(scale === imageInitialScale);
@@ -459,15 +461,18 @@ export default class ImageView extends Component<PropsType, StateType> {
                     ? Animated.timing(this.modalBackgroundOpacity, {
                           toValue: 0,
                           duration: 100,
+                          useNativeDriver: false,
                       })
                     : null,
                 Animated.timing(this.imageTranslateValue.x, {
                     toValue: x,
                     duration: 100,
+                    useNativeDriver: false,
                 }),
                 Animated.timing(this.imageTranslateValue.y, {
                     toValue: y,
                     duration: 100,
+                    useNativeDriver: false,
                 }),
             ].filter(Boolean)
         ).start();
@@ -481,6 +486,7 @@ export default class ImageView extends Component<PropsType, StateType> {
             Animated.timing(this.imageTranslateValue.y, {
                 toValue: y + 400 * vy,
                 duration: 150,
+                useNativeDriver: false,
             }).start(this.close);
         }

This issue body was partially generated by patch-package.

aureosouza commented 1 year ago

We had to do patch as well, any updates on this?