Skip to content

Instantly share code, notes, and snippets.

@Dung1128
Created June 3, 2021 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dung1128/be41d012ff84d7cdef3fb718fbe8b8db to your computer and use it in GitHub Desktop.
Save Dung1128/be41d012ff84d7cdef3fb718fbe8b8db to your computer and use it in GitHub Desktop.
Fix Animated warning when using react-native-swipeable
diff --git a/node_modules/react-native-swipeable/lib/index.js b/node_modules/react-native-swipeable/lib/index.js
index 57996ad..634b136 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: false}), _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: 'componentDidMount',
+ value: function componentDidMount() {
var _props = this.props,
onPanAnimatedValueRef = _props.onPanAnimatedValueRef,
onRef = _props.onRef;
@@ -671,7 +671,8 @@ Swipeable.defaultProps = {
swipeReleaseAnimationConfig: {
toValue: { x: 0, y: 0 },
duration: 250,
- easing: _reactNative.Easing.elastic(0.5)
+ easing: _reactNative.Easing.elastic(0.5),
+ useNativeDriver: false
},
// misc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment