#Drawer issue

9 messages · Page 1 of 1 (latest)

hushed beacon
hard glacier
#

@hushed beacon If it also triggers 2 times, but the drawer should open only once right

#

How can it open twice

#

?

hushed beacon
#

It means that you have two or more Drawer components in your tree

hard glacier
#

@hushed beacon this is the component, the draweer is still opening twice

'use client';
import NewScrollArea from '@/Components/Common/General/NewScrollArea';
import ViewPlans1 from '@/Components/Common/General/ViewPlans1';
import { Button, Drawer } from '@mantine/core';
import { IconLayoutBottombarCollapse } from '@tabler/icons-react';
import { useState } from 'react';

const GLManagePlans = ({ data }) => {
const [openBottomSheet, setOpenBottomSheet] =
useState(true);

return (
<>
<div className="top-[71.5px] hidden flex-col gap-3 p-2 md:sticky md:flex">
<Button
fullWidth
onClick={() => setOpenBottomSheet(true)}
>
Select a plan
</Button>
<Drawer
opened={openBottomSheet}
onClose={() => setOpenBottomSheet(false)}
position="bottom"
size="100%"
title="Select a plan"
scrollAreaComponent={NewScrollArea}
padding="0px"
closeButtonProps={{
icon: (
<IconLayoutBottombarCollapse
stroke={1.5}
size={24}
/>
),
}}
>
<div className="flex flex-col gap-3 p-2">
<ViewPlans1
plans={data.subscriptionPlans}
defaultSelect={data.subscriptionPlans[0]._id}
onSelect={plan => {
console.log(plan);
}}
/>
</div>
</Drawer>
</>
);
};

export default GLManagePlans;

This is the component and I have only one drawer, but its still opening twice

hushed beacon
#

Provide a sandbox with a minimal reproduction

hard glacier
#

@hushed beacon not able to replicate it, but just to let you know that this is happening, you can see it

hushed beacon
#

I can't help much without reproduction