@codeleap/mobile 1.9.28 → 1.9.29

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.
Files changed (116) hide show
  1. package/dist/components/Backdrop.d.ts +66 -0
  2. package/dist/components/Backdrop.js +70 -0
  3. package/dist/components/Backdrop.js.map +1 -0
  4. package/dist/components/Button.d.ts +3 -3
  5. package/dist/components/Button.js.map +1 -1
  6. package/dist/components/FileInput.js +0 -2
  7. package/dist/components/FileInput.js.map +1 -1
  8. package/dist/components/Image.js +2 -2
  9. package/dist/components/Image.js.map +1 -1
  10. package/dist/components/List.d.ts +23 -4
  11. package/dist/components/List.js +17 -1
  12. package/dist/components/List.js.map +1 -1
  13. package/dist/components/Modal/index.d.ts +1 -1
  14. package/dist/components/Modal/index.js +26 -27
  15. package/dist/components/Modal/index.js.map +1 -1
  16. package/dist/components/Modal/styles.d.ts +3 -9
  17. package/dist/components/Modal/styles.js +26 -17
  18. package/dist/components/Modal/styles.js.map +1 -1
  19. package/dist/components/NewModal/index.d.ts +27 -0
  20. package/dist/components/NewModal/index.js +99 -0
  21. package/dist/components/NewModal/index.js.map +1 -0
  22. package/dist/components/NewModal/styles.d.ts +57 -0
  23. package/dist/components/NewModal/styles.js +58 -0
  24. package/dist/components/NewModal/styles.js.map +1 -0
  25. package/dist/components/Overlay.js +13 -9
  26. package/dist/components/Overlay.js.map +1 -1
  27. package/dist/components/Scroll.d.ts +4 -2
  28. package/dist/components/Scroll.js.map +1 -1
  29. package/dist/components/SegmentedControl/index.d.ts +42 -0
  30. package/dist/components/SegmentedControl/index.js +137 -0
  31. package/dist/components/SegmentedControl/index.js.map +1 -0
  32. package/dist/components/SegmentedControl/styles.d.ts +54 -0
  33. package/dist/components/SegmentedControl/styles.js +36 -0
  34. package/dist/components/SegmentedControl/styles.js.map +1 -0
  35. package/dist/components/SegmentedControl.d.ts +5 -0
  36. package/dist/components/SegmentedControl.js +32 -0
  37. package/dist/components/SegmentedControl.js.map +1 -0
  38. package/dist/components/Select/index.js +1 -1
  39. package/dist/components/Select/index.js.map +1 -1
  40. package/dist/components/Text.d.ts +8 -3
  41. package/dist/components/Text.js +12 -5
  42. package/dist/components/Text.js.map +1 -1
  43. package/dist/components/TextInput.d.ts +4 -2
  44. package/dist/components/TextInput.js +2 -2
  45. package/dist/components/TextInput.js.map +1 -1
  46. package/dist/components/Touchable.d.ts +5 -3
  47. package/dist/components/Touchable.js +26 -19
  48. package/dist/components/Touchable.js.map +1 -1
  49. package/dist/components/View.js +1 -1
  50. package/dist/components/View.js.map +1 -1
  51. package/dist/components/_Modal/index.d.ts +27 -0
  52. package/dist/components/_Modal/index.js +114 -0
  53. package/dist/components/_Modal/index.js.map +1 -0
  54. package/dist/components/_Modal/styles.d.ts +64 -0
  55. package/dist/components/_Modal/styles.js +60 -0
  56. package/dist/components/_Modal/styles.js.map +1 -0
  57. package/dist/components/components.d.ts +2 -0
  58. package/dist/components/components.js +2 -0
  59. package/dist/components/components.js.map +1 -1
  60. package/dist/index.d.ts +3 -0
  61. package/dist/index.js +16 -1
  62. package/dist/index.js.map +1 -1
  63. package/dist/utils/ModalManager/components.d.ts +5 -5
  64. package/dist/utils/ModalManager/components.js +16 -9
  65. package/dist/utils/ModalManager/components.js.map +1 -1
  66. package/dist/utils/ModalManager/context.d.ts +8 -3
  67. package/dist/utils/ModalManager/context.js +47 -23
  68. package/dist/utils/ModalManager/context.js.map +1 -1
  69. package/dist/utils/ModalManager/index.d.ts +3 -7
  70. package/dist/utils/ModalManager/index.js +1 -1
  71. package/dist/utils/ModalManager/index.js.map +1 -1
  72. package/dist/utils/PermissionManager/components.d.ts +18 -0
  73. package/dist/utils/PermissionManager/components.js +52 -0
  74. package/dist/utils/PermissionManager/components.js.map +1 -0
  75. package/dist/utils/PermissionManager/context.d.ts +52 -0
  76. package/dist/utils/PermissionManager/context.js +325 -0
  77. package/dist/utils/PermissionManager/context.js.map +1 -0
  78. package/dist/utils/PermissionManager/index.d.ts +4 -0
  79. package/dist/utils/PermissionManager/index.js +9 -0
  80. package/dist/utils/PermissionManager/index.js.map +1 -0
  81. package/dist/utils/PermissionManager/types.d.ts +13 -0
  82. package/dist/utils/PermissionManager/types.js +3 -0
  83. package/dist/utils/PermissionManager/types.js.map +1 -0
  84. package/dist/utils/hooks.d.ts +6 -0
  85. package/dist/utils/hooks.js +62 -0
  86. package/dist/utils/hooks.js.map +1 -0
  87. package/package.json +1 -1
  88. package/src/components/Backdrop.tsx +77 -0
  89. package/src/components/Button.tsx +3 -2
  90. package/src/components/FileInput.tsx +2 -2
  91. package/src/components/Image.tsx +3 -2
  92. package/src/components/List.tsx +44 -5
  93. package/src/components/Modal/index.tsx +38 -49
  94. package/src/components/Modal/styles.ts +35 -31
  95. package/src/components/Overlay.tsx +22 -13
  96. package/src/components/Scroll.tsx +3 -1
  97. package/src/components/SegmentedControl/index.tsx +182 -0
  98. package/src/components/SegmentedControl/styles.ts +65 -0
  99. package/src/components/Select/index.tsx +1 -2
  100. package/src/components/Text.tsx +23 -10
  101. package/src/components/TextInput.tsx +4 -2
  102. package/src/components/Touchable.tsx +31 -20
  103. package/src/components/View.tsx +1 -1
  104. package/src/components/_Modal/index.tsx +162 -0
  105. package/src/components/_Modal/styles.ts +125 -0
  106. package/src/components/components.ts +3 -0
  107. package/src/index.ts +6 -0
  108. package/src/modules/imageCropPicker.d.ts +497 -0
  109. package/src/modules/index.d.ts +186 -0
  110. package/src/utils/ModalManager/components.tsx +20 -9
  111. package/src/utils/ModalManager/context.tsx +69 -30
  112. package/src/utils/ModalManager/index.ts +6 -2
  113. package/src/utils/PermissionManager/context.tsx +299 -0
  114. package/src/utils/PermissionManager/index.ts +20 -0
  115. package/src/utils/PermissionManager/types.ts +24 -0
  116. package/src/utils/hooks.ts +65 -0
@@ -0,0 +1,77 @@
1
+ import React from 'react'
2
+ import { ComponentVariants, onUpdate, PropsOf, useDefaultComponentStyle } from '@codeleap/common'
3
+ import { useAnimationState, useDynamicAnimation } from 'moti'
4
+ import { Touchable } from './Touchable'
5
+ import { View } from './View'
6
+ import {
7
+ createDefaultVariantFactory,
8
+ includePresets,
9
+ } from '@codeleap/common'
10
+ import { StylesOf } from '../types/utility'
11
+ import { StyleSheet } from 'react-native'
12
+ import { useStaticAnimationStyles } from '../utils/hooks'
13
+
14
+ type BackdropComposition =
15
+ 'wrapper'|
16
+ 'touchable' |
17
+ 'wrapper:visible' |
18
+ 'wrapper:hidden'
19
+
20
+ const createBackdropVariant = createDefaultVariantFactory<BackdropComposition>()
21
+
22
+ const presets = includePresets((style) => createBackdropVariant(() => ({ wrapper: style })))
23
+
24
+ export const BackdropStyles = {
25
+ ...presets,
26
+ default: createBackdropVariant((theme) => ({
27
+ wrapper: {
28
+ backgroundColor: theme.colors.black,
29
+ ...theme.presets.whole,
30
+ ...theme.presets.absolute,
31
+ },
32
+ 'wrapper:visible': {
33
+ opacity: 0.5,
34
+ },
35
+ 'wrapper:hidden': {
36
+
37
+ opacity: 0,
38
+ },
39
+ touchable: {
40
+ ...theme.presets.whole,
41
+ ...theme.presets.absolute,
42
+ },
43
+ })),
44
+ }
45
+
46
+ export type BackdropProps = PropsOf<typeof Touchable> & {
47
+ visible: boolean
48
+ wrapperProps?: PropsOf<typeof View>
49
+ variants?: ComponentVariants<typeof BackdropStyles>['variants']
50
+ styles?: StylesOf<BackdropComposition>
51
+ }
52
+
53
+ export const Backdrop = (backdropProps:BackdropProps) => {
54
+ const { variants = [], styles = {}, visible, children, wrapperProps = {}, ...props } = backdropProps
55
+
56
+ const variantStyles = useDefaultComponentStyle<'u:Backdrop', typeof BackdropStyles>('u:Backdrop', {
57
+ variants,
58
+ rootElement: 'wrapper',
59
+ styles,
60
+ transform: StyleSheet.flatten,
61
+ })
62
+
63
+ const animationStates = useStaticAnimationStyles(variantStyles, ['wrapper:hidden', 'wrapper:visible'])
64
+
65
+ const animation = useDynamicAnimation(() => {
66
+ return visible ? animationStates['wrapper:visible'] : animationStates['wrapper:hidden']
67
+ })
68
+
69
+ onUpdate(() => {
70
+ animation.animateTo(visible ? animationStates['wrapper:visible'] : animationStates['wrapper:hidden'])
71
+ }, [visible, animationStates])
72
+
73
+ return <View pointerEvents={visible ? 'auto' : 'none' } animated style={variantStyles.wrapper} state={animation} {...wrapperProps}>
74
+ <Touchable feedbackVariant='none' style={variantStyles.touchable} {...props} />
75
+ {children}
76
+ </View>
77
+ }
@@ -6,6 +6,7 @@ import {
6
6
  ButtonComposition,
7
7
  ButtonParts,
8
8
  IconPlaceholder,
9
+ GetRefType,
9
10
  } from '@codeleap/common'
10
11
  import { forwardRef } from 'react'
11
12
  import { StylesOf } from '../types/utility'
@@ -13,7 +14,7 @@ import { Text } from './Text'
13
14
  import { Touchable, TouchableProps } from './Touchable'
14
15
  import { Icon } from './Icon'
15
16
  import { ActivityIndicator } from './ActivityIndicator'
16
- import { StyleSheet, TouchableOpacity } from 'react-native'
17
+ import { StyleSheet, TouchableOpacity, View } from 'react-native'
17
18
 
18
19
  type ChildProps = {
19
20
  styles: StylesOf<ButtonParts>
@@ -33,7 +34,7 @@ export type ButtonProps = Omit<TouchableProps, 'variants'> &
33
34
  children?: React.ReactNode | ((props: ChildProps) => React.ReactNode)
34
35
  }
35
36
 
36
- export const Button = forwardRef<TouchableOpacity, ButtonProps>((buttonProps, ref) => {
37
+ export const Button = forwardRef<GetRefType<TouchableProps['ref']>, ButtonProps>((buttonProps, ref) => {
37
38
  const {
38
39
  variants = [],
39
40
  children,
@@ -112,11 +112,11 @@ export const FileInput = forwardRef<
112
112
  if (warn) {
113
113
  // NOTE yeah, it should not be both of course but just logger.* isn't showing for some reason
114
114
  logger.warn(err)
115
- console.warn(err)
115
+
116
116
  } else {
117
117
  // NOTE yeah, it should not be both of course but just logger.* isn't showing for some reason
118
118
  logger.error(err)
119
- console.warn(err)
119
+
120
120
  if (onError) {
121
121
  onError(err)
122
122
  } else {
@@ -11,6 +11,7 @@ import {
11
11
  Image as NativeImage,
12
12
  ImageStyle,
13
13
  StyleProp,
14
+ StyleSheet,
14
15
  TextStyle,
15
16
  ViewStyle,
16
17
  } from 'react-native'
@@ -35,14 +36,14 @@ export const ImageComponent: React.FC<ImageProps> = (props) => {
35
36
 
36
37
  const variantStyles = useDefaultComponentStyle('Image', { variants })
37
38
 
38
- const styles = [variantStyles.wrapper, style]
39
+ const styles = StyleSheet.flatten([variantStyles.wrapper, style])
39
40
 
40
41
  if (fast) {
41
42
  return (
42
43
  <FastImage
43
44
  style={styles}
44
45
  // @ts-ignore
45
- tintColor={style?.tintColor}
46
+ tintColor={styles?.tintColor}
46
47
  resizeMode={FastImage.resizeMode[resizeMode || 'contain']}
47
48
  {...imageProps}
48
49
  />
@@ -6,6 +6,7 @@ import {
6
6
  useDefaultComponentStyle,
7
7
  usePrevious,
8
8
  useCodeleapContext,
9
+ TypeGuards,
9
10
  } from '@codeleap/common'
10
11
  import {
11
12
 
@@ -13,13 +14,29 @@ import {
13
14
  // @ts-ignore
14
15
  } from 'react-native-keyboard-aware-scroll-view'
15
16
 
16
- import { RefreshControl, FlatList, FlatListProps as RNFlatListProps } from 'react-native'
17
+ import { RefreshControl, FlatList, FlatListProps as RNFlatListProps, ListRenderItemInfo } from 'react-native'
17
18
  import { View, ViewProps } from './View'
18
19
  import { EmptyPlaceholder, EmptyPlaceholderProps } from './EmptyPlaceholder'
19
-
20
- export type FlatListProps<T = any> = RNFlatListProps<T> &
20
+ import { ActivityIndicator } from './ActivityIndicator'
21
+ import { Text } from './Text'
22
+ export type DataboundFlatListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout'
23
+
24
+ export type ReplaceFlatlistProps<P, T> = Omit<P, DataboundFlatListPropsTypes> & {
25
+ data: T[]
26
+ keyExtractor?: (item: T, index: number) => string
27
+ renderItem: (data: ListRenderItemInfo<T>) => React.ReactElement
28
+ onRefresh?: () => void
29
+ getItemLayout?: ((
30
+ data:T,
31
+ index: number,
32
+ ) => { length: number; offset: number; index: number })
33
+ }
34
+
35
+ export type FlatListProps<
36
+ T = any[],
37
+ Data = T extends Array<infer D> ? D : never
38
+ > =RNFlatListProps<Data> &
21
39
  ViewProps & {
22
- onRefresh?: () => void
23
40
  refreshTimeout?: number
24
41
  changeData?: any
25
42
  separators?: boolean
@@ -112,5 +129,27 @@ const ListCP = forwardRef<FlatList, FlatListProps>(
112
129
  },
113
130
  )
114
131
 
115
- export const List = ListCP as (<T = any>(props: FlatListProps<T>) => JSX.Element)
132
+ export type PaginationIndicatorProps = {
133
+ isFetching?: boolean
134
+ hasMore?: boolean
135
+ noMoreItemsText: React.ReactChild
136
+ activityIndicator?: JSX.Element
137
+ }
138
+
139
+ export const PaginationIndicator = ({ hasMore, isFetching, noMoreItemsText, activityIndicator }: PaginationIndicatorProps) => {
140
+ if (isFetching) {
141
+ return activityIndicator || <ActivityIndicator variants={['center', 'marginVertical:3']}/>
142
+ }
143
+ if (!hasMore) {
144
+ if (TypeGuards.isString(noMoreItemsText) || TypeGuards.isNumber(noMoreItemsText)) {
145
+ return <Text variants={['h4', 'marginVertical:3', 'textCenter', 'fullWidth']} text={noMoreItemsText.toString()}/>
146
+ }
147
+ return noMoreItemsText
148
+ }
149
+ return null
150
+ }
151
+
152
+ export type ListComponentType = <T extends any[] = any[]>(props: FlatListProps<T>) => React.ReactElement
153
+
154
+ export const List = ListCP as ListComponentType
116
155
 
@@ -1,11 +1,13 @@
1
1
  import * as React from 'react'
2
- import { View, ViewProps, AnimatedView } from '../View'
2
+ import { View, ViewProps } from '../View'
3
3
  import { Button, ButtonProps } from '../Button'
4
4
  import { Scroll } from '../Scroll'
5
5
  import {
6
- capitalize,
7
6
  ComponentVariants,
7
+ getNestedStylesByKey,
8
8
  IconPlaceholder,
9
+ onUpdate,
10
+ TypeGuards,
9
11
  useDefaultComponentStyle,
10
12
  } from '@codeleap/common'
11
13
  import {
@@ -16,9 +18,10 @@ import {
16
18
  import { StyleSheet } from 'react-native'
17
19
  import { StylesOf } from '../../types/utility'
18
20
 
19
- import { Touchable } from '../Touchable'
21
+ import { useDynamicAnimation } from 'moti'
22
+ import { Backdrop } from '../Backdrop'
23
+ import { useStaticAnimationStyles } from '../../utils/hooks'
20
24
  import { Text } from '../Text'
21
- import { Animated } from '../Animated'
22
25
 
23
26
  export * from './styles'
24
27
 
@@ -32,7 +35,7 @@ export type ModalProps = Omit<ViewProps, 'variants' | 'styles'> & {
32
35
  closable?: boolean
33
36
  footer?: React.ReactNode
34
37
  title?: React.ReactNode
35
- debugName?: string
38
+ debugName: string
36
39
  closeIconName?: IconPlaceholder
37
40
  visible: boolean
38
41
  toggle?: () => void
@@ -61,7 +64,7 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
61
64
  ...props
62
65
  } = modalProps
63
66
 
64
- const variantStyles = useDefaultComponentStyle('Modal', {
67
+ const variantStyles = useDefaultComponentStyle('u:Modal', {
65
68
  variants: variants as any,
66
69
  transform: StyleSheet.flatten,
67
70
  styles,
@@ -71,61 +74,46 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
71
74
  const s = [
72
75
  variantStyles[key],
73
76
  styles[key],
74
- visible ? variantStyles[key + ':visible'] : {},
75
- visible ? styles[key + ':visible'] : {},
76
77
  ]
77
78
 
78
- return s
79
+ return StyleSheet.flatten(s)
79
80
  }
81
+ const buttonStyles = React.useMemo(() => getNestedStylesByKey('closeButton', variantStyles), [variantStyles])
80
82
 
81
- const buttonStyles = React.useMemo(() => {
82
- const buttonEntries = {}
83
+ const boxAnimationStates = useStaticAnimationStyles(variantStyles, ['box:hidden', 'box:visible'])
83
84
 
84
- for (const [key, style] of Object.entries(variantStyles)) {
85
- if (key.startsWith('closeButton')) {
86
- buttonEntries[capitalize(key.replace('closeButton', ''), true)] = style
87
- }
88
- }
89
- return buttonEntries
90
- }, [variantStyles])
85
+ const boxAnimation = useDynamicAnimation(() => {
86
+ return visible ? boxAnimationStates['box:visible'] : boxAnimationStates['box:hidden']
87
+ })
91
88
 
92
- const boxAnimation = {
93
- hidden: {
94
- ...variantStyles['box:pose'],
95
- ...styles['box:pose'],
96
- },
97
- visible: {
98
- ...variantStyles['box:pose:visible'],
99
- ...styles['box:pose:visible'],
100
- },
101
- }
102
-
103
- const wrapperStyle = StyleSheet.flatten(getStyles('wrapper'))
89
+ onUpdate(() => {
90
+ boxAnimation.animateTo(visible ? boxAnimationStates['box:visible'] : boxAnimationStates['box:hidden'])
91
+ }, [visible])
92
+ const wrapperStyle = getStyles('wrapper')
104
93
  return (
105
- <View
106
- style={[wrapperStyle, { zIndex: typeof zIndex === 'number' ? zIndex : wrapperStyle?.zIndex }]}
107
- pointerEvents={visible ? 'auto' : 'none'}
108
- >
109
- <AnimatedView style={getStyles('overlay')} transition={'opacity'} />
94
+ <View style={[wrapperStyle, { zIndex: TypeGuards.isNumber(zIndex) ? zIndex : wrapperStyle?.zIndex }]} pointerEvents={visible ? 'auto' : 'none'}>
95
+
110
96
  <Scroll
111
97
  style={getStyles('innerWrapper')}
112
98
  contentContainerStyle={getStyles('innerWrapperScroll')}
113
99
  scrollEnabled={scroll}
114
100
  keyboardAware={keyboardAware}
115
101
  >
116
- {dismissOnBackdrop && (
117
- <Touchable
118
- debugName={`${debugName} modal backdrop`}
119
- activeOpacity={1}
120
- onPress={() => toggle()}
121
- style={getStyles('touchableBackdrop')}
122
- />
123
- )}
124
- <Animated
125
- component='View'
126
- config={boxAnimation}
127
- pose={visible ? 'visible' : 'hidden'}
102
+ <Backdrop visible={visible} debugName={`Modal ${debugName} backdrop`} styles={{
103
+ 'wrapper:hidden': variantStyles['backdrop:hidden'],
104
+ 'wrapper:visible': variantStyles['backdrop:visible'],
105
+ wrapper: variantStyles.backdrop,
106
+ }} onPress={(dismissOnBackdrop && closable) ? toggle : (() => {})}
107
+ wrapperProps={{
108
+ transition: { ...variantStyles['backdrop:transition'] },
109
+ }}
110
+ />
111
+ <View
112
+ animated
113
+ state={boxAnimation}
128
114
  style={getStyles('box')}
115
+ transition={{ ...variantStyles['box:transition'] }}
116
+ {...props}
129
117
  >
130
118
  {(title || showClose) && (
131
119
  <View style={getStyles('header')}>
@@ -135,7 +123,7 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
135
123
  title
136
124
  )}
137
125
 
138
- {showClose && closable && (
126
+ {(showClose && closable) && (
139
127
  <Button
140
128
  debugName={`${debugName} modal close button`}
141
129
  icon={closeIconName as IconPlaceholder}
@@ -153,9 +141,10 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
153
141
  {typeof footer === 'string' ? <Text text={footer} /> : footer}
154
142
  </View>
155
143
  )}
156
- </Animated>
144
+ </View>
157
145
  </Scroll>
158
146
  </View>
147
+
159
148
  )
160
149
  }
161
150
 
@@ -1,51 +1,40 @@
1
1
  import {
2
+ assignTextStyle,
2
3
  ButtonComposition,
3
4
  createDefaultVariantFactory,
4
5
  includePresets,
5
- ModalStyles,
6
- assignTextStyle,
7
6
  } from '@codeleap/common'
8
7
 
9
- export const modalTransition = {
10
- duration: 150,
11
- ease: 'easeOut',
12
- useNativeDriver: false,
13
- }
8
+ export type AnimatableParts = 'box' | 'backdrop'
14
9
 
15
10
  export type MobileModalParts =
11
+ | AnimatableParts
16
12
  | 'wrapper'
17
- | 'overlay'
18
13
  | 'innerWrapper'
19
14
  | 'innerWrapperScroll'
20
- | 'box'
21
- | 'footer'
22
15
  | 'body'
16
+ | 'footer'
23
17
  | 'header'
24
- | 'touchableBackdrop'
25
- | 'box:pose'
26
18
  | 'title'
27
19
  | `closeButton${Capitalize<ButtonComposition>}`
28
20
 
29
21
  export type MobileModalComposition =
30
22
  | MobileModalParts
31
- | `${MobileModalParts}:visible`
23
+ | `${AnimatableParts}:visible`
24
+ | `${AnimatableParts}:hidden`
25
+ | `${AnimatableParts}:transition`
32
26
 
33
27
  const createModalStyle = createDefaultVariantFactory<MobileModalComposition>()
34
28
 
35
- const presets = includePresets((style) => createModalStyle(() => ({ body: style })),
36
- )
37
-
38
- const defaultModalStyles = ModalStyles
29
+ const presets = includePresets((style) => createModalStyle(() => ({ body: style })))
39
30
 
40
31
  export const MobileModalStyles = {
41
- ...defaultModalStyles,
32
+
42
33
  ...presets,
43
34
  default: createModalStyle((Theme) => {
44
35
  const fullSize = {
45
36
  ...Theme.presets.whole,
46
37
  position: 'absolute',
47
- width: Theme?.values?.width,
48
- height: Theme?.values?.height,
49
38
  }
50
39
 
51
40
  return {
@@ -54,16 +43,34 @@ export const MobileModalStyles = {
54
43
 
55
44
  ...fullSize,
56
45
  },
57
-
58
- overlay: {
59
- opacity: 0,
46
+ 'box:transition': {
47
+ scale: {
48
+ duration: Theme.values.transitions.modal.duration,
49
+ type: 'timing',
50
+ },
51
+ opacity: {
52
+ duration: Theme.values.transitions.modal.duration,
53
+ type: 'timing',
54
+ },
55
+ },
56
+ 'backdrop:transition': {
57
+ opacity: {
58
+ duration: Theme.values.transitions.modal.duration,
59
+ type: 'timing',
60
+ },
61
+ },
62
+ backdrop: {
60
63
 
61
64
  backgroundColor: Theme.colors.black,
62
65
  ...fullSize,
63
66
  },
64
- 'overlay:visible': {
67
+
68
+ 'backdrop:visible': {
65
69
  opacity: 0.5,
66
70
  },
71
+ 'backdrop:hidden': {
72
+ opacity: 0,
73
+ },
67
74
  innerWrapper: {},
68
75
  innerWrapperScroll: {
69
76
  display: 'flex',
@@ -77,18 +84,15 @@ export const MobileModalStyles = {
77
84
  borderRadius: Theme.borderRadius.medium,
78
85
  ...Theme.spacing.padding(2),
79
86
  },
80
- touchableBackdrop: {
81
- ...fullSize,
82
- },
83
- 'box:pose': {
87
+
88
+ 'box:hidden': {
84
89
  opacity: 0,
85
90
  scale: 0.8,
86
- transition: modalTransition,
91
+
87
92
  },
88
- 'box:pose:visible': {
93
+ 'box:visible': {
89
94
  opacity: 1,
90
95
  scale: 1,
91
- transition: modalTransition,
92
96
  },
93
97
  header: {
94
98
  flexDirection: 'row',
@@ -2,6 +2,7 @@ import * as React from 'react'
2
2
  import {
3
3
  ComponentVariants,
4
4
  IconPlaceholder,
5
+ onUpdate,
5
6
  OverlayComposition,
6
7
  OverlayStyles,
7
8
  useDefaultComponentStyle,
@@ -13,7 +14,8 @@ import { Button } from './Button'
13
14
  import { View } from './View'
14
15
  import { StylesOf } from '../types/utility'
15
16
  import { StyleSheet, ViewProps } from 'react-native'
16
- import { AnimatedTouchable } from './Touchable'
17
+ import { AnimatedTouchable, Touchable } from './Touchable'
18
+ import { useAnimationState } from 'moti'
17
19
 
18
20
  export type OverlayProps = ViewProps & {
19
21
  title?: ReactNode
@@ -43,21 +45,28 @@ export const Overlay: React.FC<OverlayProps> = (overlayProps) => {
43
45
  variants: variants as any,
44
46
  }) as StylesOf<OverlayComposition>
45
47
 
46
- const touchableStyle = [
48
+ const animation = useAnimationState({
49
+ visible: variantStyles['wrapper:visible'],
50
+ hidden: styles['wrapper:visible'],
51
+ })
52
+
53
+ onUpdate(() => {
54
+ animation.transitionTo(visible ? 'visible' : 'hidden')
55
+ }, [visible])
56
+
57
+ const viewStyles = [
47
58
  variantStyles.wrapper,
48
59
  styles.wrapper,
49
- visible && variantStyles['wrapper:visible'],
50
- visible && styles['wrapper:visible'],
51
60
  ]
52
61
 
53
62
  return (
54
- <AnimatedTouchable
55
- // @ts-ignore
56
- transition={'opacity'}
57
- style={touchableStyle}
58
- {...props}
59
- >
60
- <View>
63
+ <View animated state={animation} style={viewStyles}>
64
+ <Touchable
65
+
66
+ feedbackVariant='none'
67
+ variants={['whole', 'full', 'absolute']}
68
+ {...props}
69
+ >
61
70
  {(title || showClose) && (
62
71
  <View style={variantStyles.header}>
63
72
  <InputLabel style={variantStyles.title} label={title} />
@@ -71,7 +80,7 @@ export const Overlay: React.FC<OverlayProps> = (overlayProps) => {
71
80
  )}
72
81
  </View>
73
82
  )}
74
- </View>
75
- </AnimatedTouchable>
83
+ </Touchable>
84
+ </View>
76
85
  )
77
86
  }
@@ -9,12 +9,14 @@ import {
9
9
  } from '@codeleap/common'
10
10
 
11
11
  import {
12
- KeyboardAwareScrollViewProps,
13
12
  KeyboardAwareScrollView as KBDView,
14
13
  // @ts-ignore
15
14
  } from 'react-native-keyboard-aware-scroll-view'
16
15
  import { RefreshControl, ScrollView, ScrollViewProps, ViewStyle } from 'react-native'
17
16
  import { ViewProps } from './View'
17
+ import { KeyboardAwareScrollViewTypes } from '../modules'
18
+
19
+ type KeyboardAwareScrollViewProps = KeyboardAwareScrollViewTypes.KeyboardAwareScrollViewProps
18
20
 
19
21
  export type ScrollProps = KeyboardAwareScrollViewProps &
20
22
  ViewProps & {