clauderic / clauderic/react-sortable-hoc

shouldCancelStart unexpectedly ignored

Open
#619 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

I have a long press on my sortable component and I don't want sorting to start after the long press. I set `shouldCancelStart` to `true` but it DOES start, event though I would expect it to not start.
Simplified example for the purpose of showing the bug:
```
this.setState({isSorting: true})}
distance={3}
onSortEnd={(sort) => this.onSortEnd(sort.oldIndex, sort.newIndex)}
shouldCancelStart={() => this.shouldCancelStart}
>
{this.props.views.map((view, index) => {
return (

setTimeout(() =>this.shouldCancelStart = true, 200)
>
{view.caption}


);
})}

```

Is this wrong usage?
If so how can I prevent the sort from starting?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the SortableContainer handling for shouldCancelStart and compare it with the onMouseDown and distance behavior in the simplified example. Reproduce the long-press sequence, determine why the callback is ignored, and confirm that sorting no longer starts when shouldCancelStart returns true.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.