Skip to content

Commit

Permalink
Update props fix
Browse files Browse the repository at this point in the history
Updating the data on the visible card, without restarting the deck
  • Loading branch information
lhandel committed Feb 28, 2018
1 parent f97abff commit 37d4253
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions CardStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ export default class CardStack extends Component {
componentWillReceiveProps(nextProps){
if (nextProps.children !== this.props.children) {
this.setState({
cards: nextProps.children,
cardA: nextProps.children[0],
cardB: nextProps.children[1],
});
cards: nextProps.children,
cardA: nextProps.children[(this.state.topCard=='cardA')? this.state.sindex-2 : this.state.sindex-1],
cardB: nextProps.children[(this.state.topCard=='cardB')? this.state.sindex-2 : this.state.sindex-1]
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-card-stack-swiper",
"version": "1.0.47",
"version": "1.0.5",
"description": "Tinder like react-native card stack swiper",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 37d4253

Please sign in to comment.