Skip to content

Commit d335c81

Browse files
authored
Merge pull request d-a-n#16 from b3ni/master
update state initValue
2 parents 65facf8 + 56d34af commit d335c81

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ export default class ModalPicker extends BaseComponent {
7878
this.setState({cancelText: this.props.cancelText});
7979
}
8080

81+
componentWillReceiveProps(nextProps) {
82+
if (nextProps.initValue != this.props.initValue) {
83+
this.setState({selected: nextProps.initValue});
84+
}
85+
}
86+
8187
onChange(item) {
8288
this.props.onChange(item);
8389
this.setState({selected: item.label});

0 commit comments

Comments
 (0)