Skip to content

How does your Swipeable Component work? #2501

Answered by j-piasecki
AlexLup06 asked this question in Q&A
Discussion options

You must be logged in to vote

Each of those shifts is caused by the fact that setNativeProps is asynchronous, so by the time the props are actually updated and the scroll is stopped, it already moved a bit.

We do this by setting the activation offset on the gesture itself. This way, the gesture will not activate unless the finger is moved by the required distance on the horizontal axis and you can scroll freely. When you move the finger enough horizontally, the gesture activation cancels the scroll view it's nested in and since it happens synchronously on the native side, there's no flicker visible.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AlexLup06
Comment options

Answer selected by AlexLup06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants