You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently you can pass a dismiss function from the parent component to the dialog component, which will be called when the button "Close" (or any other actions that you specify) is clicked inside the dialog component.
The problem is that the _handleClickAway and _checkEscapeKeyUp keep pointing to the default dismiss function that comes with dialog component, they should also be able to update and point to the correct new dismiss function specified in the parent component.
Here's a situation that this is problematic:
I have a parent component which lists many products, once a product is clicked the dialog appears with the specific product data;
The parent component dynamically insert the dialog based on the state of the currently selected product, passing the product data to be shown inside the dialog;
Once the user intent to close the dialog, the parent component needs to: unset the selected product from it's state, change the dialog state to false (by calling the dialog dismiss directly), and then remove the dialog from the DOM (optionally);
Now to achieve that you can pass the parent dismiss function performing the state update and then calling this.refs.dialogRefName.dismiss(), but if the user closes the dialog by clicking away or pressing ESC the parent dismiss function from the parent is not called, thus not allowing it to update the state of the current selected product.
The text was updated successfully, but these errors were encountered:
By looking at the code, it's clear that a easy way to accomplish that would be to add a callback on the dismiss method just like there is already one in the show method, something like this:
Currently you can pass a dismiss function from the parent component to the dialog component, which will be called when the button "Close" (or any other actions that you specify) is clicked inside the dialog component.
The problem is that the _handleClickAway and _checkEscapeKeyUp keep pointing to the default dismiss function that comes with dialog component, they should also be able to update and point to the correct new dismiss function specified in the parent component.
Here's a situation that this is problematic:
Now to achieve that you can pass the parent dismiss function performing the state update and then calling this.refs.dialogRefName.dismiss(), but if the user closes the dialog by clicking away or pressing ESC the parent dismiss function from the parent is not called, thus not allowing it to update the state of the current selected product.
The text was updated successfully, but these errors were encountered: