Skip to content

Commit 56d34af

Browse files
committed
update state initValue
1 parent 65facf8 commit 56d34af

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)