@codeleap/web 3.13.2 → 3.13.3

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": "@codeleap/web",
3
- "version": "3.13.2",
3
+ "version": "3.13.3",
4
4
  "main": "src/index.ts",
5
5
  "repository": {
6
6
  "url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
@@ -25,7 +25,6 @@ import { ActionIcon, ActionIconProps } from '../ActionIcon'
25
25
  import { Scroll } from '../Scroll'
26
26
  import { ComponentCommonProps } from '../../types'
27
27
  import { Touchable, TouchableProps } from '../Touchable'
28
- import { useLockScroll } from '../../lib'
29
28
 
30
29
  export * from './styles'
31
30
 
@@ -342,8 +341,6 @@ export const Modal = (props) => {
342
341
  }
343
342
  }, [visible])
344
343
 
345
- useLockScroll(visible)
346
-
347
344
  const content = <ModalContent {...props} id={modalId.current} />
348
345
 
349
346
  // if (renderStatus === 'unmounted') return null
package/src/lib/hooks.ts CHANGED
@@ -355,16 +355,20 @@ export function useAnimatedVariantStyles<T extends Record<string|number|symbol,
355
355
 
356
356
  export function useLockScroll(isLock: boolean) {
357
357
  useIsomorphicEffect(() => {
358
- const htmlElement = document.documentElement
358
+ const htmlStyle = document?.documentElement?.style
359
359
 
360
- if (htmlElement.style.overflowX !== 'hidden') {
361
- htmlElement.style.overflowX = 'hidden'
362
- }
360
+ if (!!htmlStyle) {
361
+ if (htmlStyle.overflowX !== 'hidden') {
362
+ htmlStyle.overflowX = 'hidden'
363
+ }
363
364
 
364
- if (isLock) {
365
- htmlElement.style.overflowY = 'hidden'
366
- } else {
367
- htmlElement.style.overflowY = 'auto'
365
+ console.log({ isLock, flow: htmlStyle.overflowY })
366
+
367
+ if (isLock) {
368
+ htmlStyle.overflowY = 'hidden'
369
+ } else if (!isLock && htmlStyle.overflowY === 'hidden') {
370
+ htmlStyle.overflowY = 'auto'
371
+ }
368
372
  }
369
373
  }, [isLock])
370
374
  }