We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The onEscKeyDown function can be only provided once during the first initialization, it cannot be updated later.
Create a function with useCallback which depends on some state variable.
const [ confirmationIsOpen, setConfirmationIsOpen ] = useState(true); const onEscKeyDown = useCallback(() => { console.log(confirmationIsOpen); if ( confirmationIsOpen ) { closeConfirmation(); } else { closeModal(); } }, [ closeModal, closeConfirmation, confirmationIsOpen ]); useEffect(() => { const timeout = setTimeout(() => setConfirmationIsOpen(false), 1000); return(() => clearTimeout(timeout)); }, [ setConfirmationIsOpen ]); return(<Modal ... onEscKeyDown={onEscKeyDown} />);
When the confirmationIsOpen variable is changed it will still log the initial value on ESC key presses.
The function should be updated.
The text was updated successfully, but these errors were encountered:
P.S.: The closeOnEsc property also cannot be changed once the modal is initialized, it will use the initial setting during its entire lifecycle.
Sorry, something went wrong.
No branches or pull requests
Bug report
Describe the bug
The onEscKeyDown function can be only provided once during the first initialization, it cannot be updated later.
To Reproduce
Create a function with useCallback which depends on some state variable.
When the confirmationIsOpen variable is changed it will still log the initial value on ESC key presses.
Expected behavior
The function should be updated.
System information
The text was updated successfully, but these errors were encountered: