react-simple-pull-to-refresh icon indicating copy to clipboard operation
react-simple-pull-to-refresh copied to clipboard

Added check to see if element is only being dragged horizontaly

Open shivankacker opened this issue 1 year ago • 0 comments

Why this PR?

For layouts where there are horizontal as well as vertical scrolls, the pull down to refresh does not working properly as it assumes I am pulling down when I just want to scroll horizontally.

What was the problem, technically?

The problem was that when you start touch from lets say [0,0] to [-30,-10] you will be dragging more to the left side than down and don't want to trigger the pull to refresh for that.

What did I implement?

I made sure that I trigger pull to refresh while dragging only when the distance dragged vertically is more than distance dragged horizontally.

Demo

Before: ezgif-1-9096e34c7c

After: ezgif-1-03700654bc

shivankacker avatar Mar 30 '23 10:03 shivankacker