Skip to content
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

[changed] Don't render div on dom when isOpen is false #205

Merged
merged 1 commit into from
Jul 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions specs/Modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ describe('State', () => {
expect(ReactDOM.findDOMNode(mcontent(modal))).toNotExist();
});

it('doesn\'t render the portal if modal is closed', () => {
const modal = renderModal({}, 'hello');
expect(ReactDOM.findDOMNode(modal.portal)).toNotExist();
})

it('has default props', () => {
const node = document.createElement('div');
Modal.setAppElement(document.createElement('div'));
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModalPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export default class ModalPortal extends Component {
const contentStyles = className ? {} : defaultStyles.content;
const overlayStyles = overlayClassName ? {} : defaultStyles.overlay;

return this.shouldBeClosed() ? <div /> : (
return this.shouldBeClosed() ? null : (
<div
ref={this.setOverlayRef}
className={this.buildClassName('overlay', overlayClassName)}
Expand Down