Skip to content

Commit

Permalink
fix: prevent animatedIndex from flickering caused by content resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Aug 5, 2021
1 parent cc5b829 commit 7fef5d0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,17 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
return Math.max(animatedCurrentIndex.value, currentIndex);
}

/**
* if the sheet is currently running an animation by snap point change - usually caused
* by dynamic content height -, then we return the next position index.
*/
if (
animatedAnimationSource.value === ANIMATION_SOURCE.SNAP_POINT_CHANGE &&
animatedAnimationState.value === ANIMATION_STATE.RUNNING
) {
return animatedNextPositionIndex.value;
}

return currentIndex;
}, [android_keyboardInputMode]);
//#endregion
Expand Down

0 comments on commit 7fef5d0

Please sign in to comment.