Skip to content

Commit

Permalink
fix: position on orientation change (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
kotielnikov authored Dec 3, 2020
1 parent d5ccbb1 commit f0d75ab
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,14 @@ const ModalizeBase = (
},
}));

const lastSnapRef = React.useRef(lastSnap);
React.useEffect(() => {
if (alwaysOpen && (modalHeightValue || adjustToContentHeight)) {
handleAnimateOpen(alwaysOpen);
lastSnapRef.current = lastSnap;
}, [lastSnap]);

React.useEffect(() => {
if (lastSnapRef.current || (alwaysOpen && (modalHeightValue || adjustToContentHeight))) {
handleAnimateOpen(alwaysOpen, lastSnapRef.current ? 'default' : undefined);
}
}, [alwaysOpen, modalHeightValue]);

Expand Down

0 comments on commit f0d75ab

Please sign in to comment.