-
-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing Modal Prop to true or false conditionally causes drawer to rerender content #372
Comments
**Type anything in the input in code sandbox.. wait for modal prop to change, as soon as modal prop changes text disappears since drawer re-renders ** |
Can someone help with this? |
any update on this? |
Hi, have you solved it? I also have the same issue. |
I believe I've found a work around. It's a little bit hacky, but it worked for me. Under the hood, it's using the same functionality as radix-ui (thanks to this reddit thread). Rather than change the Drawer itself, here's my approach.
Then in your stylesheet:
Please let me know if this works for you. |
Have you tried memoizing the child? |
modal={isMenuOpen ? false : true}
When doing something like this, the drawer content re-renders and whatever typed in input just disappears.
<DrawerRoot
className="xyz"
open={open}
onOpenChange={onOpenChange}
modal={isMenuOpen ? false : true}
// onClose={onClose}
>
<div
className={cn(
styles.drawerCols,
modalName === modals.EditNumber && styles.editNumberCols,
modalName === modals.OtpVerifyEditNumber && styles.otpVerifyCols,
modalName === modals.YourMotorcycle && styles.yourMotorCols
)}
style={{
paddingLeft: "1rem",
paddingRight: "0.688rem",
paddingBottom: "0",
}}
>
<button
className={cn(
styles["dialog_close-button"],
styles.closeBtn,
successModal ? styles.closeBtnHide : "",
detailPlan ? styles.detailCloseBtn : ""
)}
onClick={onClose}
>
{children} ----> it has a component with input whatever typed in it will disappear as soon as modal prop changes.
The text was updated successfully, but these errors were encountered: