Skip to content

Commit

Permalink
call snapToIndex() on open
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok committed Apr 9, 2024
1 parent 082d63d commit ef11e61
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ export function Outer({

const open = React.useCallback<DialogControlProps['open']>(
({index} = {}) => {
// Run any leftover callbacks that might have been queued up before calling `.open()`
callQueuedCallbacks()

setDialogIsOpen(control.id, true)
// can be set to any index of `snapPoints`, but `0` is the first i.e. "open"
setOpenIndex(index || 0)

callQueuedCallbacks()
sheet.current?.snapToIndex(index || 0)
},
[setDialogIsOpen, control.id, callQueuedCallbacks],
)
Expand Down

0 comments on commit ef11e61

Please sign in to comment.