Skip to content

Commit 9179d49

Browse files
palgorhythmhannojg
authored andcommitted
Pass snap points to JS thread when update is received on UI thread
1 parent 97c885a commit 9179d49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/bottomSheet/BottomSheet.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,12 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
608608
);
609609
// biome-ignore lint/correctness/useExhaustiveDependencies(BottomSheet.name): used for debug only
610610
const handleOnAnimate = useCallback(
611-
function handleOnAnimate(targetIndex: number, source: ANIMATION_SOURCE) {
611+
function handleOnAnimate(targetIndex: number, source: ANIMATION_SOURCE, snapPoints: number[]) {
612612
const closedPosition = animatedClosedPosition.value;
613613
// TODO: added from https://github.com/gorhom/react-native-bottom-sheet/commit/d66fae48649970ef01fb5ce2cae6c1e29dfc8a99#diff-388335bd611fb6e4ec17932ace8ce123818f46f083886f6581b16fd52380ac42R633
614614
// is this still needed?
615615
const toIndex =
616-
targetIndex === closedPosition ? -1 : animatedSnapPoints.value.indexOf(targetIndex);
616+
targetIndex === closedPosition ? -1 : snapPoints.indexOf(targetIndex);
617617
if (__DEV__) {
618618
print({
619619
component: BottomSheet.name,
@@ -733,7 +733,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
733733
/**
734734
* fire `onAnimate` callback
735735
*/
736-
runOnJS(handleOnAnimate)(animatedNextPositionIndex.value, source);
736+
runOnJS(handleOnAnimate)(animatedNextPositionIndex.value, source, animatedSnapPoints.value);
737737

738738
/**
739739
* start animation

0 commit comments

Comments
 (0)