Skip to content

Commit

Permalink
fix: allow initialHeight to be a number
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed May 29, 2022
1 parent 96b65b3 commit 752aef1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import type { GetInitialHeight, GetSnapPoints } from '@bottom-sheet/types'

export interface BottomSheetMachineProps {
initialHeight?: GetInitialHeight
initialHeight?: number | GetInitialHeight
snapPoints?: GetSnapPoints
}

Expand All @@ -26,7 +26,11 @@ function createStore({
const service = interpret(
BottomSheetMachine.withConfig({
actions: {
setInitialHeight: assignInitialHeight(initialHeight),
setInitialHeight: assignInitialHeight(
typeof initialHeight === 'function'
? initialHeight
: () => initialHeight
),
setSnapPoints: assignSnapPoints(snapPoints),
},
})
Expand Down

0 comments on commit 752aef1

Please sign in to comment.