diff --git a/README.md b/README.md index e99923e..9bdfeeb 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ function MyListItem() { | `onRef` | function | `null` | (optional) receive swipeable component instance reference | | `onPanAnimatedValueRef` | function | `null` | (optional) receive swipeable pan `Animated.ValueXY` reference for upstream animations | | `bounceOnMount` | boolean | `false` | (optional) To alert the user that swiping is possible | +| `bounceOnMountDuration` | integer | 250 | (optional) Duration of the `bounceOnMount` animation | | `disable` | boolean | `false` | (optional) Disable swiping | ### Advanced Props diff --git a/package.json b/package.json index 701a6fe..2c748b0 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "react-native-swipeable-row", + "name": "react-native-swipeable-row-bouncing", "version": "0.8.1", "description": "A powerful React Native swipe component based on @jshanson7 package", "main": "lib/index.js", @@ -28,7 +28,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Cederman/react-native-swipeable" + "url": "git+https://github.com/Clonescody/react-native-swipeable-row-bouncing" }, "keywords": [ "react", diff --git a/src/index.js b/src/index.js index 244bf99..6764777 100644 --- a/src/index.js +++ b/src/index.js @@ -77,6 +77,7 @@ export default class Swipeable extends PureComponent { swipeStartMinLeftEdgeClearance: PropTypes.number, swipeStartMinRightEdgeClearance: PropTypes.number, disable: PropTypes.bool, + bounceOnMountDuration: PropTypes.number, // styles style: ViewPropTypes.style, @@ -158,6 +159,7 @@ export default class Swipeable extends PureComponent { swipeStartMinLeftEdgeClearance: 0, swipeStartMinRightEdgeClearance: 0, bounceOnMount: false, + bounceOnMountDuration: 250, disable: false, }; @@ -246,10 +248,10 @@ export default class Swipeable extends PureComponent { const {pan} = this.state; pan.flattenOffset(); - const {swipeReleaseAnimationFn, swipeReleaseAnimationConfig} = this.props; + const {swipeReleaseAnimationFn, swipeReleaseAnimationConfig, bounceOnMountDuration} = this.props; Animated.timing(pan, { toValue, - duration: 250, + duration: bounceOnMountDuration, easing: Easing.elastic(0.5) }).start(() => this.recenter(swipeReleaseAnimationFn, swipeReleaseAnimationConfig, () => onDone && onDone())); };