-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(Modal): added support for React Portal #796
Conversation
I haven't had a chance to mess around with portals yet but would it be easier to just wrap a |
It's doesn't make sense because currently
|
- Fix modal-open not checking maptoCssModules before trying to remove it
Calling destroy in componenDidUpdate breaks the close transition. |
Exit animations are not working |
- fixed nested Modals, - updated react-transition-group to 2.2.1
Added new changes:
@seberik @TheSharpieOne, guys take a look at this, looks like now all should be good 😃 |
The exit animation now works but when double-clicking the backdrop or escape-key it will close and re-open the modal. |
- fixed Modal test
Fixed backdrop double-clicking and tests. |
Merged with master. Waiting for review. |
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.
LGTM, just a small nit.
src/__tests__/Modal.spec.js
Outdated
@@ -76,7 +76,7 @@ describe('Modal', () => { | |||
); | |||
|
|||
jest.runTimersToTime(300); | |||
expect(wrapper.childAt(0).children().length).toBe(0); | |||
expect(wrapper.childAt(0).children().length).not.toBe(0); |
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.
You can remove all of the checks like this. The previous test was ensuring nothing was inserted into the DOM, but now using react-portal, we will always be inserting react-portal, so these checks are more/less pointless (unless you want to check that react-portal get inserted, but I would also only do that in one test, not all of them.)
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.
Removed those unneeded checks and created new test for this.
react-portal
package (uses React v16 and its official API for creating portals; has a fallback for React v15).enzyme-adapter-react-16
to latest version forPortals
support.handleBackdropClick
is fires for nested modals and close all opened. Need to investigate more on this.After using
ReactDOM.createPortal
it's not more 0. Can I remove this checks?Need some reviews/comments to current changes.
Refers to #601, #761.