@codeleap/mobile 2.1.9 → 2.2.1
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/dist/components/AutoComplete/styles.js +1 -2
- package/dist/components/AutoComplete/styles.js.map +1 -1
- package/dist/components/Drawer/index.js +13 -2
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Drawer/styles.js +3 -5
- package/dist/components/Drawer/styles.js.map +1 -1
- package/dist/components/EmptyPlaceholder/styles.js +1 -1
- package/dist/components/EmptyPlaceholder/styles.js.map +1 -1
- package/dist/components/Grid/index.d.ts +3 -1
- package/dist/components/Grid/index.js +19 -4
- package/dist/components/Grid/index.js.map +1 -1
- package/dist/components/ImageView/Spotlight.js +1 -2
- package/dist/components/ImageView/Spotlight.js.map +1 -1
- package/dist/components/List/index.d.ts +2 -1
- package/dist/components/List/index.js +19 -5
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Modal/index.d.ts +4 -2
- package/dist/components/Modal/index.js +11 -3
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/styles.d.ts +1 -1
- package/dist/components/Modal/styles.js +15 -15
- package/dist/components/Modal/styles.js.map +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/Pager/styles.js +7 -7
- package/dist/components/Pager/styles.js.map +1 -1
- package/dist/components/Scroll/index.d.ts +4 -2
- package/dist/components/Scroll/index.js +20 -6
- package/dist/components/Scroll/index.js.map +1 -1
- package/dist/components/SegmentedControl/index.js +3 -1
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/Select/index.js +13 -1
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.js +2 -0
- package/dist/components/Select/styles.js.map +1 -1
- package/dist/components/Select/types.d.ts +2 -0
- package/dist/components/legacy/Modal/index.d.ts +2 -1
- package/dist/components/legacy/Modal/index.js +1 -1
- package/dist/components/legacy/Modal/index.js.map +1 -1
- package/dist/components/legacy/Modal/styles.js +9 -9
- package/dist/components/legacy/Modal/styles.js.map +1 -1
- package/dist/utils/KeyboardAware/index.d.ts +1 -0
- package/dist/utils/KeyboardAware/index.js +1 -0
- package/dist/utils/KeyboardAware/index.js.map +1 -1
- package/dist/utils/KeyboardAware/keyboardHooks.d.ts +30 -0
- package/dist/utils/KeyboardAware/keyboardHooks.js +113 -0
- package/dist/utils/KeyboardAware/keyboardHooks.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.d.ts +1 -1
- package/dist/utils/hooks.d.ts +1 -0
- package/dist/utils/hooks.js +17 -1
- package/dist/utils/hooks.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AutoComplete/styles.ts +1 -2
- package/src/components/Drawer/index.tsx +11 -1
- package/src/components/Drawer/styles.ts +4 -4
- package/src/components/EmptyPlaceholder/styles.ts +1 -1
- package/src/components/Grid/index.tsx +28 -18
- package/src/components/ImageView/Spotlight.tsx +0 -1
- package/src/components/List/index.tsx +31 -24
- package/src/components/Modal/index.tsx +18 -7
- package/src/components/Modal/styles.ts +38 -27
- package/src/components/MultiSelect/index.tsx +1 -1
- package/src/components/Pager/styles.ts +7 -7
- package/src/components/Scroll/index.tsx +37 -24
- package/src/components/SegmentedControl/index.tsx +3 -0
- package/src/components/Select/index.tsx +13 -7
- package/src/components/Select/styles.ts +2 -0
- package/src/components/Select/types.ts +2 -0
- package/src/components/legacy/Modal/index.tsx +3 -2
- package/src/components/legacy/Modal/styles.ts +17 -17
- package/src/utils/KeyboardAware/index.ts +1 -0
- package/src/utils/KeyboardAware/keyboardHooks.ts +155 -0
- package/src/utils/hooks.ts +19 -1
|
@@ -19,8 +19,7 @@ export const AutoCompleteStyles = {
|
|
|
19
19
|
...theme.presets.alignStart,
|
|
20
20
|
},
|
|
21
21
|
box: {
|
|
22
|
-
|
|
23
|
-
maxHeight: theme.values.height * 0.85,
|
|
22
|
+
maxHeight: theme.values.window.height * 0.85,
|
|
24
23
|
},
|
|
25
24
|
listContent: {
|
|
26
25
|
...theme.presets.safeAreaBottom(0, true),
|
|
@@ -8,7 +8,7 @@ export * from './styles'
|
|
|
8
8
|
export type DrawerProps = Omit<ModalProps, 'variants'> & ComponentVariants<typeof DrawerStyles>
|
|
9
9
|
|
|
10
10
|
export const Drawer:React.FC<DrawerProps> = (props) => {
|
|
11
|
-
const { variants, styles, ...modalProps } = props
|
|
11
|
+
const { variants, styles, scrollProps, ...modalProps } = props
|
|
12
12
|
|
|
13
13
|
const variantStyles = useDefaultComponentStyle('u:Drawer', {
|
|
14
14
|
variants,
|
|
@@ -18,7 +18,17 @@ export const Drawer:React.FC<DrawerProps> = (props) => {
|
|
|
18
18
|
|
|
19
19
|
return <Modal
|
|
20
20
|
styles={variantStyles}
|
|
21
|
+
scroll={false}
|
|
21
22
|
|
|
22
23
|
{...modalProps}
|
|
24
|
+
scrollProps={{
|
|
25
|
+
...scrollProps,
|
|
26
|
+
keyboardAware: {
|
|
27
|
+
adapt: 'height',
|
|
28
|
+
baseStyleProp: 'style',
|
|
29
|
+
|
|
30
|
+
...scrollProps?.keyboardAware,
|
|
31
|
+
},
|
|
32
|
+
}}
|
|
23
33
|
/>
|
|
24
34
|
}
|
|
@@ -13,15 +13,15 @@ export const DrawerStyles = {
|
|
|
13
13
|
...defaultStyle,
|
|
14
14
|
box: {
|
|
15
15
|
width: '100%',
|
|
16
|
-
maxHeight: theme.values.height * 0.
|
|
17
|
-
|
|
16
|
+
maxHeight: theme.values.window.height * 0.99,
|
|
17
|
+
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
innerWrapper: {
|
|
20
20
|
...theme.presets.justifyEnd,
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
'box:hidden': {
|
|
24
|
-
translateY: theme.values.height,
|
|
24
|
+
translateY: theme.values.window.height,
|
|
25
25
|
opacity: 1,
|
|
26
26
|
scale: 1,
|
|
27
27
|
},
|
|
@@ -11,7 +11,7 @@ import { View, ViewProps } from '../View'
|
|
|
11
11
|
import { EmptyPlaceholder, EmptyPlaceholderProps } from '../EmptyPlaceholder'
|
|
12
12
|
import { GridComposition, GridStyles } from './styles'
|
|
13
13
|
import { StylesOf } from '../../types'
|
|
14
|
-
import {
|
|
14
|
+
import { GetKeyboardAwarePropsOptions, useKeyboardAwareView } from '../../utils'
|
|
15
15
|
|
|
16
16
|
export type DataboundFlatGridPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout'
|
|
17
17
|
|
|
@@ -28,8 +28,6 @@ export type ReplaceFlatGridProps<P, T> = Omit<P, DataboundFlatGridPropsTypes> &
|
|
|
28
28
|
|
|
29
29
|
export * from './styles'
|
|
30
30
|
|
|
31
|
-
const KeyboardAwareFlatGrid = listenToKeyboardEvents(FlatGrid)
|
|
32
|
-
|
|
33
31
|
export type GridProps<
|
|
34
32
|
T = any[],
|
|
35
33
|
Data = T extends Array<infer D> ? D : never
|
|
@@ -37,7 +35,8 @@ export type GridProps<
|
|
|
37
35
|
Omit<ViewProps, 'variants'> & {
|
|
38
36
|
separators?: boolean
|
|
39
37
|
placeholder?: EmptyPlaceholderProps
|
|
40
|
-
keyboardAware?:
|
|
38
|
+
keyboardAware?: GetKeyboardAwarePropsOptions
|
|
39
|
+
debugName?: string
|
|
41
40
|
styles?: StylesOf<GridComposition>
|
|
42
41
|
refreshControlProps?: Partial<RefreshControlProps>
|
|
43
42
|
} & ComponentVariants<typeof GridStyles>
|
|
@@ -51,7 +50,8 @@ const GridCP = forwardRef<FlatGrid, GridProps>(
|
|
|
51
50
|
onRefresh,
|
|
52
51
|
refreshing,
|
|
53
52
|
placeholder,
|
|
54
|
-
keyboardAware
|
|
53
|
+
keyboardAware,
|
|
54
|
+
debugName,
|
|
55
55
|
refreshControlProps = {},
|
|
56
56
|
...props
|
|
57
57
|
} = flatGridProps
|
|
@@ -73,16 +73,15 @@ const GridCP = forwardRef<FlatGrid, GridProps>(
|
|
|
73
73
|
const isEmpty = !props.data || !props.data.length
|
|
74
74
|
const separator = !isEmpty && separatorProp == true && renderSeparator
|
|
75
75
|
|
|
76
|
-
const Component = keyboardAware ? KeyboardAwareFlatGrid : FlatGrid
|
|
77
76
|
const refreshStyles = StyleSheet.flatten([variantStyles.refreshControl, styles.refreshControl])
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
const Component = FlatGrid
|
|
78
|
+
|
|
79
|
+
const _gridProps = {
|
|
80
|
+
style: [variantStyles.wrapper, style],
|
|
81
|
+
contentContainerStyle: variantStyles.content,
|
|
82
|
+
ref: ref as unknown as FlatGrid,
|
|
83
|
+
ItemSeparatorComponent: separator,
|
|
84
|
+
refreshControl:
|
|
86
85
|
!!onRefresh && (
|
|
87
86
|
<RefreshControl
|
|
88
87
|
refreshing={refreshing}
|
|
@@ -91,11 +90,22 @@ const GridCP = forwardRef<FlatGrid, GridProps>(
|
|
|
91
90
|
colors={[refreshStyles?.color]}
|
|
92
91
|
{...refreshControlProps}
|
|
93
92
|
/>
|
|
94
|
-
)
|
|
95
|
-
}
|
|
93
|
+
),
|
|
96
94
|
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
ListEmptyComponent: <EmptyPlaceholder {...placeholder}/>,
|
|
96
|
+
...props,
|
|
97
|
+
}
|
|
98
|
+
const keyboard = useKeyboardAwareView({
|
|
99
|
+
debugName,
|
|
100
|
+
})
|
|
101
|
+
const gridProps = keyboard.getKeyboardAwareProps(_gridProps, {
|
|
102
|
+
baseStyleProp: 'contentContainerStyle',
|
|
103
|
+
adapt: 'paddingBottom',
|
|
104
|
+
...keyboardAware,
|
|
105
|
+
})
|
|
106
|
+
return (
|
|
107
|
+
<Component
|
|
108
|
+
{...gridProps}
|
|
99
109
|
/>
|
|
100
110
|
)
|
|
101
111
|
},
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
useDefaultComponentStyle,
|
|
6
6
|
|
|
7
7
|
ComponentVariants,
|
|
8
|
+
useCallback,
|
|
8
9
|
} from '@codeleap/common'
|
|
9
10
|
|
|
10
11
|
import { RefreshControl, FlatList, FlatListProps as RNFlatListProps, ListRenderItemInfo, StyleSheet, RefreshControlProps } from 'react-native'
|
|
@@ -12,7 +13,7 @@ import { View, ViewProps } from '../View'
|
|
|
12
13
|
import { EmptyPlaceholder, EmptyPlaceholderProps } from '../EmptyPlaceholder'
|
|
13
14
|
import { ListComposition, ListStyles } from './styles'
|
|
14
15
|
import { StylesOf } from '../../types'
|
|
15
|
-
import {
|
|
16
|
+
import { GetKeyboardAwarePropsOptions, useKeyboardAwareView } from '../../utils'
|
|
16
17
|
|
|
17
18
|
export type DataboundFlatListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout'
|
|
18
19
|
|
|
@@ -37,7 +38,7 @@ export type FlatListProps<
|
|
|
37
38
|
Omit<ViewProps, 'variants'> & {
|
|
38
39
|
separators?: boolean
|
|
39
40
|
placeholder?: EmptyPlaceholderProps
|
|
40
|
-
keyboardAware?:
|
|
41
|
+
keyboardAware?: GetKeyboardAwarePropsOptions
|
|
41
42
|
styles?: StylesOf<ListComposition>
|
|
42
43
|
refreshControlProps?: Partial<RefreshControlProps>
|
|
43
44
|
} & ComponentVariants<typeof ListStyles>
|
|
@@ -52,7 +53,7 @@ const ListCP = forwardRef<FlatList, FlatListProps>(
|
|
|
52
53
|
component,
|
|
53
54
|
refreshing,
|
|
54
55
|
placeholder,
|
|
55
|
-
keyboardAware
|
|
56
|
+
keyboardAware,
|
|
56
57
|
refreshControlProps = {},
|
|
57
58
|
...props
|
|
58
59
|
} = flatListProps
|
|
@@ -64,39 +65,45 @@ const ListCP = forwardRef<FlatList, FlatListProps>(
|
|
|
64
65
|
|
|
65
66
|
})
|
|
66
67
|
|
|
67
|
-
const renderSeparator = () => {
|
|
68
|
+
const renderSeparator = useCallback(() => {
|
|
68
69
|
return (
|
|
69
70
|
<View variants={['separator']}></View>
|
|
70
71
|
)
|
|
71
|
-
}
|
|
72
|
+
}, [])
|
|
72
73
|
|
|
73
74
|
const separatorProp = props.separators
|
|
74
75
|
const isEmpty = !props.data || !props.data.length
|
|
75
76
|
const separator = !isEmpty && separatorProp == true && renderSeparator
|
|
76
77
|
|
|
77
|
-
const Component:any = component ||
|
|
78
|
+
const Component:any = component || FlatList
|
|
78
79
|
const refreshStyles = StyleSheet.flatten([variantStyles.refreshControl, styles.refreshControl])
|
|
79
80
|
|
|
81
|
+
const _listProps = {
|
|
82
|
+
style: [variantStyles.wrapper, style],
|
|
83
|
+
contentContainerStyle: variantStyles.content,
|
|
84
|
+
ref: ref as unknown as FlatList,
|
|
85
|
+
ItemSeparatorComponent: separator,
|
|
86
|
+
refreshControl: !!onRefresh && (
|
|
87
|
+
<RefreshControl
|
|
88
|
+
refreshing={refreshing}
|
|
89
|
+
onRefresh={onRefresh}
|
|
90
|
+
tintColor={refreshStyles?.color}
|
|
91
|
+
colors={[refreshStyles?.color]}
|
|
92
|
+
{...refreshControlProps}
|
|
93
|
+
/>
|
|
94
|
+
),
|
|
95
|
+
ListEmptyComponent: <EmptyPlaceholder {...placeholder}/>,
|
|
96
|
+
...props,
|
|
97
|
+
}
|
|
98
|
+
const keyboard = useKeyboardAwareView()
|
|
99
|
+
const listProps = keyboard.getKeyboardAwareProps(_listProps, {
|
|
100
|
+
adapt: 'paddingBottom',
|
|
101
|
+
baseStyleProp: 'contentContainerStyle',
|
|
102
|
+
...keyboardAware,
|
|
103
|
+
})
|
|
80
104
|
return (
|
|
81
105
|
<Component
|
|
82
|
-
|
|
83
|
-
contentContainerStyle={variantStyles.content}
|
|
84
|
-
ref={ref as unknown as FlatList}
|
|
85
|
-
ItemSeparatorComponent={separator}
|
|
86
|
-
refreshControl={
|
|
87
|
-
!!onRefresh && (
|
|
88
|
-
<RefreshControl
|
|
89
|
-
refreshing={refreshing}
|
|
90
|
-
onRefresh={onRefresh}
|
|
91
|
-
tintColor={refreshStyles?.color}
|
|
92
|
-
colors={[refreshStyles?.color]}
|
|
93
|
-
{...refreshControlProps}
|
|
94
|
-
/>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
ListEmptyComponent={<EmptyPlaceholder {...placeholder}/>}
|
|
99
|
-
{...props}
|
|
106
|
+
{...listProps}
|
|
100
107
|
/>
|
|
101
108
|
)
|
|
102
109
|
},
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getNestedStylesByKey,
|
|
8
8
|
IconPlaceholder,
|
|
9
9
|
onUpdate,
|
|
10
|
+
PropsOf,
|
|
10
11
|
TypeGuards,
|
|
11
12
|
useDefaultComponentStyle,
|
|
12
13
|
} from '@codeleap/common'
|
|
@@ -20,7 +21,7 @@ import { StylesOf } from '../../types/utility'
|
|
|
20
21
|
|
|
21
22
|
import { useDynamicAnimation } from 'moti'
|
|
22
23
|
import { Backdrop } from '../Backdrop'
|
|
23
|
-
import { useStaticAnimationStyles } from '../../utils/hooks'
|
|
24
|
+
import { useBackButton, useStaticAnimationStyles } from '../../utils/hooks'
|
|
24
25
|
import { Text, TextProps } from '../Text'
|
|
25
26
|
import { Touchable } from '../Touchable'
|
|
26
27
|
|
|
@@ -43,8 +44,9 @@ export type ModalProps = Omit<ViewProps, 'variants' | 'styles'> & {
|
|
|
43
44
|
zIndex?: number
|
|
44
45
|
scroll?: boolean
|
|
45
46
|
header?: React.ReactElement
|
|
46
|
-
|
|
47
|
+
closeOnHardwareBackPress?: boolean
|
|
47
48
|
renderHeader?: (props: ModalHeaderProps) => React.ReactElement
|
|
49
|
+
scrollProps?: PropsOf<typeof Scroll>
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
export type ModalHeaderProps = Omit<ModalProps, 'styles' | 'renderHeader'> & {
|
|
@@ -95,8 +97,9 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
95
97
|
debugName,
|
|
96
98
|
scroll = true,
|
|
97
99
|
renderHeader,
|
|
98
|
-
keyboardAware = true,
|
|
99
100
|
zIndex = null,
|
|
101
|
+
scrollProps = {},
|
|
102
|
+
closeOnHardwareBackPress = true,
|
|
100
103
|
...props
|
|
101
104
|
} = modalProps
|
|
102
105
|
|
|
@@ -127,7 +130,7 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
127
130
|
}, [visible])
|
|
128
131
|
const wrapperStyle = getStyles('wrapper')
|
|
129
132
|
const ScrollComponent = scroll ? Scroll : View
|
|
130
|
-
const scrollStyle = scroll ? getStyles('
|
|
133
|
+
const scrollStyle = scroll ? getStyles('scroll') : getStyles('innerWrapper')
|
|
131
134
|
|
|
132
135
|
const headerProps:ModalHeaderProps = {
|
|
133
136
|
...modalProps,
|
|
@@ -139,6 +142,13 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
139
142
|
}
|
|
140
143
|
const Header = renderHeader || DefaultHeader
|
|
141
144
|
|
|
145
|
+
useBackButton(() => {
|
|
146
|
+
if (visible && closeOnHardwareBackPress) {
|
|
147
|
+
toggle()
|
|
148
|
+
return true
|
|
149
|
+
}
|
|
150
|
+
}, [visible, toggle, closeOnHardwareBackPress])
|
|
151
|
+
|
|
142
152
|
return (
|
|
143
153
|
<View
|
|
144
154
|
style={[wrapperStyle, { zIndex: TypeGuards.isNumber(zIndex) ? zIndex : wrapperStyle?.zIndex }]}
|
|
@@ -156,9 +166,8 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
156
166
|
/>
|
|
157
167
|
<ScrollComponent
|
|
158
168
|
style={scrollStyle}
|
|
159
|
-
contentContainerStyle={getStyles('
|
|
160
|
-
|
|
161
|
-
keyboardAware={keyboardAware}
|
|
169
|
+
contentContainerStyle={getStyles('scrollContent')}
|
|
170
|
+
{...scrollProps}
|
|
162
171
|
>
|
|
163
172
|
{dismissOnBackdrop &&
|
|
164
173
|
<Touchable
|
|
@@ -168,6 +177,7 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
168
177
|
android_ripple={null}
|
|
169
178
|
noFeedback
|
|
170
179
|
/>}
|
|
180
|
+
|
|
171
181
|
<View
|
|
172
182
|
animated
|
|
173
183
|
state={boxAnimation}
|
|
@@ -185,6 +195,7 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
185
195
|
</View>
|
|
186
196
|
)}
|
|
187
197
|
</View>
|
|
198
|
+
|
|
188
199
|
</ScrollComponent>
|
|
189
200
|
</View>
|
|
190
201
|
|
|
@@ -11,7 +11,9 @@ export type ModalParts =
|
|
|
11
11
|
| AnimatableParts
|
|
12
12
|
| 'wrapper'
|
|
13
13
|
| 'innerWrapper'
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
| 'scrollContent'
|
|
16
|
+
| 'scroll'
|
|
15
17
|
| 'body'
|
|
16
18
|
| 'footer'
|
|
17
19
|
| 'header'
|
|
@@ -32,39 +34,41 @@ const presets = includePresets((style) => createModalStyle(() => ({ body: style
|
|
|
32
34
|
export const ModalStyles = {
|
|
33
35
|
|
|
34
36
|
...presets,
|
|
35
|
-
default: createModalStyle((
|
|
37
|
+
default: createModalStyle((theme) => {
|
|
36
38
|
const fullSize = {
|
|
37
|
-
...
|
|
39
|
+
...theme.presets.whole,
|
|
38
40
|
position: 'absolute',
|
|
39
|
-
width:
|
|
40
|
-
height:
|
|
41
|
+
width: '100%',
|
|
42
|
+
height: '100%',
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
return {
|
|
44
46
|
wrapper: {
|
|
45
47
|
zIndex: 1,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
height: theme.values.height,
|
|
49
|
+
width: theme.values.width,
|
|
50
|
+
...theme.presets.whole,
|
|
51
|
+
position: 'absolute',
|
|
48
52
|
},
|
|
49
53
|
'box:transition': {
|
|
50
54
|
scale: {
|
|
51
|
-
duration:
|
|
55
|
+
duration: theme.values.transitions.modal.duration,
|
|
52
56
|
type: 'timing',
|
|
53
57
|
},
|
|
54
58
|
opacity: {
|
|
55
|
-
duration:
|
|
59
|
+
duration: theme.values.transitions.modal.duration,
|
|
56
60
|
type: 'timing',
|
|
57
61
|
},
|
|
58
62
|
},
|
|
59
63
|
'backdrop:transition': {
|
|
60
64
|
opacity: {
|
|
61
|
-
duration:
|
|
65
|
+
duration: theme.values.transitions.modal.duration,
|
|
62
66
|
type: 'timing',
|
|
63
67
|
},
|
|
64
68
|
},
|
|
65
69
|
backdrop: {
|
|
66
70
|
|
|
67
|
-
backgroundColor:
|
|
71
|
+
backgroundColor: theme.colors.black,
|
|
68
72
|
...fullSize,
|
|
69
73
|
},
|
|
70
74
|
backdropTouchable: {
|
|
@@ -76,18 +80,25 @@ export const ModalStyles = {
|
|
|
76
80
|
'backdrop:hidden': {
|
|
77
81
|
opacity: 0,
|
|
78
82
|
},
|
|
79
|
-
innerWrapper: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
...
|
|
84
|
-
|
|
83
|
+
innerWrapper: {
|
|
84
|
+
...theme.presets.alignCenter,
|
|
85
|
+
...theme.presets.justifyCenter,
|
|
86
|
+
...theme.presets.fullHeight,
|
|
87
|
+
...theme.presets.fullWidth,
|
|
88
|
+
},
|
|
89
|
+
scroll: {
|
|
90
|
+
...fullSize,
|
|
91
|
+
},
|
|
92
|
+
scrollContent: {
|
|
93
|
+
...theme.presets.alignCenter,
|
|
94
|
+
...theme.presets.justifyCenter,
|
|
95
|
+
...theme.presets.full,
|
|
85
96
|
},
|
|
86
97
|
box: {
|
|
87
98
|
width: '80%',
|
|
88
|
-
backgroundColor:
|
|
89
|
-
borderRadius:
|
|
90
|
-
...
|
|
99
|
+
backgroundColor: theme.colors.background,
|
|
100
|
+
borderRadius: theme.borderRadius.medium,
|
|
101
|
+
...theme.spacing.padding(2),
|
|
91
102
|
},
|
|
92
103
|
|
|
93
104
|
'box:hidden': {
|
|
@@ -101,17 +112,17 @@ export const ModalStyles = {
|
|
|
101
112
|
},
|
|
102
113
|
header: {
|
|
103
114
|
flexDirection: 'row',
|
|
104
|
-
...
|
|
105
|
-
...
|
|
115
|
+
...theme.presets.justifySpaceBetween,
|
|
116
|
+
...theme.presets.alignCenter,
|
|
106
117
|
},
|
|
107
118
|
closeButtonWrapper: {
|
|
108
119
|
alignSelf: 'center',
|
|
109
|
-
...
|
|
120
|
+
...theme.spacing.marginLeft('auto'),
|
|
110
121
|
},
|
|
111
122
|
title: {
|
|
112
|
-
...
|
|
113
|
-
...assignTextStyle('h3')(
|
|
114
|
-
...
|
|
123
|
+
...theme.presets.textCenter,
|
|
124
|
+
...assignTextStyle('h3')(theme).text,
|
|
125
|
+
...theme.spacing.paddingBottom(1),
|
|
115
126
|
flex: 1,
|
|
116
127
|
},
|
|
117
128
|
}
|
|
@@ -128,7 +139,7 @@ export const ModalStyles = {
|
|
|
128
139
|
flex: 1,
|
|
129
140
|
borderRadius: 0,
|
|
130
141
|
width: theme.values.width,
|
|
131
|
-
height: theme.values.height,
|
|
142
|
+
height: theme.values.window.height,
|
|
132
143
|
...theme.presets.center,
|
|
133
144
|
},
|
|
134
145
|
})),
|
|
@@ -82,7 +82,7 @@ export const MultiSelect = <T extends string|number = string>(selectProps:MultiS
|
|
|
82
82
|
|
|
83
83
|
const isEmpty = value.length === 0
|
|
84
84
|
const showClearIcon = !isEmpty && clearable
|
|
85
|
-
const inputIcon = showClearIcon ?
|
|
85
|
+
const inputIcon = showClearIcon ? clearIconName : arrowIconName
|
|
86
86
|
|
|
87
87
|
const onPressInputIcon = () => {
|
|
88
88
|
if (showClearIcon) {
|
|
@@ -53,7 +53,7 @@ export const PagerStyles = {
|
|
|
53
53
|
...presets,
|
|
54
54
|
default: createPagerStyle((theme) => {
|
|
55
55
|
const width = theme.values.width
|
|
56
|
-
const height = theme.values.height * 0.8
|
|
56
|
+
const height = theme.values.window.height * 0.8
|
|
57
57
|
return {
|
|
58
58
|
...pagerAnimation(height, width, 'X'),
|
|
59
59
|
page: {
|
|
@@ -67,15 +67,15 @@ export const PagerStyles = {
|
|
|
67
67
|
},
|
|
68
68
|
}
|
|
69
69
|
}),
|
|
70
|
-
horizontal: createPagerStyle((
|
|
70
|
+
horizontal: createPagerStyle((theme) => {
|
|
71
71
|
|
|
72
|
-
const width =
|
|
73
|
-
const height =
|
|
72
|
+
const width = theme.values.width
|
|
73
|
+
const height = theme.values.window.height * 0.8
|
|
74
74
|
return pagerAnimation(height, width, 'X')
|
|
75
75
|
}),
|
|
76
|
-
vertical: createPagerStyle((
|
|
77
|
-
const height =
|
|
78
|
-
const width =
|
|
76
|
+
vertical: createPagerStyle((theme) => {
|
|
77
|
+
const height = theme.values.window.height * 0.8
|
|
78
|
+
const width = theme.values.width
|
|
79
79
|
return pagerAnimation(height, width, 'Y')
|
|
80
80
|
}),
|
|
81
81
|
}
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
onUpdate,
|
|
6
6
|
useDefaultComponentStyle,
|
|
7
7
|
usePrevious,
|
|
8
|
-
useCodeleapContext,
|
|
9
8
|
} from '@codeleap/common'
|
|
10
9
|
|
|
11
10
|
import { RefreshControl, RefreshControlProps, ScrollView, StyleSheet } from 'react-native'
|
|
@@ -13,7 +12,8 @@ import { ViewProps } from '../View'
|
|
|
13
12
|
import { KeyboardAwareScrollViewTypes } from '../../modules'
|
|
14
13
|
import { StylesOf } from '../../types'
|
|
15
14
|
import { ScrollComposition, ScrollStyles } from './styles'
|
|
16
|
-
import {
|
|
15
|
+
import { GetKeyboardAwarePropsOptions, useKeyboardAwareView } from '../../utils'
|
|
16
|
+
// import { KeyboardAwareScrollView } from '../../utils'
|
|
17
17
|
|
|
18
18
|
type KeyboardAwareScrollViewProps = KeyboardAwareScrollViewTypes.KeyboardAwareScrollViewProps
|
|
19
19
|
|
|
@@ -22,10 +22,11 @@ export type ScrollProps = KeyboardAwareScrollViewProps &
|
|
|
22
22
|
onRefresh?: () => void
|
|
23
23
|
refreshTimeout?: number
|
|
24
24
|
changeData?: any
|
|
25
|
-
keyboardAware?:
|
|
25
|
+
keyboardAware?: GetKeyboardAwarePropsOptions
|
|
26
26
|
refreshing?: boolean
|
|
27
27
|
styles?: StylesOf<ScrollComposition>
|
|
28
28
|
refreshControlProps?: Partial<RefreshControlProps>
|
|
29
|
+
debugName?: string
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export const Scroll = forwardRef<ScrollView, ScrollProps>(
|
|
@@ -38,7 +39,9 @@ export const Scroll = forwardRef<ScrollView, ScrollProps>(
|
|
|
38
39
|
changeData,
|
|
39
40
|
styles = {},
|
|
40
41
|
refreshControlProps = {},
|
|
41
|
-
|
|
42
|
+
contentContainerStyle,
|
|
43
|
+
keyboardAware,
|
|
44
|
+
debugName = '',
|
|
42
45
|
...props
|
|
43
46
|
} = scrollProps
|
|
44
47
|
const hasRefresh = !!props.onRefresh
|
|
@@ -69,37 +72,47 @@ export const Scroll = forwardRef<ScrollView, ScrollProps>(
|
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
}, [refreshingDisplay, changeData])
|
|
72
|
-
const { Theme } = useCodeleapContext()
|
|
73
75
|
|
|
74
76
|
const variantStyles = useDefaultComponentStyle<'u:Scroll', typeof ScrollStyles>('u:Scroll', {
|
|
75
77
|
variants,
|
|
76
78
|
styles,
|
|
77
79
|
transform: StyleSheet.flatten,
|
|
78
|
-
rootElement: '
|
|
80
|
+
rootElement: 'content',
|
|
79
81
|
})
|
|
80
82
|
|
|
81
|
-
const Component = keyboardAware ? KeyboardAwareScrollView : ScrollView
|
|
82
83
|
const refreshStyles = StyleSheet.flatten([variantStyles.refreshControl, styles.refreshControl])
|
|
84
|
+
const _scrollProps = {
|
|
85
|
+
style: [variantStyles.wrapper, style],
|
|
86
|
+
contentContainerStyle: [variantStyles.content, contentContainerStyle],
|
|
87
|
+
ref: ref as unknown as ScrollView,
|
|
88
|
+
refreshControl: hasRefresh && (
|
|
89
|
+
<RefreshControl
|
|
90
|
+
refreshing={refreshingDisplay}
|
|
91
|
+
onRefresh={onRefresh}
|
|
92
|
+
tintColor={refreshStyles?.color}
|
|
93
|
+
colors={[refreshStyles?.color]}
|
|
94
|
+
{...refreshControlProps}
|
|
95
|
+
/>
|
|
96
|
+
),
|
|
97
|
+
...props,
|
|
98
|
+
}
|
|
99
|
+
const keyboard = useKeyboardAwareView({
|
|
100
|
+
debugName,
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
const rootProps = keyboard.getKeyboardAwareProps(_scrollProps, {
|
|
104
|
+
adapt: 'marginBottom',
|
|
105
|
+
baseStyleProp: 'style',
|
|
106
|
+
...keyboardAware,
|
|
107
|
+
|
|
108
|
+
})
|
|
109
|
+
|
|
83
110
|
return (
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
contentContainerStyle={[variantStyles.wrapper]}
|
|
87
|
-
ref={ref as unknown as ScrollView}
|
|
88
|
-
refreshControl={
|
|
89
|
-
hasRefresh && (
|
|
90
|
-
<RefreshControl
|
|
91
|
-
refreshing={refreshingDisplay}
|
|
92
|
-
onRefresh={onRefresh}
|
|
93
|
-
tintColor={refreshStyles?.color}
|
|
94
|
-
colors={[refreshStyles?.color]}
|
|
95
|
-
{...refreshControlProps}
|
|
96
|
-
/>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
{...props}
|
|
111
|
+
<ScrollView
|
|
112
|
+
{...rootProps}
|
|
100
113
|
>
|
|
101
114
|
{children}
|
|
102
|
-
</
|
|
115
|
+
</ScrollView>
|
|
103
116
|
)
|
|
104
117
|
},
|
|
105
118
|
)
|
|
@@ -131,6 +131,9 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
|
|
|
131
131
|
style={variantStyles.scroll}
|
|
132
132
|
contentContainerStyle={variantStyles.scrollContent}
|
|
133
133
|
{...scrollProps}
|
|
134
|
+
keyboardAware={{
|
|
135
|
+
enabled: false,
|
|
136
|
+
}}
|
|
134
137
|
ref={scrollRef}
|
|
135
138
|
>
|
|
136
139
|
<View style={variantStyles.wrapper}>
|