Skip to content

Commit

Permalink
fix: provide dynamic initial snap points while layout is calculating (#…
Browse files Browse the repository at this point in the history
…584)

* Allow usage of index when using dynamic snap points

Because the number of snap points is different on the initial frame with the number when the size is known, the bottom sheet could not be used with an index value. To avoid this issue we fill the snap points array with INITIAL_SNAP_POINT.

* refactor: removed unused parameter on initialSnapPoints map

Co-authored-by: Mo Gorhom <gorhom@me.com>
  • Loading branch information
Ferossgp and gorhom committed Aug 17, 2021
1 parent 991d214 commit 98fb8d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/useBottomSheetDynamicSnapPoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useBottomSheetDynamicSnapPoints = (
animatedHandleHeight.value === INITIAL_HANDLE_HEIGHT ||
animatedContentHeight.value === 0
) {
return [INITIAL_SNAP_POINT];
return initialSnapPoints.map(() => INITIAL_SNAP_POINT);
}
const contentWithHandleHeight =
animatedContentHeight.value + animatedHandleHeight.value;
Expand Down

0 comments on commit 98fb8d2

Please sign in to comment.