3DJakob / react-tinder-card

A npm react module for making react elements swipeable like in the dating app tinder.
https://www.npmjs.com/package/react-tinder-card
MIT License
357 stars 110 forks source link

Updating preventSwipe prop after initial render does not take effect #30

Open benkaiser opened 3 years ago

benkaiser commented 3 years ago

Only the preventSwipe prop passed on initial render of a tinder card is taken into account. If you proceed to update the prop later with a new set of prevented directions, they will not take effect.

I'm not that great with hook components in React. I tried adding [preventSwipe] to the deps of the React.useLayoutEffect but it didn't seem to fix the behavior.

benkaiser commented 3 years ago

Fixed in this PR: https://github.com/3DJakob/react-tinder-card/pull/31

3DJakob commented 3 years ago

Great addition, good catch! I will take a look at your PR and merge it asap!

shubhurwt2001 commented 1 year ago

Hi, I'm still not able to fix this issue. Can someone help? I'm working with react-tinder-card 1.5.4