react-aria-modal
Advanced tools
Comparing version 5.0.1 to 5.0.2
@@ -5,2 +5,6 @@ # Changelog | ||
## 5.0.2 | ||
- s/prepublish/prepublishOnly | ||
## 5.0.1 | ||
@@ -7,0 +11,0 @@ |
@@ -313,3 +313,3 @@ "use strict"; | ||
function Displaced(props) { | ||
function Displaced() { | ||
var _this4; | ||
@@ -319,6 +319,10 @@ | ||
_this4 = _super2.call(this, props); | ||
_this4.state = { | ||
container: null | ||
}; | ||
for (var _len = arguments.length, args = new Array(_len), _key3 = 0; _key3 < _len; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
} | ||
_this4 = _super2.call.apply(_super2, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_this4), "container", null); | ||
return _this4; | ||
@@ -330,14 +334,10 @@ } | ||
value: function componentDidMount() { | ||
var container; | ||
if (options.renderTo) { | ||
container = typeof options.renderTo === 'string' ? document.querySelector(options.renderTo) : options.renderTo; | ||
this.container = typeof options.renderTo === 'string' ? document.querySelector(options.renderTo) : options.renderTo; | ||
} else { | ||
container = document.createElement('div'); | ||
document.body.appendChild(container); | ||
this.container = document.createElement('div'); | ||
document.body.appendChild(this.container); | ||
} | ||
this.setState({ | ||
container: container | ||
}); | ||
this.forceUpdate(); | ||
} | ||
@@ -348,3 +348,3 @@ }, { | ||
if (!options.renderTo) { | ||
this.state.container.parentNode.removeChild(this.state.container); | ||
this.container.parentNode.removeChild(this.container); | ||
} | ||
@@ -355,4 +355,4 @@ } | ||
value: function render() { | ||
if (this.state.container === null || !this.props.mounted) return null; | ||
return ReactDOM.createPortal(React.createElement(WrappedComponent, this.props, this.props.children), this.state.container); | ||
if (this.container === null || !this.props.mounted) return null; | ||
return ReactDOM.createPortal(React.createElement(WrappedComponent, this.props, this.props.children), this.container); | ||
} | ||
@@ -359,0 +359,0 @@ }]); |
{ | ||
"name": "react-aria-modal", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "A fully accessible and flexible React modal built according WAI-ARIA Authoring Practices", | ||
@@ -12,3 +12,3 @@ "main": "dist/react-aria-modal.js", | ||
"build": "babel src -d dist", | ||
"prepublish": "npm run build", | ||
"prepublishOnly": "npm run build", | ||
"test": "npm run lint" | ||
@@ -15,0 +15,0 @@ }, |
@@ -275,3 +275,6 @@ const React = require('react'); | ||
if (options.renderTo) { | ||
this.container = typeof options.renderTo === 'string' ? document.querySelector(options.renderTo) : options.renderTo; | ||
this.container = | ||
typeof options.renderTo === 'string' | ||
? document.querySelector(options.renderTo) | ||
: options.renderTo; | ||
} else { | ||
@@ -296,3 +299,3 @@ this.container = document.createElement('div'); | ||
React.createElement(WrappedComponent, this.props, this.props.children), | ||
this.container, | ||
this.container | ||
); | ||
@@ -299,0 +302,0 @@ } |
47832
565