react-portalize
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -27,3 +27,3 @@ "use strict"; | ||
function _componentDidMount() { | ||
if (this.props.entry() === null) { | ||
if (typeof document !== 'undefined' && this.props.entry() === null) { | ||
this.forceUpdate(); | ||
@@ -77,2 +77,6 @@ } | ||
entry: function entry() { | ||
if (typeof document === 'undefined') { | ||
return null; | ||
} | ||
return document.getElementById('portals'); | ||
@@ -79,0 +83,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types"],t):t(e.Portalize={},e.React,e.ReactDOM,e.PropTypes)}(this,function(e,t,r,o){"use strict";function n(){null===this.props.entry()&&this.forceUpdate()}function p(){var e=this.props,t=e.children,o=e.entry;return null===o()?null:r.createPortal(t,o())}t=t&&t.hasOwnProperty("default")?t.default:t,r=r&&r.hasOwnProperty("default")?r.default:r,o=o&&o.hasOwnProperty("default")?o.default:o;var u=function(e){var t,r;function o(){return e.apply(this,arguments)||this}(t=o).prototype=Object.create((r=e).prototype),t.prototype.constructor=t,t.__proto__=r;var u=o.prototype;return u.componentDidMount=n,u.render=p,o}(t.Component);Object.defineProperty(u,"defaultProps",{configurable:!0,enumerable:!0,writable:!0,value:{entry:function(){return document.getElementById("portals")}}}),e.default=u,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types"],t):t(e.Portalize={},e.React,e.ReactDOM,e.PropTypes)}(this,function(e,t,r,o){"use strict";function n(){"undefined"!=typeof document&&null===this.props.entry()&&this.forceUpdate()}function u(){var e=this.props,t=e.children,o=e.entry;return null===o()?null:r.createPortal(t,o())}t=t&&t.hasOwnProperty("default")?t.default:t,r=r&&r.hasOwnProperty("default")?r.default:r,o=o&&o.hasOwnProperty("default")?o.default:o;var p=function(e){var t,r;function o(){return e.apply(this,arguments)||this}(t=o).prototype=Object.create((r=e).prototype),t.prototype.constructor=t,t.__proto__=r;var p=o.prototype;return p.componentDidMount=n,p.render=u,o}(t.Component);Object.defineProperty(p,"defaultProps",{configurable:!0,enumerable:!0,writable:!0,value:{entry:function(){return"undefined"==typeof document?null:document.getElementById("portals")}}}),e.default=p,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -16,3 +16,3 @@ import _Object$getPrototypeOf from "@babel/runtime/core-js/object/get-prototype-of"; | ||
function _componentDidMount() { | ||
if (this.props.entry() === null) { | ||
if (typeof document !== 'undefined' && this.props.entry() === null) { | ||
this.forceUpdate(); | ||
@@ -62,2 +62,6 @@ } | ||
entry: function entry() { | ||
if (typeof document === 'undefined') { | ||
return null; | ||
} | ||
return document.getElementById('portals'); | ||
@@ -64,0 +68,0 @@ } |
{ | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "commonjs/index.js", | ||
@@ -4,0 +4,0 @@ "module": "es/index.js", |
@@ -26,3 +26,3 @@ # Portalize | ||
## Props | ||
- `entry {function}` | ||
- `entry {function} {default: () => document.getElementById('portals')}` | ||
- a function which returns the DOM element you'd like to portal into | ||
@@ -29,0 +29,0 @@ ```js |
@@ -20,2 +20,6 @@ import React from 'react' | ||
entry: function () { | ||
if (typeof document === 'undefined') { | ||
return null | ||
} | ||
return document.getElementById('portals') | ||
@@ -26,3 +30,3 @@ } | ||
componentDidMount () { | ||
if (this.props.entry() === null) { | ||
if (typeof document !== 'undefined' && this.props.entry() === null) { | ||
this.forceUpdate() | ||
@@ -29,0 +33,0 @@ } |
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
12537
258