From 42296db6dece66d25ee60aa075e9802f1db13e38 Mon Sep 17 00:00:00 2001 From: James Heaney <40678238+Jvheaney@users.noreply.github.com> Date: Thu, 27 Aug 2020 23:05:27 -0400 Subject: [PATCH 1/2] Added locked prop to the card Added a locked prop to the card to prevent card movement and swiping when set true. Pointer events are still passed to the card component. --- SwipeCards.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SwipeCards.js b/SwipeCards.js index fd8029f..d1cc5fb 100644 --- a/SwipeCards.js +++ b/SwipeCards.js @@ -158,6 +158,9 @@ export default class SwipeCards extends Component { this._panResponder = PanResponder.create({ onMoveShouldSetPanResponderCapture: (e, gestureState) => { + if(this.props.locked){ + return false; + } if (Math.abs(gestureState.dx) > 3 || Math.abs(gestureState.dy) > 3) { this.props.onDragStart(); return true; From b805722273eaeab4a8a28a7780ba7a4bd1306ef0 Mon Sep 17 00:00:00 2001 From: James Heaney <40678238+Jvheaney@users.noreply.github.com> Date: Thu, 27 Aug 2020 23:07:21 -0400 Subject: [PATCH 2/2] Updated to reflect changes Added the locked prop to the table of properties. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f197737..ca5b4d0 100644 --- a/README.md +++ b/README.md @@ -283,7 +283,7 @@ const styles = StyleSheet.create({ | stackOffsetY | Number | Vertical offset between cards in stack | 0 | | cardRemoved | Function | A callback passing the card reference that just got removed | | | onClickHandler | Function | A callback clicking the card | alert('tap') | - +| locked | Boolean | Disables swiping and card movement | `false` |