Closed shihfu closed 3 months ago
Same issue here!
Same issue for me.
I fixed this by passing this prop: onOpenChange={setIsDrawerOpen}
where:
const [isDrawerOpen, setIsDrawerOpen] = useState(false)
I fixed this by passing this prop: onOpenChange={setIsDrawerOpen}
where:
const [isDrawerOpen, setIsDrawerOpen] = useState(false)
Can confirm this works. Thank you for sharing the solution @TasseDeCafe
I fixed this by passing this prop: onOpenChange={setIsDrawerOpen} where: const [isDrawerOpen, setIsDrawerOpen] = useState(false)
Can confirm this works. Thank you for sharing the solution @TasseDeCafe
When doing this, if you have an AlertDialog/Dialog from Radix or Shadcn inside Drawer, adding onOpenChange will close the Drawer but keep AlertDialog/Dialog open when clicked outside.
Alternate approach:
add onRelease
on Root
onRelease={()=>setIsDrawerOpen(false)}
without using onOpenChange on Drawer
I fixed this by passing this prop: onOpenChange={setIsDrawerOpen}
where:
const [isDrawerOpen, setIsDrawerOpen] = useState(false)
Thanks. This worked!
After swiping to dismiss, the drawer cannot be re-opened when handling the state manually with the
open
prop.See live example
https://codesandbox.io/p/devbox/drawer-without-scale-forked-kt4pt8?file=%2Fapp%2Fmy-drawer.tsx%3A12%2C39&workspaceId=5f8e56d5-8e4d-4048-8649-6e66cd8a5584