react-native-swipeable icon indicating copy to clipboard operation
react-native-swipeable copied to clipboard

UNSAFE_componentWillMount and useNativeDriver

Open Timmyy3000 opened this issue 2 years ago • 0 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-swipeable/lib/index.js b/node_modules/react-native-swipeable/lib/index.js
index 57996ad..6016756 100644
--- a/node_modules/react-native-swipeable/lib/index.js
+++ b/node_modules/react-native-swipeable/lib/index.js
@@ -78,7 +78,7 @@ var Swipeable = function (_PureComponent) {
     }, _this._unmounted = false, _this._handlePan = _reactNative.Animated.event([null, {
       dx: _this.state.pan.x,
       dy: _this.state.pan.y
-    }]), _this._handleMoveShouldSetPanResponder = function (event, gestureState) {
+    }], {useNativeDriver: true}), _this._handleMoveShouldSetPanResponder = function (event, gestureState) {
       return Math.abs(gestureState.dx) > _this.props.swipeStartMinDistance;
     }, _this._handlePanResponderStart = function (event, gestureState) {
       var _this$state = _this.state,
@@ -294,8 +294,8 @@ var Swipeable = function (_PureComponent) {
   }
 
   _createClass(Swipeable, [{
-    key: 'componentWillMount',
-    value: function componentWillMount() {
+    key: 'UNSAFE_componentWillMount',
+    value: function UNSAFE_componentWillMount() {
       var _props = this.props,
           onPanAnimatedValueRef = _props.onPanAnimatedValueRef,
           onRef = _props.onRef;
@@ -422,7 +422,8 @@ var Swipeable = function (_PureComponent) {
           toValue: {
             x: leftButtons.length * leftButtonWidth,
             y: 0
-          }
+          },
+          useNativeDriver: true
         }, leftButtonsOpenReleaseAnimationConfig);
       }
 
@@ -431,7 +432,8 @@ var Swipeable = function (_PureComponent) {
           toValue: {
             x: rightButtons.length * rightButtonWidth * -1,
             y: 0
-          }
+          },
+          useNativeDriver: true
         }, rightButtonsOpenReleaseAnimationConfig);
       }
 
@@ -671,7 +673,8 @@ Swipeable.defaultProps = {
   swipeReleaseAnimationConfig: {
     toValue: { x: 0, y: 0 },
     duration: 250,
-    easing: _reactNative.Easing.elastic(0.5)
+    easing: _reactNative.Easing.elastic(0.5),
+    useNativeDriver: true
   },
 
   // misc

This issue body was partially generated by patch-package.

Timmyy3000 avatar Nov 13 '22 03:11 Timmyy3000