intelicoreact 1.2.33 → 1.2.35

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.
@@ -90,7 +90,7 @@ function useMobileModal(_ref) {
90
90
  // Detect Mobile
91
91
 
92
92
 
93
- (0, _react.useLayoutEffect)(function () {
93
+ (0, _react.useEffect)(function () {
94
94
  if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) setIsMobile(true);
95
95
  }, [navigator.userAgent]); // Count ScrollTop
96
96
 
@@ -107,7 +107,7 @@ function useMobileModal(_ref) {
107
107
  }
108
108
  }, [modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current]); // Count ScrollDirection
109
109
 
110
- (0, _react.useLayoutEffect)(function () {
110
+ (0, _react.useEffect)(function () {
111
111
  setScrollDirection(scrollTop < scrollTopPrev ? SCROLL_DIRECTION.UP : SCROLL_DIRECTION.DOWN);
112
112
  }, [scrollTop, scrollTopPrev]); // Dynamic Modal Positioning
113
113
 
@@ -116,11 +116,6 @@ function useMobileModal(_ref) {
116
116
  var modalStyle = modalRef !== null && modalRef !== void 0 && modalRef.current ? (modalRef === null || modalRef === void 0 ? void 0 : modalRef.current.currentStyle) || window.getComputedStyle(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) : {};
117
117
  var computedModalHeight = modalRef !== null && modalRef !== void 0 && modalRef.current ? modalHeight + parseFloat((modalStyle === null || modalStyle === void 0 ? void 0 : modalStyle.marginTop) || 0) : 0;
118
118
  var windowHeight = document.documentElement.clientHeight || window.screen.availHeight || window.screen.height;
119
- console.log({
120
- modalMobileContainerRef: modalMobileContainerRef,
121
- computedModalHeight: computedModalHeight,
122
- windowHeight: windowHeight
123
- });
124
119
 
125
120
  if (modalMobileContainerRef !== null && modalMobileContainerRef !== void 0 && modalMobileContainerRef.current) {
126
121
  if (computedModalHeight <= windowHeight) {
@@ -144,23 +139,25 @@ function useMobileModal(_ref) {
144
139
 
145
140
  if (modalHeight !== newModalHeight) {
146
141
  setModalHeight(newModalHeight);
147
- console.log({
148
- modalHeight: modalHeight
149
- });
150
142
  }
151
143
  }
152
144
  });
153
- (0, _react.useLayoutEffect)(function () {
154
- var footerBottom = modalsLogicProps.footerBottom,
155
- footerHeight = modalsLogicProps.footerHeight,
156
- headerTop = modalsLogicProps.headerTop,
157
- bodyTop = modalsLogicProps.bodyTop;
158
- setModalsLogic({
159
- IS_HEADER_HIDDEN: !isMobile || noMobileModalLogic ? false : footerBottom * -1 <= footerHeight || scrollDirection === SCROLL_DIRECTION.DOWN,
160
- IS_HEADER_STICKY: !isMobile || noMobileModalLogic ? false : headerTop <= 0,
161
- IS_FOOTER_HIDDEN: !isMobile || noMobileModalLogic ? false : bodyTop > 0 || scrollDirection === SCROLL_DIRECTION.UP,
162
- IS_FOOTER_STICKY: !isMobile || noMobileModalLogic ? false : footerBottom <= 0
163
- });
145
+ (0, _react.useEffect)(function () {
146
+ if (isMobile && !noMobileModalLogic) {
147
+ var footerBottom = modalsLogicProps.footerBottom,
148
+ footerHeight = modalsLogicProps.footerHeight,
149
+ headerTop = modalsLogicProps.headerTop,
150
+ bodyTop = modalsLogicProps.bodyTop;
151
+ console.log({
152
+ footerBottom: footerBottom
153
+ });
154
+ setModalsLogic({
155
+ IS_HEADER_HIDDEN: footerBottom * -1 <= footerHeight || scrollDirection === SCROLL_DIRECTION.DOWN,
156
+ IS_HEADER_STICKY: headerTop <= 0,
157
+ IS_FOOTER_HIDDEN: bodyTop > 0 || scrollDirection === SCROLL_DIRECTION.UP,
158
+ IS_FOOTER_STICKY: footerBottom <= 0
159
+ });
160
+ }
164
161
  }, [isMobile, noMobileModalLogic, scrollDirection, modalsLogicProps, modalHeight]);
165
162
  (0, _react.useLayoutEffect)(function () {
166
163
  setModalsLogicProps(function (state) {
@@ -194,7 +191,7 @@ function useMobileModal(_ref) {
194
191
  var _modalMobileFooterRef, _modalMobileFooterRef2;
195
192
 
196
193
  return _objectSpread(_objectSpread({}, state), {}, {
197
- footerBottom: modalsLogicProps.modalMobileContainerHeight - (modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef = modalMobileFooterRef.current) === null || _modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef2 = _modalMobileFooterRef.getBoundingClientRect()) === null || _modalMobileFooterRef2 === void 0 ? void 0 : _modalMobileFooterRef2.bottom)
194
+ footerBottom: parseInt(modalsLogicProps.modalMobileContainerHeight - (modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef = modalMobileFooterRef.current) === null || _modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef2 = _modalMobileFooterRef.getBoundingClientRect()) === null || _modalMobileFooterRef2 === void 0 ? void 0 : _modalMobileFooterRef2.bottom))
198
195
  });
199
196
  });
200
197
  }, [modalsLogicProps.modalMobileContainerHeight, modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef3 = modalMobileFooterRef.current) === null || _modalMobileFooterRef3 === void 0 ? void 0 : (_modalMobileFooterRef4 = _modalMobileFooterRef3.getBoundingClientRect()) === null || _modalMobileFooterRef4 === void 0 ? void 0 : _modalMobileFooterRef4.bottom]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.2.33",
3
+ "version": "1.2.35",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [