mirror of
https://github.com/infeng/react-viewer.git
synced 2025-12-08 17:36:40 +00:00
fix: activeIndex error
This commit is contained in:
parent
288d70058b
commit
5a398477ee
@ -197,10 +197,12 @@ export default (props: ViewerProps) => {
|
||||
}, [state.visible]);
|
||||
|
||||
React.useEffect(() => {
|
||||
dispatch(createAction(ACTION_TYPES.setActiveIndex, {
|
||||
index: activeIndex,
|
||||
}));
|
||||
}, [activeIndex]);
|
||||
if (visible) {
|
||||
dispatch(createAction(ACTION_TYPES.setActiveIndex, {
|
||||
index: activeIndex,
|
||||
}));
|
||||
}
|
||||
}, [activeIndex, visible]);
|
||||
|
||||
function loadImg(currentActiveIndex, isReset = false) {
|
||||
dispatch(createAction(ACTION_TYPES.update, {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user