Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNSAFE_componentWillMount and useNativeDriver #133

Open
Timmyy3000 opened this issue Nov 13, 2022 · 0 comments
Open

UNSAFE_componentWillMount and useNativeDriver #133

Timmyy3000 opened this issue Nov 13, 2022 · 0 comments

Comments

@Timmyy3000
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant