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

Fix double tap threshold #60

Open
wants to merge 1 commit 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 @@ -76,7 +76,7 @@ import SortableGrid from 'react-native-sortable-grid'

How long must the user hold the press on the block until it becomes active and can be dragged (milliseconds)

- ``` doubleTapTreshold ``` **Number**
- ``` doubleTapThreshold ``` **Number**

How long will the execution wait for the second tap before deciding it was a single tap (milliseconds).
Will be omitted if no onDoubleTap-property is given to the item being tapped - In which case single-tap callback will be executed instantly
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class SortableGrid extends Component {
this.activeBlockCenteringDuration = ACTIVE_BLOCK_CENTERING_DURATION
this.itemsPerRow = ITEMS_PER_ROW
this.dragActivationTreshold = DRAG_ACTIVATION_TRESHOLD
this.doubleTapTreshold = DOUBLETAP_TRESHOLD
this.doubleTapThreshold = DOUBLETAP_TRESHOLD
this.onDragRelease = NULL_FN
this.onDragStart = NULL_FN
this.onDeleteItem = NULL_FN
Expand Down Expand Up @@ -496,7 +496,7 @@ class SortableGrid extends Component {
this.tapTimer = setTimeout( () => {
this.doubleTapWait = false
onTap()
}, this.doubleTapTreshold)
}, this.doubleTapThreshold)
}

_onDoubleTap = (onDoubleTap) => {
Expand All @@ -508,7 +508,7 @@ class SortableGrid extends Component {

_resetTapIgnoreTime = () => {
clearTimeout(this.tapTimer)
this.tapTimer = setTimeout(() => this.tapIgnore = false, this.doubleTapTreshold)
this.tapTimer = setTimeout(() => this.tapIgnore = false, this.doubleTapThreshold)
}

createTouchHandlers = () =>
Expand Down