-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
breaking(Portal): use createPortal() API #2755
Conversation
render() { | ||
const { children, mountNode = isBrowser() ? document.body : null } = this.props | ||
|
||
return createPortal(<Ref innerRef={this.handleRef}>{children}</Ref>, mountNode) |
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.
We need a valid ref
to get working closeOnDocumentClick
as now we don't have rootNode
and portalNode
in fact
@@ -21,12 +21,10 @@ class ModalExampleCloseConfig extends Component { | |||
<Modal | |||
open={open} | |||
closeOnEscape={closeOnEscape} | |||
closeOnRootNodeClick={closeOnRootNodeClick} | |||
closeOnDimmerClick={closeOnDimmerClick} |
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.
closeOnRootNodeClick
was not correct there
Codecov Report
@@ Coverage Diff @@
## react-16 #2755 +/- ##
============================================
- Coverage 99.74% 99.74% -0.01%
============================================
Files 160 161 +1
Lines 2762 2745 -17
============================================
- Hits 2755 2738 -17
Misses 7 7
Continue to review full report at Codecov.
|
What do you think about making a Linking #2747. |
In this case I think it will be better if we ship this PR now. |
OK, let's merge this into a |
…React into feat/portal-16 # Conflicts: # src/index.js
@levithomason I've changed base to |
* breaking(Portal): use createPortal() API (#2755) * breaking(Portal): use createPortal() API * test(Portal): rewrite tests * test(Portal): rewrite tests * fix(Portal): mixed fixes in tests * fix(Portal): fix path of typings * feat(Flag|Icon): use PureComponent instead of shallowEqual() (#2842) * fix(IconSearch): remove prop * fix(PortalInner): remove meta * fix(Portal): fix broken test * fix(Modal): go away from rootNode * fix(Flag|Icon): remove unused import * feat(Portal): add `triggerRef` prop (#2902) * feat(Portal): add `triggerRef` prop * test(Portal): add test for `triggerRef` prop * fix(Popup): fix test * BREAKING(Accordion): refactor shorthand API to use AccordionPanel (#2904) * refactor(Accordion): simplify render with AccordionPanel * style(Accordion): add description * fix(tests): reenable throw on console.log() * style(mixed): lint issues in typings * fix yarn.lock * fix(ComponentDocLinks): add rel="noopener noreferrer" * revert styling changes * restore yarn.lock from master * style(Portal): remove render method
BREAKING
Why?
Our
Portal
component relies onunstable_renderSubtreeIntoContainer
, this API is deprecated and will be removed in future releases of React. Also, this causes problems with tests.1. Requirement of React 16
React 16 was released in September 2017, the update process is simple and I don't know any supported application that still uses React 15. It's time to say goodbye to React 15.
Please keep in mind, that in near future we will possibly require React 16.3.
2. Removal of
className
propAs we use the new API (createPortal()) we don't need wrapper nodes as was before, so we don't have a target where we can apply
className
.Before
After
3. Removal of
prepend
propNow, we don't control DOM manipulations, so this prop is useless now.
4. Removal of
closeOnRootNodeClick
Now, we don't have
rootNode
at all,createPortal
is responsible for DOM manipulations.Fixes #2746.