You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a drawer view, in one of the screens there is a Pager View like horizontally paged component I made using PanGestureHandler. I did this because I want to be able to open the drawer if I'm on the first page and I started swiping to the right (the swipe edge for my drawer is full width of the device). But if I'm not at the first page of my Pager View like component, drawer shouldn't open.
So in summary I need my PanGestureHandler to do this: If an animated value translationX is at 0, then the minVelocityX of the PanGestureHandler should be -1. If translationX is smaller than 0, then minVelocityX of the PanGestureHandler should be undefined.
Here is how the setup looks like.
This seems like a pretty common setup to me, but I couldn't find anything other than runOnJS and setting state on the fly to change the minVelocityX achieve it, which feels wrong. I don't understand the reason for this to not be able to happen on the UI thread (maybe a SharedValue for minVelocityX, idk).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a drawer view, in one of the screens there is a Pager View like horizontally paged component I made using PanGestureHandler. I did this because I want to be able to open the drawer if I'm on the first page and I started swiping to the right (the swipe edge for my drawer is full width of the device). But if I'm not at the first page of my Pager View like component, drawer shouldn't open.
So in summary I need my PanGestureHandler to do this: If an animated value
translationX
is at 0, then theminVelocityX
of the PanGestureHandler should be-1
. IftranslationX
is smaller than 0, thenminVelocityX
of the PanGestureHandler should be undefined.Here is how the setup looks like.
This seems like a pretty common setup to me, but I couldn't find anything other than
runOnJS
and setting state on the fly to change theminVelocityX
achieve it, which feels wrong. I don't understand the reason for this to not be able to happen on the UI thread (maybe aSharedValue
forminVelocityX
, idk).Beta Was this translation helpful? Give feedback.
All reactions