alexbrillant / react-native-deck-swiper

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

Why is renderCard not getting called even on changing the content of cards ? #271

Closed maknom66 closed 4 years ago

maknom66 commented 4 years ago

So, what i want is to increase the height and width of card when pressed, which requires rerender of the cards. However, I am unable to do it, even though i have tried to change the contents of cards which is suppose to call the renderCards. I am doing it inside onTapCard prop:

onTapCard={(index) => { newData = this.state.data newData.push({}) this.setState({ getDetails: !this.state.getDetails, data: newData }) }}

the state variable getDetails is what i using to know if a card was tapped

maknom66 commented 4 years ago

Oops, my bad, i thought i wasn't mutating, but i was, changed the code and now it's working

updated snippet onTapCard={(index) => { let data = [...this.state.data, {}] this.setState({ getDetails: !this.state.getDetails, data }) }}

safciplak commented 4 years ago

can you help me ? i didn't still add new cards

sathucandy commented 4 years ago

can you help me ? i didn't still add new cards

Were you able to fix issue of getting dynamic data