@micromag/screen-keypad 0.4.57 → 0.4.58

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.
Files changed (2) hide show
  1. package/es/index.js +11 -10
  2. package/package.json +2 -2
package/es/index.js CHANGED
@@ -189,7 +189,6 @@ function KeypadScreen(_ref) {
189
189
  _useState6 = _slicedToArray(_useState5, 2),
190
190
  popup = _useState6[0],
191
191
  setPopup = _useState6[1];
192
- var prevShowPopupRef = useRef(showPopup);
193
192
  var _ref7 = popup || {},
194
193
  _ref7$heading = _ref7.heading,
195
194
  popupHeading = _ref7$heading === void 0 ? null : _ref7$heading,
@@ -395,15 +394,6 @@ function KeypadScreen(_ref) {
395
394
  bindPopupDrag = _useDragProgress.bind,
396
395
  popupSpring = _useDragProgress.progress,
397
396
  popupTransitioning = _useDragProgress.transitioning;
398
-
399
- // Clear popup contents after close transition completes
400
- useEffect(function () {
401
- if (prevShowPopupRef.current && !showPopup && !popupTransitioning) {
402
- console.log('clear popup');
403
- setPopup(null);
404
- }
405
- prevShowPopupRef.current = showPopup;
406
- }, [showPopup, popupTransitioning]);
407
397
  useEffect(function () {
408
398
  var keyup = function keyup(e) {
409
399
  if (e.key === 'Escape') {
@@ -507,6 +497,17 @@ function KeypadScreen(_ref) {
507
497
  setShowPopup(false);
508
498
  }
509
499
  }, [screenState, items, isView]);
500
+
501
+ // Clear popup contents after close transition completes
502
+ useEffect(function () {
503
+ if (isView && screenState === null && !showPopup && !popupTransitioning) {
504
+ // console.log('clear popup');
505
+ setPopup(null);
506
+ }
507
+ }, [isView, screenState, showPopup, popupTransitioning]);
508
+
509
+ // console.log('render keypad', { screenState, popup, showPopup, popupTransitioning });
510
+
510
511
  return /*#__PURE__*/jsxs("div", {
511
512
  ref: containerRef,
512
513
  className: classNames([styles.container, className, _defineProperty(_defineProperty({}, styles.isPlaceholder, isPlaceholder), styles.withSquareItems, withSquareItems)]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-keypad",
3
- "version": "0.4.57",
3
+ "version": "0.4.58",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -94,6 +94,6 @@
94
94
  "access": "public",
95
95
  "registry": "https://registry.npmjs.org/"
96
96
  },
97
- "gitHead": "fbe8859ecf20634ed5591afb432ff4869eb37352",
97
+ "gitHead": "b521da8b8c3efd5c099079ca3bd6e679b97155cf",
98
98
  "types": "es/index.d.ts"
99
99
  }