react-pure-modal 2.0.19 → 2.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-pure-modal",
3
- "version": "2.0.19",
3
+ "version": "2.2.0",
4
4
  "description": "React modal",
5
5
  "main": "dist/react-pure-modal.min.js",
6
6
  "types": "dist/react-pure-modal.d.ts",
@@ -67,7 +67,7 @@
67
67
  "yargs": "15.4.1"
68
68
  },
69
69
  "peerDependencies": {
70
- "react": "^15.3.0 || ^16.0 || ^17.0",
71
- "react-dom": "^15.3.0 || ^16.0 || ^17.0"
70
+ "react": "^15.3.0 || ^16.0 || ^17.0 || ^18.0",
71
+ "react-dom": "^15.3.0 || ^16.0 || ^17.0 || ^18.0"
72
72
  }
73
73
  }
@@ -1,7 +1,6 @@
1
1
  .body-modal-fix {
2
2
  height: 100%;
3
3
  width: 100%;
4
- position: fixed;
5
4
  overflow: hidden;
6
5
  }
7
6
 
@@ -37,10 +37,7 @@ function PureModal(props: Props) {
37
37
  useEffect(() => {
38
38
  if (isOpen) {
39
39
  open();
40
- } else {
41
- close();
42
40
  }
43
-
44
41
  return () => {
45
42
  isOpen && close();
46
43
  };
@@ -51,7 +48,7 @@ function PureModal(props: Props) {
51
48
 
52
49
  if (allModals.length && allModals[allModals.length - 1].classList.contains(hash)) return false;
53
50
 
54
- if (event.keyCode === 27 && document.activeElement) {
51
+ if (event.key === 'Escape' && document.activeElement) {
55
52
  close(event);
56
53
  }
57
54
  }, []);
@@ -242,4 +239,4 @@ function PureModal(props: Props) {
242
239
  return modalContent;
243
240
  }
244
241
 
245
- export default PureModal;
242
+ export default React.memo(PureModal);