react-simple-pull-to-refresh
react-simple-pull-to-refresh copied to clipboard
Added check to see if element is only being dragged horizontaly
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:
After: