@codeleap/web 3.12.8 → 3.12.10

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.10",
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
 
@@ -7,7 +7,7 @@ import { UseInfiniteScrollReturn } from './useInfiniteScroll'
7
7
  import { ActivityIndicator } from '../ActivityIndicator'
8
8
  import { motion } from 'framer-motion'
9
9
 
10
- type ListLayoutProps = Omit<ListProps, 'renderItem'> & UseInfiniteScrollReturn['layoutProps'] & {
10
+ export type ListLayoutProps = Omit<ListProps, 'renderItem'> & UseInfiniteScrollReturn['layoutProps'] & {
11
11
  variantStyles: StylesOf<ListComposition>
12
12
  children?: React.ReactNode
13
13
  showFooter?: boolean
@@ -96,7 +96,7 @@ export const ListLayout = (props: ListLayoutProps) => {
96
96
  ? <ListLoadingIndicatorComponent />
97
97
  : null}
98
98
 
99
- {(!!ListFooterComponent && showFooter) ? <ListFooterComponent /> : null}
99
+ {(!!ListFooterComponent && showFooter) ? <ListFooterComponent {...props} /> : null}
100
100
  </View>
101
101
  )
102
102
  }
@@ -7,6 +7,7 @@ import { ActivityIndicatorProps } from '../ActivityIndicator'
7
7
  import { ComponentCommonProps } from '../../types'
8
8
  import { UseInfiniteScrollArgs } from './useInfiniteScroll'
9
9
  import { ItemMasonryProps, ListMasonryProps } from '../../lib'
10
+ import { ListLayoutProps } from './ListLayout'
10
11
 
11
12
  export type AugmentedRenderItemInfo<T> = ItemMasonryProps<T> & {
12
13
  item: T
@@ -30,7 +31,7 @@ Data = T extends Array<infer D> ? D : never
30
31
  styles?: StylesOf<ListComposition>
31
32
  keyExtractor?: (item: T, index: number) => string
32
33
  renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
33
- ListFooterComponent?: () => React.ReactElement
34
+ ListFooterComponent?: (props: ListLayoutProps) => React.ReactElement
34
35
  ListLoadingIndicatorComponent?: () => React.ReactElement
35
36
  ListRefreshControlComponent?: () => React.ReactElement
36
37
  ListEmptyComponent?: React.FC | ((props: EmptyPlaceholderProps) => React.ReactElement)
@@ -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])