@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 +1 -1
- package/src/components/Modal/index.tsx +0 -3
- package/src/lib/hooks.ts +12 -8
package/package.json
CHANGED
|
@@ -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
|
|
358
|
+
const htmlStyle = document?.documentElement?.style
|
|
359
359
|
|
|
360
|
-
if (
|
|
361
|
-
|
|
362
|
-
|
|
360
|
+
if (!!htmlStyle) {
|
|
361
|
+
if (htmlStyle.overflowX !== 'hidden') {
|
|
362
|
+
htmlStyle.overflowX = 'hidden'
|
|
363
|
+
}
|
|
363
364
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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
|
}
|