diff --git a/source/client/components/Card.js b/source/client/components/Card.js index 2969301..3b599d5 100644 --- a/source/client/components/Card.js +++ b/source/client/components/Card.js @@ -77,6 +77,7 @@ class Card extends Component { */ onCardChange(activeCardIndex) { this.setState({activeCardIndex}); + this.props.onCardSelected(activeCardIndex); } /** @@ -143,7 +144,8 @@ Card.propTypes = { isSingle: PropTypes.bool, isCardsEditable: PropTypes.bool, onClick: PropTypes.func, - onChangeBarMode: PropTypes.func + onChangeBarMode: PropTypes.func, + onCardSelected: PropTypes.func }; export default Card; diff --git a/source/client/components/Withdraw.js b/source/client/components/Withdraw.js index e4e2cfd..2991301 100644 --- a/source/client/components/Withdraw.js +++ b/source/client/components/Withdraw.js @@ -52,6 +52,12 @@ class Withdraw extends Component { }; } + componentWillReceiveProps(nextProps) { + this.setState({ + selectedCard: nextProps.inactiveCardsList[0] + }); + } + /** * Обработка изменения значения в input * @param {Event} event событие изменения значения input @@ -68,6 +74,12 @@ class Withdraw extends Component { }); } + onCardSelected(selectedCardIndex) { + this.setState({ + selectedCard: this.props.inactiveCardsList[selectedCardIndex] + }); + } + /** * Отправка формы * @param {Event} event событие отправки формы @@ -111,7 +123,14 @@ class Withdraw extends Component {