mirror of
https://github.com/infeng/react-viewer.git
synced 2025-12-08 17:36:40 +00:00
fix change activeIndex prop not work
This commit is contained in:
parent
eab3a9566d
commit
a211ef778e
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user