Skip to content

Add 'swipeEnabled' prop#47

Open
dioseltorre wants to merge 2 commits into
glepur:masterfrom
dioseltorre:master
Open

Add 'swipeEnabled' prop#47
dioseltorre wants to merge 2 commits into
glepur:masterfrom
dioseltorre:master

Conversation

@dioseltorre

Copy link
Copy Markdown

When false, the view cannot be swiped. The default value is true.

Summary:
When false, the view cannot be swiped. The default value is true.
@JeffGuKang

JeffGuKang commented Oct 27, 2019

Copy link
Copy Markdown
Collaborator

Thank you for PR.

How about use this.props.swipeEnabled with defaultProps without componentDidUpdate?

Component.defaultProps = {
  swipeEnabled: true,
}

Summary:
When false, the view cannot be swiped. The default value is true.

@JeffGuKang JeffGuKang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. :)
It will be merged after some test.

@viktor992

Copy link
Copy Markdown

Any updates on this?

@dioseltorre

Copy link
Copy Markdown
Author

@JeffGuKang When do you plan to merge this?

@JeffGuKang

Copy link
Copy Markdown
Collaborator

@dioseltorre Sorry for late reply. I will manage this until this week.

@JeffGuKang JeffGuKang self-requested a review December 30, 2019 04:31
Comment thread index.js

_handleShouldSetPanResponder(evt, gestureState) {
return (
this.props.swipeEnabled &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than setting a defaultProp value below, you could simply check if swipeEnabled is not false:
this.props.swipeEnabled !== false

Comment thread index.js
}
}

GestureRecognizer.defaultProps = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then you can get rid of this....

@Desintegrator

Copy link
Copy Markdown

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants