From 7469376eb4b637ec77efb24a35721fd6a0fdf16a Mon Sep 17 00:00:00 2001 From: Jimmy Schiaratura Date: Thu, 19 Apr 2018 14:55:32 +0200 Subject: [PATCH 1/2] Added duration props for bounceOnMount method --- README.md | 1 + src/index.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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/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())); }; From 83514e3a73981471c54d73098a94d2e3f6ef8862 Mon Sep 17 00:00:00 2001 From: Jimmy Schiaratura Date: Thu, 19 Apr 2018 16:02:32 +0200 Subject: [PATCH 2/2] Updated name & url --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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",