GuoChen-WHU / react-native-pinch-zoom-view

A pinch-to-zoom view for React Native.
103 stars 43 forks source link

Solve Invariant Violation error by switching to deprecated-react-native-prop-types version of ViewPropTypes #30

Open skaramicke opened 1 year ago

skaramicke commented 1 year ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-pinch-zoom-view@0.2.0 for the project I'm working on.

I was getting an Invariant Violation error.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-pinch-zoom-view/index.js b/node_modules/react-native-pinch-zoom-view/index.js
index da7d6c4..d98595c 100644
--- a/node_modules/react-native-pinch-zoom-view/index.js
+++ b/node_modules/react-native-pinch-zoom-view/index.js
@@ -1,6 +1,7 @@
 import React, { Component } from 'react';
 import PropTypes from 'prop-types';
-import { View, StyleSheet, PanResponder, ViewPropTypes } from 'react-native';
+import { View, StyleSheet, PanResponder } from 'react-native';
+import ViewPropTypes from 'deprecated-react-native-prop-types';

 // Fallback when RN version is < 0.44
 const viewPropTypes = ViewPropTypes || View.propTypes;

This issue body was partially generated by patch-package.