Skip to content

Commit

Permalink
fix: ios scroll fix
Browse files Browse the repository at this point in the history
  • Loading branch information
borcherd committed Feb 19, 2025
1 parent d347ec4 commit fc89a42
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/mrgn-ui/src/components/ui/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,22 @@ const Drawer = ({ shouldScaleBackground = true, ...props }: React.ComponentProps
);
Drawer.displayName = "Drawer";

const DrawerTrigger = DrawerPrimitive.Trigger;
// window.scrollTo(0,0) for IOS drawer issue !!
const DrawerTrigger = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Trigger>
>(({ className, ...props }, ref) => {
return (
<DrawerPrimitive.Trigger onClick={(e)=>{
props.onClick?.(e);
window.scrollTo(0, 0);
}}
ref={ref}
className={cn(className)}
{...props}
/>
)});
DrawerTrigger.displayName = DrawerPrimitive.Trigger.displayName;

const DrawerPortal = DrawerPrimitive.Portal;

Expand Down

0 comments on commit fc89a42

Please sign in to comment.