@codeleap/mobile 3.2.9 → 3.2.11
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
|
@@ -75,6 +75,7 @@ export const Autocomplete = <T extends string|number = string, Multi extends boo
|
|
|
75
75
|
filterItems = defaultFilterFunction,
|
|
76
76
|
searchInputProps: searchProps = {},
|
|
77
77
|
onItemPressed = () => {},
|
|
78
|
+
style,
|
|
78
79
|
...listProps
|
|
79
80
|
} = allProps
|
|
80
81
|
|
|
@@ -116,6 +117,8 @@ export const Autocomplete = <T extends string|number = string, Multi extends boo
|
|
|
116
117
|
|
|
117
118
|
const listStyles = useNestedStylesByKey('list', variantStyles)
|
|
118
119
|
|
|
120
|
+
const searchInputStyles = useNestedStylesByKey('searchInput', variantStyles)
|
|
121
|
+
|
|
119
122
|
const currentOptions = searchable ? filteredOptions : defaultOptions
|
|
120
123
|
|
|
121
124
|
const select = (selectedValue) => {
|
|
@@ -197,7 +200,7 @@ export const Autocomplete = <T extends string|number = string, Multi extends boo
|
|
|
197
200
|
|
|
198
201
|
const Search = searchComponent
|
|
199
202
|
|
|
200
|
-
return <View style={variantStyles.wrapper}>
|
|
203
|
+
return <View style={[variantStyles.wrapper, style]}>
|
|
201
204
|
<Search
|
|
202
205
|
placeholder={placeholder}
|
|
203
206
|
debugName={debugName}
|
|
@@ -209,6 +212,7 @@ export const Autocomplete = <T extends string|number = string, Multi extends boo
|
|
|
209
212
|
debounce={!!loadOptions ? 800 : null}
|
|
210
213
|
onSearchChange={onChangeSearch}
|
|
211
214
|
hideErrorMessage
|
|
215
|
+
styles={searchInputStyles}
|
|
212
216
|
{...searchProps}
|
|
213
217
|
/>
|
|
214
218
|
|
|
@@ -14,11 +14,15 @@ import { SearchInputProps, TextInputProps } from '../TextInput'
|
|
|
14
14
|
import { Touchable } from '../Touchable'
|
|
15
15
|
import { AutocompleteComposition } from './styles'
|
|
16
16
|
|
|
17
|
+
type AutocompleteOption<T = any> = FormTypes.Options<T> & {
|
|
18
|
+
item?: any
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
export type AutocompleteRenderFNProps<T> = {
|
|
18
22
|
styles: StylesOf<AutocompleteComposition>
|
|
19
23
|
onPress: () => void
|
|
20
24
|
isSelected?: boolean
|
|
21
|
-
item:
|
|
25
|
+
item: AutocompleteOption<T>[number]
|
|
22
26
|
touchableProps?: Partial<PropsOf<typeof Touchable>>
|
|
23
27
|
textProps?: Partial<PropsOf<typeof Text>>
|
|
24
28
|
iconProps?: Partial<PropsOf<typeof Icon>>
|
|
@@ -73,6 +73,7 @@ const ListCP = forwardRef<KeyboardAwareFlatList, FlatListProps>(
|
|
|
73
73
|
refreshControlProps = {},
|
|
74
74
|
loading = false,
|
|
75
75
|
fakeEmpty = loading,
|
|
76
|
+
contentContainerStyle,
|
|
76
77
|
...props
|
|
77
78
|
} = flatListProps
|
|
78
79
|
|
|
@@ -86,8 +87,6 @@ const ListCP = forwardRef<KeyboardAwareFlatList, FlatListProps>(
|
|
|
86
87
|
// const isEmpty = !props.data || !props.data.length
|
|
87
88
|
const separator = props?.separators && <RenderSeparator separatorStyles={variantStyles.separator}/>
|
|
88
89
|
|
|
89
|
-
const refreshStyles = StyleSheet.flatten([variantStyles.refreshControl, styles.refreshControl])
|
|
90
|
-
|
|
91
90
|
const renderItem = useCallback((data: ListRenderItemInfo<any>) => {
|
|
92
91
|
if (!props?.renderItem) return null
|
|
93
92
|
const listLength = props?.data?.length || 0
|
|
@@ -118,9 +117,11 @@ const ListCP = forwardRef<KeyboardAwareFlatList, FlatListProps>(
|
|
|
118
117
|
variantStyles.wrapper,
|
|
119
118
|
style,
|
|
120
119
|
isEmpty && variantStyles['wrapper:empty'],
|
|
120
|
+
|
|
121
121
|
]}
|
|
122
122
|
contentContainerStyle={[
|
|
123
123
|
variantStyles.content,
|
|
124
|
+
contentContainerStyle,
|
|
124
125
|
isEmpty && variantStyles['content:empty'],
|
|
125
126
|
]}
|
|
126
127
|
// @ts-expect-error React's refs suck
|