fix change activeIndex prop not work

This commit is contained in:
infeng 2016-10-19 10:36:27 +08:00
parent eab3a9566d
commit a211ef778e

View File

@ -173,12 +173,9 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
}
componentWillReceiveProps(nextProps: ViewerProps) {
if (this.state.activeIndex !== nextProps.activeIndex) {
if (this.state.activeIndex !== nextProps.activeIndex || (!this.props.visible && nextProps.visible)) {
this.loadImg(nextProps.activeIndex);
}
if (!this.props.visible && nextProps.visible) {
this.loadImg(this.props.activeIndex);
}
}
render() {