@codeleap/web 3.12.8 → 3.12.9

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.12.8",
3
+ "version": "3.12.9",
4
4
  "main": "src/index.ts",
5
5
  "repository": {
6
6
  "url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
@@ -68,7 +68,7 @@ const defaultProps: Partial<DrawerProps> = {
68
68
  darkenBackground: true,
69
69
  size: '75vw',
70
70
  title: null,
71
- scrollLocked: true,
71
+ scrollLocked: false,
72
72
  closeIcon: 'x' as IconPlaceholder,
73
73
  }
74
74
 
@@ -99,7 +99,7 @@ export const Drawer = (props: DrawerProps) => {
99
99
  closeIcon,
100
100
  } = allProps as DrawerProps
101
101
 
102
- // usePopState(open, toggle, scrollLocked)
102
+ usePopState(open, toggle, scrollLocked)
103
103
 
104
104
  const [hiddenStyle, axis, positioning] = resolveHiddenDrawerPosition(position)
105
105
 
@@ -35,7 +35,7 @@ export const Overlay = <T extends NativeHTMLElement>(overlayProps:OverlayProps<T
35
35
  styles,
36
36
  })
37
37
 
38
- // usePopState(visible, props.onPress, scrollLocked)
38
+ usePopState(visible, props.onPress, scrollLocked)
39
39
 
40
40
  const Component = props.onClick || props.onPress ? Touchable : View
41
41
 
@@ -3,23 +3,9 @@ import { AnyFunction, useIsomorphicEffect, useUnmount } from '@codeleap/common'
3
3
  export const usePopState = (dependence: boolean, handler: AnyFunction, scrollLocked = true) => {
4
4
  useIsomorphicEffect(() => {
5
5
  if (dependence) {
6
- if (scrollLocked) {
7
- document.body.style.overflow = 'hidden'
8
- document.body.style.overflowX = 'hidden'
9
- document.body.style.overflowY = 'hidden'
10
- document.body.style.maxHeight = '100vh'
11
- }
12
-
13
6
  window.history.pushState(null, null, window.location.pathname)
14
7
  window.addEventListener('popstate', handler)
15
8
  } else {
16
- if (scrollLocked) {
17
- document.body.style.overflow = 'hidden'
18
- document.body.style.overflowX = 'hidden'
19
- document.body.style.overflowY = 'auto'
20
- document.body.style.maxHeight = 'auto'
21
- }
22
-
23
9
  window.removeEventListener('popstate', handler)
24
10
  }
25
11
  }, [dependence])