Skip to content

Commit

Permalink
fix: onPositionChange not correct #209
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybarbet committed May 20, 2020
1 parent c163f0c commit d9d5aae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ const ModalizeBase = (

let toValue = 0;
let toPanValue = 0;
let newPosition;

if (dest === 'top') {
toValue = 0;
Expand All @@ -251,9 +252,9 @@ const ModalizeBase = (
setShowContent(true);

if ((alwaysOpenValue && dest !== 'top') || (snapPoint && dest === 'default')) {
setModalPosition('initial');
newPosition = 'initial';
} else {
setModalPosition('top');
newPosition = 'top';
}

Animated.parallel([
Expand Down Expand Up @@ -290,8 +291,10 @@ const ModalizeBase = (
onOpened();
}

setModalPosition(newPosition);

if (onPositionChange) {
onPositionChange(modalPosition);
onPositionChange(newPosition);
}
});
};
Expand Down

0 comments on commit d9d5aae

Please sign in to comment.