Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@reach/portal

Package Overview
Dependencies
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reach/portal - npm Package Compare versions

Comparing version 0.6.1 to 0.6.2

5

es/index.js

@@ -5,3 +5,3 @@ import React from "react";

var Portal = function Portal(_ref) {
function Portal(_ref) {
var children = _ref.children,

@@ -46,4 +46,5 @@ _ref$type = _ref.type,

});
};
}
Portal.displayName = "Portal";
export default Portal;

@@ -14,3 +14,3 @@ "use strict";

var Portal = function Portal(_ref) {
function Portal(_ref) {
var children = _ref.children,

@@ -55,5 +55,6 @@ _ref$type = _ref.type,

});
};
}
Portal.displayName = "Portal";
var _default = Portal;
exports["default"] = _default;

6

package.json
{
"name": "@reach/portal",
"version": "0.6.1",
"version": "0.6.2",
"description": "Declarative portals for React",

@@ -11,3 +11,3 @@ "main": "index.js",

"dependencies": {
"@reach/component-component": "^0.6.1"
"@reach/component-component": "^0.6.2"
},

@@ -28,3 +28,3 @@ "peerDependencies": {

],
"gitHead": "c1e249448a3672ccc65698218f0f38ef9814ab90"
"gitHead": "00e73c5da6d25f50194612f74de71156fde2a80a"
}

@@ -5,27 +5,31 @@ import React from "react";

let Portal = ({ children, type = "reach-portal" }) => (
<Component
getRefs={() => ({ mountNode: null, portalNode: null })}
didMount={({ refs, forceUpdate }) => {
// It's possible that the content we are portal has, itself, been portaled.
// In that case, it's important to append to the correct document element.
const ownerDocument = refs.mountNode.ownerDocument;
refs.portalNode = ownerDocument.createElement(type);
ownerDocument.body.appendChild(refs.portalNode);
forceUpdate();
}}
willUnmount={({ refs: { portalNode } }) => {
portalNode.ownerDocument.body.removeChild(portalNode);
}}
render={({ refs }) => {
const { portalNode } = refs;
if (!portalNode) {
return <div ref={div => (refs.mountNode = div)} />;
} else {
return createPortal(children, portalNode);
}
}}
/>
);
function Portal({ children, type = "reach-portal" }) {
return (
<Component
getRefs={() => ({ mountNode: null, portalNode: null })}
didMount={({ refs, forceUpdate }) => {
// It's possible that the content we are portal has, itself, been portaled.
// In that case, it's important to append to the correct document element.
const ownerDocument = refs.mountNode.ownerDocument;
refs.portalNode = ownerDocument.createElement(type);
ownerDocument.body.appendChild(refs.portalNode);
forceUpdate();
}}
willUnmount={({ refs: { portalNode } }) => {
portalNode.ownerDocument.body.removeChild(portalNode);
}}
render={({ refs }) => {
const { portalNode } = refs;
if (!portalNode) {
return <div ref={div => (refs.mountNode = div)} />;
} else {
return createPortal(children, portalNode);
}
}}
/>
);
}
Portal.displayName = "Portal";
export default Portal;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc