@codeleap/mobile 2.1.8 → 2.2.0
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 +8 -7
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/MultiSelect/types.d.ts +1 -0
- 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 +1 -1
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/Select/index.js +20 -6
- 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 +3 -1
- 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/PermissionManager/context.d.ts +2 -2
- package/dist/utils/PermissionManager/context.js +25 -29
- package/dist/utils/PermissionManager/context.js.map +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/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/input.d.ts +35 -0
- package/dist/utils/input.js +49 -0
- package/dist/utils/input.js.map +1 -0
- 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 +8 -8
- package/src/components/MultiSelect/types.ts +1 -0
- package/src/components/Pager/styles.ts +7 -7
- package/src/components/Scroll/index.tsx +37 -24
- package/src/components/SegmentedControl/index.tsx +1 -0
- package/src/components/Select/index.tsx +20 -14
- package/src/components/Select/styles.ts +2 -0
- package/src/components/Select/types.ts +3 -1
- 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/PermissionManager/context.tsx +31 -22
- package/src/utils/hooks.ts +19 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/input.ts +51 -0
|
@@ -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
|
})),
|
|
@@ -30,6 +30,7 @@ export const MultiSelect = <T extends string|number = string>(selectProps:MultiS
|
|
|
30
30
|
inputProps = {},
|
|
31
31
|
clearable = false,
|
|
32
32
|
clearIconName = 'close',
|
|
33
|
+
validate = null,
|
|
33
34
|
...drawerProps
|
|
34
35
|
} = selectProps
|
|
35
36
|
|
|
@@ -80,18 +81,16 @@ export const MultiSelect = <T extends string|number = string>(selectProps:MultiS
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
const isEmpty = value.length === 0
|
|
83
|
-
|
|
84
|
-
const inputIcon =
|
|
85
|
-
isEmpty ? arrowIconName : clearIconName
|
|
86
|
-
) : arrowIconName
|
|
84
|
+
const showClearIcon = !isEmpty && clearable
|
|
85
|
+
const inputIcon = showClearIcon ? clearIconName : arrowIconName
|
|
87
86
|
|
|
88
87
|
const onPressInputIcon = () => {
|
|
89
|
-
if (
|
|
90
|
-
close?.()
|
|
91
|
-
}
|
|
92
|
-
if (clearable) {
|
|
88
|
+
if (showClearIcon) {
|
|
93
89
|
onValueChange([])
|
|
90
|
+
} else {
|
|
91
|
+
close?.()
|
|
94
92
|
}
|
|
93
|
+
|
|
95
94
|
}
|
|
96
95
|
return <>
|
|
97
96
|
{
|
|
@@ -114,6 +113,7 @@ export const MultiSelect = <T extends string|number = string>(selectProps:MultiS
|
|
|
114
113
|
debugName={'Select input'}
|
|
115
114
|
styles={inputStyles}
|
|
116
115
|
style={style}
|
|
116
|
+
validate={validate}
|
|
117
117
|
{...inputProps}
|
|
118
118
|
/>
|
|
119
119
|
)
|
|
@@ -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,7 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
|
|
|
131
131
|
style={variantStyles.scroll}
|
|
132
132
|
contentContainerStyle={variantStyles.scrollContent}
|
|
133
133
|
{...scrollProps}
|
|
134
|
+
keyboardAware={false}
|
|
134
135
|
ref={scrollRef}
|
|
135
136
|
>
|
|
136
137
|
<View style={variantStyles.wrapper}>
|
|
@@ -10,7 +10,7 @@ import { TextInput } from '../TextInput'
|
|
|
10
10
|
import { Touchable } from '../Touchable'
|
|
11
11
|
import { SelectStyles } from './styles'
|
|
12
12
|
import { CustomSelectProps } from './types'
|
|
13
|
-
import { ModalManager } from '../../utils'
|
|
13
|
+
import { ModalManager, useKeyboardAwareView } from '../../utils'
|
|
14
14
|
import { Icon } from '../Icon'
|
|
15
15
|
|
|
16
16
|
export const SelectItem = ({ item, icon = null, isSelected, styles, onPress }) => {
|
|
@@ -46,6 +46,7 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
46
46
|
selectedIcon = 'selectMarker',
|
|
47
47
|
inputProps = {},
|
|
48
48
|
hideInput = false,
|
|
49
|
+
|
|
49
50
|
...drawerProps
|
|
50
51
|
} = selectProps
|
|
51
52
|
|
|
@@ -90,19 +91,28 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
90
91
|
/>
|
|
91
92
|
}
|
|
92
93
|
const isEmpty = TypeGuards.isNil(value)
|
|
94
|
+
const showClearIcon = !isEmpty && clearable
|
|
93
95
|
|
|
94
|
-
const inputIcon =
|
|
95
|
-
isEmpty ? arrowIconName : clearIconName
|
|
96
|
-
) : arrowIconName
|
|
96
|
+
const inputIcon = showClearIcon ? clearIconName : arrowIconName
|
|
97
97
|
|
|
98
98
|
const onPressInputIcon = () => {
|
|
99
|
-
if (
|
|
100
|
-
close?.()
|
|
101
|
-
}
|
|
102
|
-
if (clearable) {
|
|
99
|
+
if (showClearIcon) {
|
|
103
100
|
onValueChange(null)
|
|
101
|
+
} else {
|
|
102
|
+
close?.()
|
|
104
103
|
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const baseListProps = {
|
|
108
|
+
data: options,
|
|
109
|
+
style: variantStyles.list,
|
|
110
|
+
contentContainerStyle: variantStyles.listContent,
|
|
111
|
+
keyExtractor: (i) => i.value,
|
|
112
|
+
renderItem: renderListItem,
|
|
113
|
+
...listProps,
|
|
105
114
|
}
|
|
115
|
+
|
|
106
116
|
return <>
|
|
107
117
|
{
|
|
108
118
|
!hideInput && (
|
|
@@ -112,6 +122,7 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
112
122
|
rightIcon={{
|
|
113
123
|
icon: inputIcon as IconPlaceholder,
|
|
114
124
|
onPress: onPressInputIcon,
|
|
125
|
+
noFeedback: true,
|
|
115
126
|
}}
|
|
116
127
|
editable={false}
|
|
117
128
|
touchableWrapper
|
|
@@ -132,12 +143,7 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
132
143
|
|
|
133
144
|
<ModalManager.Drawer scroll={false} title={label} {...drawerProps} styles={variantStyles}>
|
|
134
145
|
<List<CustomSelectProps<any>['options']>
|
|
135
|
-
|
|
136
|
-
style={variantStyles.list}
|
|
137
|
-
contentContainerStyle={variantStyles.listContent}
|
|
138
|
-
keyExtractor={(i) => i.value}
|
|
139
|
-
renderItem={renderListItem}
|
|
140
|
-
{...listProps}
|
|
146
|
+
{...baseListProps}
|
|
141
147
|
/>
|
|
142
148
|
</ModalManager.Drawer>
|
|
143
149
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
IconPlaceholder,
|
|
5
5
|
} from '@codeleap/common'
|
|
6
6
|
import { StylesOf } from '../../types/utility'
|
|
7
|
+
import { GetKeyboardAwarePropsOptions } from '../../utils'
|
|
7
8
|
import { DrawerProps } from '../Drawer'
|
|
8
9
|
import { FlatListProps } from '../List'
|
|
9
10
|
import { TextInputProps } from '../TextInput'
|
|
@@ -36,6 +37,7 @@ export type CustomSelectProps<T> = SelectDrawerProps & {
|
|
|
36
37
|
inputProps?: Partial<TextInputProps>
|
|
37
38
|
listProps?: Partial<FlatListProps>
|
|
38
39
|
clearable?: boolean
|
|
39
|
-
clearIconName?:
|
|
40
|
+
clearIconName?: IconPlaceholder
|
|
41
|
+
keyboardAware?: GetKeyboardAwarePropsOptions
|
|
40
42
|
} & ComponentVariants<typeof SelectStyles>
|
|
41
43
|
|
|
@@ -19,6 +19,7 @@ import { StylesOf } from '../../../types/utility'
|
|
|
19
19
|
import { Touchable } from '../../Touchable'
|
|
20
20
|
import { Text } from '../../Text'
|
|
21
21
|
import { Animated } from '../../Animated'
|
|
22
|
+
import { GetKeyboardAwarePropsOptions } from '../../../utils'
|
|
22
23
|
|
|
23
24
|
export * from './styles'
|
|
24
25
|
|
|
@@ -38,7 +39,7 @@ export type ModalProps = Omit<ViewProps, 'variants' | 'styles'> & {
|
|
|
38
39
|
toggle?: () => void
|
|
39
40
|
zIndex?: number
|
|
40
41
|
scroll?: boolean
|
|
41
|
-
keyboardAware?:
|
|
42
|
+
keyboardAware?: GetKeyboardAwarePropsOptions
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
@@ -56,7 +57,7 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
56
57
|
closeIconName = 'close',
|
|
57
58
|
debugName,
|
|
58
59
|
scroll = true,
|
|
59
|
-
keyboardAware
|
|
60
|
+
keyboardAware,
|
|
60
61
|
zIndex = null,
|
|
61
62
|
...props
|
|
62
63
|
} = modalProps
|
|
@@ -39,12 +39,12 @@ const defaultModalStyles = ModalStyles
|
|
|
39
39
|
export const MobileModalStyles = {
|
|
40
40
|
...defaultModalStyles,
|
|
41
41
|
...presets,
|
|
42
|
-
default: createModalStyle((
|
|
42
|
+
default: createModalStyle((theme) => {
|
|
43
43
|
const fullSize = {
|
|
44
|
-
...
|
|
44
|
+
...theme.presets.whole,
|
|
45
45
|
position: 'absolute',
|
|
46
|
-
width:
|
|
47
|
-
height:
|
|
46
|
+
width: theme?.values?.width,
|
|
47
|
+
height: theme?.values?.height,
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
return {
|
|
@@ -57,7 +57,7 @@ export const MobileModalStyles = {
|
|
|
57
57
|
overlay: {
|
|
58
58
|
opacity: 0,
|
|
59
59
|
|
|
60
|
-
backgroundColor:
|
|
60
|
+
backgroundColor: theme.colors.black,
|
|
61
61
|
...fullSize,
|
|
62
62
|
},
|
|
63
63
|
'overlay:visible': {
|
|
@@ -67,14 +67,14 @@ export const MobileModalStyles = {
|
|
|
67
67
|
innerWrapperScroll: {
|
|
68
68
|
display: 'flex',
|
|
69
69
|
alignItems: 'center',
|
|
70
|
-
...
|
|
71
|
-
minHeight:
|
|
70
|
+
...theme.presets.justifyCenter,
|
|
71
|
+
minHeight: theme.values.window.height,
|
|
72
72
|
},
|
|
73
73
|
box: {
|
|
74
74
|
width: '80%',
|
|
75
|
-
backgroundColor:
|
|
76
|
-
borderRadius:
|
|
77
|
-
...
|
|
75
|
+
backgroundColor: theme.colors.background,
|
|
76
|
+
borderRadius: theme.borderRadius.medium,
|
|
77
|
+
...theme.spacing.padding(2),
|
|
78
78
|
},
|
|
79
79
|
touchableBackdrop: {
|
|
80
80
|
...fullSize,
|
|
@@ -91,17 +91,17 @@ export const MobileModalStyles = {
|
|
|
91
91
|
},
|
|
92
92
|
header: {
|
|
93
93
|
flexDirection: 'row',
|
|
94
|
-
...
|
|
95
|
-
...
|
|
94
|
+
...theme.presets.justifySpaceBetween,
|
|
95
|
+
...theme.presets.alignCenter,
|
|
96
96
|
},
|
|
97
97
|
closeButtonWrapper: {
|
|
98
98
|
alignSelf: 'center',
|
|
99
|
-
...
|
|
99
|
+
...theme.spacing.marginLeft('auto'),
|
|
100
100
|
},
|
|
101
101
|
title: {
|
|
102
|
-
...
|
|
103
|
-
...assignTextStyle('h3')(
|
|
104
|
-
...
|
|
102
|
+
...theme.presets.textCenter,
|
|
103
|
+
...assignTextStyle('h3')(theme).text,
|
|
104
|
+
...theme.spacing.paddingBottom(1),
|
|
105
105
|
flex: 1,
|
|
106
106
|
},
|
|
107
107
|
}
|
|
@@ -118,7 +118,7 @@ export const MobileModalStyles = {
|
|
|
118
118
|
flex: 1,
|
|
119
119
|
borderRadius: 0,
|
|
120
120
|
width: theme.values.width,
|
|
121
|
-
height: theme.values.height,
|
|
121
|
+
height: theme.values.window.height,
|
|
122
122
|
...theme.presets.center,
|
|
123
123
|
},
|
|
124
124
|
})),
|
|
@@ -4,6 +4,7 @@ import listenToKeyboardEvents from './lib/KeyboardAwareHOC'
|
|
|
4
4
|
import KeyboardAwareScrollView from './lib/KeyboardAwareScrollView'
|
|
5
5
|
import KeyboardAwareFlatList from './lib/KeyboardAwareFlatList'
|
|
6
6
|
import KeyboardAwareSectionList from './lib/KeyboardAwareSectionList'
|
|
7
|
+
export * from './keyboardHooks'
|
|
7
8
|
|
|
8
9
|
export {
|
|
9
10
|
listenToKeyboardEvents,
|