-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
fix(react): modal now mounts child component independently of other modals #23903
Conversation
Currently, when Ion components such as `IonModal` are created using the `createOverlayComponent` HOC, the isDismissing flag is scoped to the definition of the class. So in this case, when IonModal gets exported, the isDismissing flag is scoped to the IonModal class definition and not an instance of the IonModal. Consider when you have multiple IonModals controlling different dialogs or whatever. So I believe this `isDismissing` flag should be scoped to the instance of the Overlay class, as if I chose to render 10 IonModals, each should be controlled independently.
Ready to go! |
The code looks good, but do you have a GitHub repo that shows the issue happening? I would like to verify this fix by testing in that app. |
@liamdebeasi Yea heres a code sandbox with ionic/react 5.7.0 showcasing the issue. https://codesandbox.io/s/nervous-sky-w954i Repo if you so desire: https://github.com/puopg/ioni-test |
BEFORE:Screen.Recording.2021-09-10.at.10.32.16.AM.movAFTER:Screen.Recording.2021-09-10.at.10.31.55.AM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
Merged. Thank you! |
Currently, when Ion components such as
IonModal
are created using thecreateOverlayComponent
HOC, the isDismissing flag is scoped to the definition of the class. So in this case, when IonModal gets exported, the isDismissing flag is scoped to the IonModal class definition and not an instance of the IonModal.Consider when you have multiple IonModals controlling different dialogs or whatever. So I believe this
isDismissing
flag should be scoped to the instance of the Overlay class, as if I chose to render 10 IonModals, each should be controlled independently.Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: resolves #23904
What is the new behavior?
Does this introduce a breaking change?
Other information