Closed alaycock closed 3 years ago
Hi :) Great catch 🥇
After "some time" ;) debugging I've found that if you swipe quite fast sometimes updatePosition
is called after dragEnd
event. That breaks state of trailingActionsOpened
and that is why dragStart
does not work anymore.
What we are missing here is cancelling animation frame on dragEnd
so that no more updatePosition
is called.
Will fix it in and make new release. Thanks again.
Thanks @marekrozmus! This didn't seem like the right fix, even if it achieved the correct result, so I'm glad you tracked this down. Looking forward to the latest version.
@all-contributors please add @alaycock for bug
@marekrozmus
I've put up a pull request to add @alaycock! :tada:
@alaycock - new version is published. Thanks again and enjoy 🎉
In cases where only "trailing" actions exist for an item, it appears that the item can be put into such a state that the trailing action cannot be closed. I have some trouble reproducing this state, since logging or using a debugger affects the timing of it, preventing the bug from occurring, but I attached a video of the issue occurring below. The bug first appears at 12 seconds.
When swiping right to close an item, it often still has the
dragDirection
value of 3 (left), since that is what was used to open the element, this is likely incorrect, but produces the correct result. In the case where the bug appears, thedragDirection
is changed to 5 (unknown), because it cannot be set to 4 (right), because noleadingActionsElement
exists. While this PR doesn't resolve the problem of thedragDirection
incorrectly being set to left, it allows the dragDirection to be right, even without a leading element, which allows the item to close the action.I'm not entirely sure what effect this has on all other use cases, so maybe you can provide some insight into why these conditions exist in the first place. If this isn't an appropriate fix, let me know if you have a better recommendation for a fix.
https://user-images.githubusercontent.com/894797/110275879-30c1f300-7f8f-11eb-8297-af3bbbc87462.mov