Skip to content

Commit

Permalink
Add initialPosition prop
Browse files Browse the repository at this point in the history
  • Loading branch information
huderlem authored and yayvery committed Feb 24, 2024
1 parent c3dff6e commit 7e2b0b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
// configurations
index: _providedIndex = 0,
snapPoints: _providedSnapPoints,
initialPosition = INITIAL_POSITION,
animateOnMount = DEFAULT_ANIMATE_ON_MOUNT,
enableContentPanningGesture = DEFAULT_ENABLE_CONTENT_PANNING_GESTURE,
enableHandlePanningGesture = DEFAULT_ENABLE_HANDLE_PANNING_GESTURE,
Expand Down Expand Up @@ -225,7 +226,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
const animatedCurrentIndex = useReactiveSharedValue(
animateOnMount ? -1 : _providedIndex
);
const animatedPosition = useSharedValue(INITIAL_POSITION);
const animatedPosition = useSharedValue(initialPosition);
const animatedNextPosition = useSharedValue(INITIAL_VALUE);
const animatedNextPositionIndex = useSharedValue(0);

Expand Down
6 changes: 6 additions & 0 deletions src/components/bottomSheet/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export interface BottomSheetProps
| Array<string | number>
| SharedValue<Array<string | number>>
| Readonly<(string | number)[] | SharedValue<(string | number)[]>>;
/**
* Initial position of the sheet.
* @type number
* @default SCREEN_HEIGHT
*/
initialPosition?: number;
/**
* Defines how violently sheet has to be stopped while over dragging.
* @type number
Expand Down

0 comments on commit 7e2b0b0

Please sign in to comment.