react-portal
Advanced tools
Comparing version 2.1.4 to 2.2.0
@@ -183,2 +183,15 @@ 'use strict'; | ||
}, { | ||
key: 'applyClassNameAndStyle', | ||
value: function applyClassNameAndStyle(props) { | ||
if (props.className) { | ||
this.node.className = props.className; | ||
} | ||
if (props.style) { | ||
// React 15.1.0+ requires third parameter in debug mode | ||
/* eslint-disable no-underscore-dangle */ | ||
_CSSPropertyOperations2.default.setValueForStyles(this.node, props.style, this._reactInternalInstance); | ||
/* eslint-enable no-underscore-dangle */ | ||
} | ||
} | ||
}, { | ||
key: 'renderPortal', | ||
@@ -188,12 +201,8 @@ value: function renderPortal(props) { | ||
this.node = document.createElement('div'); | ||
if (props.className) { | ||
this.node.className = props.className; | ||
} | ||
if (props.style) { | ||
// React 15.1.0+ requires third parameter in debug mode | ||
/* eslint-disable no-underscore-dangle */ | ||
_CSSPropertyOperations2.default.setValueForStyles(this.node, props.style, this._reactInternalInstance); | ||
/* eslint-enable no-underscore-dangle */ | ||
} | ||
// apply CSS before the node is added to the DOM to avoid needless reflows | ||
this.applyClassNameAndStyle(props); | ||
document.body.appendChild(this.node); | ||
} else { | ||
// update CSS when new props arrive | ||
this.applyClassNameAndStyle(props); | ||
} | ||
@@ -200,0 +209,0 @@ this.portal = _reactDom2.default.unstable_renderSubtreeIntoContainer(this, _react2.default.cloneElement(props.children, { closePortal: this.closePortal }), this.node, this.props.onUpdate); |
@@ -129,17 +129,25 @@ import React from 'react'; | ||
applyClassNameAndStyle(props) { | ||
if (props.className) { | ||
this.node.className = props.className; | ||
} | ||
if (props.style) { | ||
// React 15.1.0+ requires third parameter in debug mode | ||
/* eslint-disable no-underscore-dangle */ | ||
CSSPropertyOperations.setValueForStyles(this.node, | ||
props.style, | ||
this._reactInternalInstance); | ||
/* eslint-enable no-underscore-dangle */ | ||
} | ||
} | ||
renderPortal(props) { | ||
if (!this.node) { | ||
this.node = document.createElement('div'); | ||
if (props.className) { | ||
this.node.className = props.className; | ||
} | ||
if (props.style) { | ||
// React 15.1.0+ requires third parameter in debug mode | ||
/* eslint-disable no-underscore-dangle */ | ||
CSSPropertyOperations.setValueForStyles(this.node, | ||
props.style, | ||
this._reactInternalInstance); | ||
/* eslint-enable no-underscore-dangle */ | ||
} | ||
// apply CSS before the node is added to the DOM to avoid needless reflows | ||
this.applyClassNameAndStyle(props); | ||
document.body.appendChild(this.node); | ||
} else { | ||
// update CSS when new props arrive | ||
this.applyClassNameAndStyle(props); | ||
} | ||
@@ -146,0 +154,0 @@ this.portal = ReactDOM.unstable_renderSubtreeIntoContainer( |
{ | ||
"name": "react-portal", | ||
"version": "2.1.4", | ||
"version": "2.2.0", | ||
"description": "React component for transportation of modals, lightboxes, loading bars... to document.body", | ||
@@ -5,0 +5,0 @@ "main": "build/portal", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1850841
999