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 3.0.0 to 3.1.0

28

build/portal.js

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

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -36,3 +40,3 @@

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Portal).call(this));
var _this = _possibleConstructorReturn(this, (Portal.__proto__ || Object.getPrototypeOf(Portal)).call(this));

@@ -114,3 +118,3 @@ _this.state = { active: false };

value: function openPortal() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;

@@ -126,3 +130,3 @@ this.setState({ active: true });

var isUnmounted = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
var isUnmounted = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

@@ -206,11 +210,11 @@ var resetPortalState = function resetPortalState() {

Portal.propTypes = {
children: _react2.default.PropTypes.element.isRequired,
openByClickOn: _react2.default.PropTypes.element,
closeOnEsc: _react2.default.PropTypes.bool,
closeOnOutsideClick: _react2.default.PropTypes.bool,
isOpened: _react2.default.PropTypes.bool,
onOpen: _react2.default.PropTypes.func,
onClose: _react2.default.PropTypes.func,
beforeClose: _react2.default.PropTypes.func,
onUpdate: _react2.default.PropTypes.func
children: _propTypes2.default.element.isRequired,
openByClickOn: _propTypes2.default.element,
closeOnEsc: _propTypes2.default.bool,
closeOnOutsideClick: _propTypes2.default.bool,
isOpened: _propTypes2.default.bool,
onOpen: _propTypes2.default.func,
onClose: _propTypes2.default.func,
beforeClose: _propTypes2.default.func,
onUpdate: _propTypes2.default.func
};

@@ -217,0 +221,0 @@

import React from 'react';
import ReactDOM, { findDOMNode } from 'react-dom';
import PropTypes from 'prop-types';

@@ -152,11 +153,11 @@ const KEYCODES = {

Portal.propTypes = {
children: React.PropTypes.element.isRequired,
openByClickOn: React.PropTypes.element,
closeOnEsc: React.PropTypes.bool,
closeOnOutsideClick: React.PropTypes.bool,
isOpened: React.PropTypes.bool,
onOpen: React.PropTypes.func,
onClose: React.PropTypes.func,
beforeClose: React.PropTypes.func,
onUpdate: React.PropTypes.func,
children: PropTypes.element.isRequired,
openByClickOn: PropTypes.element,
closeOnEsc: PropTypes.bool,
closeOnOutsideClick: PropTypes.bool,
isOpened: PropTypes.bool,
onOpen: PropTypes.func,
onClose: PropTypes.func,
beforeClose: PropTypes.func,
onUpdate: PropTypes.func,
};

@@ -163,0 +164,0 @@

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

@@ -70,3 +70,6 @@ "main": "build/portal",

"webpack-hot-middleware": "^2.6.0"
},
"dependencies": {
"prop-types": "^15.5.8"
}
}

@@ -126,3 +126,3 @@ React-portal

also needs an access to `this.props.closePortal()`? You can't just use `{this.props.children}` in render method of `<LevelOne>` component. You have to clone it instead:
also need an access to `this.props.closePortal()`? You can't just use `{this.props.children}` in render method of `<LevelOne>` component. You have to clone it instead:

@@ -138,11 +138,11 @@ ```jsx

Sometimes you need to open your portal (e.g. modal) automatically. There is no button to click on. No problem, because the portal has the `isOpen` prop, so you can just set it to `true` or `false`. However, then it's completely up to you to take care about the portal closing (ESC, outside click, no `this.props.closePortal` callback...).
Sometimes you need to open your portal (e.g. modal) automatically. There is no button to click on. No problem, because the portal has the `isOpened` prop, so you can just set it to `true` or `false`. However, then it's completely up to you to take care about the portal closing (ESC, outside click, no `this.props.closePortal` callback...).
However, there is a nice trick how to make this happen even without `isOpen`:
However, there is a nice trick how to make this happen even without `isOpened`:
```jsx
<Portal ref="myPortal">
<Modal title="My modal">
<PseudoModal title="My modal">
Modal content
</Modal>
</PseudoModal>
</Portal>

@@ -149,0 +149,0 @@ ```

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