-
-
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
#601 Modal bugs on react ^16 #645
#601 Modal bugs on react ^16 #645
Conversation
…rSubtreeIntoContainer for < ^16.0 version
I thought I had commented on this earlier, but I apparently did not. The portal API is supposed to be used in the render AFAIK. This means that the logic would be similar, but separated. The render would return null for react <16 and would return the unstable_createPortal for react 16+. Similarly and separately, the opposite would happen in the renderIntoSubtree method; unstable_renderSubtreeIntoContainer would be called for react <15 and nothing would happen for react 16+. |
Thanks @martindavid, I can confirm that this fixes the
@TheSharpieOne: The changes you propose would require more logic changes; |
@TheSharpieOne when this and #763 can be released? We have some troubles according to this issues. |
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.
ReactDOM.createPortal required.
this._element | ||
); | ||
if (ReactDOM.unstable_createPortal) { | ||
ReactDOM.unstable_createPortal(this.renderChildren(), this._element); |
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.
It's no longer unstable_createPortal
... Should be ReactDOM.createPortal
I've been fiddling with the code for a couple of hours and I think @TheSharpieOne is correct, the With a bit of effort, I made it work with React 16 and I can confirm that the focus problem is fixed. Personnaly, I find it very difficult to make the two approaches ( |
ReactDOM.unstable_createPortal
to support Fiber version.ReactDOM.unstable_renderSubtreeIntoContainer
as a fallback for < 16 version.Issue: #601