alexbrillant / react-native-deck-swiper

tinder like react-native deck swiper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Send prop to renderCard

uguzdev opened this issue · comments

Hello, I have a button in bottom the photo. Can I disabled the button when swipe enabled.

Example

          dragStart={() => setIsClickable(false)}
          dragEnd={() => setIsClickable(true)}
          renderCard={(card) => <UserCard clickable={isClickable} user={card} />}

in UserCard.js <TouchableOpacity disabled={!clickable} />

Unfortunately no, not unless you fork and edit the library itself. The cards do not re-render unless their content change, so even if your parent state changes (isClickable prop turns between true and false) the cards will not change, they won't get re-rendered so your button will preserve the original state.

Also, take into consideration that by adding more props that trigger re-renders of the cards, the performance of the swiper will degrade.

Please see here: #324