Socket
Socket
Sign inDemoInstall

react-portal

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-portal - npm Package Compare versions

Comparing version 2.2.1 to 3.0.0

33

build/portal.js

@@ -17,10 +17,2 @@ 'use strict';

var _CSSPropertyOperations = require('react/lib/CSSPropertyOperations');
var _CSSPropertyOperations2 = _interopRequireDefault(_CSSPropertyOperations);
var _shallowCompare = require('react/lib/shallowCompare');
var _shallowCompare2 = _interopRequireDefault(_shallowCompare);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -95,7 +87,2 @@

}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
return (0, _shallowCompare2.default)(this, nextProps, nextState);
}
}, {
key: 'componentWillUnmount',

@@ -185,15 +172,2 @@ value: function componentWillUnmount() {

}, {
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',

@@ -203,8 +177,3 @@ value: function renderPortal(props) {

this.node = document.createElement('div');
// 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);
}

@@ -237,4 +206,2 @@

Portal.propTypes = {
className: _react2.default.PropTypes.string,
style: _react2.default.PropTypes.object,
children: _react2.default.PropTypes.element.isRequired,

@@ -241,0 +208,0 @@ openByClickOn: _react2.default.PropTypes.element,

import React from 'react';
import ReactDOM, { findDOMNode } from 'react-dom';
import CSSPropertyOperations from 'react/lib/CSSPropertyOperations';
import shallowCompare from 'react/lib/shallowCompare';

@@ -59,6 +57,2 @@ const KEYCODES = {

shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
componentWillUnmount() {

@@ -130,25 +124,6 @@ if (this.props.closeOnEsc) {

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');
// 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);
}

@@ -179,4 +154,2 @@

Portal.propTypes = {
className: React.PropTypes.string,
style: React.PropTypes.object,
children: React.PropTypes.element.isRequired,

@@ -183,0 +156,0 @@ openByClickOn: React.PropTypes.element,

2

package.json
{
"name": "react-portal",
"version": "2.2.1",
"version": "3.0.0",
"description": "React component for transportation of modals, lightboxes, loading bars... to document.body",

@@ -5,0 +5,0 @@ "main": "build/portal",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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