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

Locked prop #142

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |



Expand Down
3 changes: 3 additions & 0 deletions SwipeCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down