Skip to content

Commit

Permalink
Merge pull request #16 from b3ni/master
Browse files Browse the repository at this point in the history
update state initValue
  • Loading branch information
d-a-n authored Jul 5, 2016
2 parents 65facf8 + 56d34af commit d335c81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export default class ModalPicker extends BaseComponent {
this.setState({cancelText: this.props.cancelText});
}

componentWillReceiveProps(nextProps) {
if (nextProps.initValue != this.props.initValue) {
this.setState({selected: nextProps.initValue});
}
}

onChange(item) {
this.props.onChange(item);
this.setState({selected: item.label});
Expand Down

0 comments on commit d335c81

Please sign in to comment.