alexbrillant / react-native-deck-swiper

tinder like react-native deck swiper
ISC License
1.55k stars 462 forks source link

DragStart #273

Open dharmasat opened 4 years ago

dharmasat commented 4 years ago

while is used to drag the card , i need to know the direction means Left or Right

iashris commented 4 years ago

I have the same issue. Currently, the way I am doing this is to keep a local state variable rangeX and set it like

onSwiping = (rangeX, rangeY) => { if (this.state.rangeX * rangeX <= 0) { this.setState({rangeX}); } };

What this does is it updates the rangeX only when the direction changes but this causes my JS Framerate to drop significantly, so I feel setting state in onSwiping isn't viable. I wish there was a onSwipingRight and onSwipingLeft method that just get called once based on the direction.