react-confirm 0.1.23 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,13 +34,13 @@ import PropTypes from 'prop-types';
34
34
  import { confirmable } from 'react-confirm';
35
35
  import Dialog from 'any-dialog-library'; // your choice.
36
36
 
37
- const YourDialog = ({show, proceed, confirmation, options}) => {
37
+ const YourDialog = ({show, proceed, confirmation, options}) => (
38
38
  <Dialog onHide={() => proceed(false)} show={show}>
39
39
  {confirmation}
40
40
  <button onClick={() => proceed(false)}>CANCEL</button>
41
41
  <button onClick={() => proceed(true)}>OK</button>
42
42
  </Dialog>
43
- }
43
+ )
44
44
 
45
45
  YourDialog.propTypes = {
46
46
  show: PropTypes.bool, // from confirmable. indicates if the dialog is shown or not.
@@ -40,8 +40,8 @@ var createConfirmation = function createConfirmation(Component) {
40
40
  setTimeout(function () {
41
41
  _reactDom2.default.unmountComponentAtNode(wrapper);
42
42
  setTimeout(function () {
43
- if (document.body.contains(wrapper)) {
44
- document.body.removeChild(wrapper);
43
+ if (wrapper && wrapper.parent) {
44
+ wrapper.parent.removeChild(wrapper);
45
45
  }
46
46
  });
47
47
  }, unmountDelay);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-confirm",
3
- "version": "0.1.23",
3
+ "version": "0.1.26",
4
4
  "description": "Small library which makes your Dialog component callable",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -26,8 +26,8 @@ const createConfirmation = (Component, unmountDelay = 1000, mountingNode) => {
26
26
  setTimeout(() => {
27
27
  ReactDOM.unmountComponentAtNode(wrapper);
28
28
  setTimeout(() => {
29
- if (document.body.contains(wrapper)) {
30
- document.body.removeChild(wrapper)
29
+ if (wrapper && wrapper.parentNode) {
30
+ wrapper.parentNode.removeChild(wrapper);
31
31
  }
32
32
  });
33
33
  }, unmountDelay);