|
1 |
| -import React from 'react'; |
| 1 | +import React, { ReactElement } from 'react'; |
2 | 2 | import type {
|
3 | 3 | FlatListProps,
|
4 | 4 | TextInputProps,
|
5 | 5 | StyleProp,
|
6 | 6 | ViewStyle,
|
7 | 7 | ListRenderItemInfo,
|
8 | 8 | } from 'react-native';
|
9 |
| -import PropTypes from 'prop-types'; |
10 | 9 | import { FlatList, Platform, StyleSheet, Text, TextInput, View } from 'react-native';
|
11 |
| -import { ViewPropTypes } from 'deprecated-react-native-prop-types'; |
12 | 10 |
|
13 | 11 | export type AutocompleteInputProps<Item> = TextInputProps & {
|
14 | 12 | containerStyle?: StyleProp<ViewStyle>;
|
@@ -87,7 +85,9 @@ export const AutocompleteInput = React.forwardRef(function AutocompleteInputComp
|
87 | 85 | )}
|
88 | 86 | </View>
|
89 | 87 | );
|
90 |
| -}); |
| 88 | +}) as <Item, Ref>( |
| 89 | + props: AutocompleteInputProps<Item> & { ref?: React.ForwardedRef<Ref> }, |
| 90 | +) => ReactElement; |
91 | 91 |
|
92 | 92 | const border = {
|
93 | 93 | borderColor: '#b9b9b9',
|
@@ -148,57 +148,3 @@ const styles = StyleSheet.create({
|
148 | 148 | });
|
149 | 149 |
|
150 | 150 | export default AutocompleteInput;
|
151 |
| - |
152 |
| -AutocompleteInput.propTypes = { |
153 |
| - // eslint-disable-next-line @typescript-eslint/ban-ts-comment |
154 |
| - // @ts-ignore |
155 |
| - ...TextInput.propTypes, |
156 |
| - /** |
157 |
| - * These styles will be applied to the container which |
158 |
| - * surrounds the autocomplete component. |
159 |
| - */ |
160 |
| - containerStyle: ViewPropTypes ? ViewPropTypes.style : PropTypes.object, |
161 |
| - /** |
162 |
| - * Assign an array of data objects which should be |
163 |
| - * rendered in respect to the entered text. |
164 |
| - */ |
165 |
| - data: PropTypes.array, |
166 |
| - /** |
167 |
| - * Props which can be applied to result `FlatList`. |
168 |
| - */ |
169 |
| - // eslint-disable-next-line @typescript-eslint/ban-ts-comment |
170 |
| - // @ts-ignore |
171 |
| - flatListProps: FlatList.propTypes || PropTypes.object, |
172 |
| - /** |
173 |
| - * Set to `true` to hide the suggestion list. |
174 |
| - */ |
175 |
| - hideResults: PropTypes.bool, |
176 |
| - /** |
177 |
| - * These styles will be applied to the container which surrounds |
178 |
| - * the textInput component. |
179 |
| - */ |
180 |
| - inputContainerStyle: ViewPropTypes ? ViewPropTypes.style : PropTypes.object, |
181 |
| - /** |
182 |
| - * These style will be applied to the result list. |
183 |
| - */ |
184 |
| - listContainerStyle: ViewPropTypes ? ViewPropTypes.style : PropTypes.object, |
185 |
| - /** |
186 |
| - * `onShowResults` will be called when list is going to |
187 |
| - * show/hide results. |
188 |
| - */ |
189 |
| - onShowResults: PropTypes.func, |
190 |
| - /** |
191 |
| - * `onShowResults` will be called when list is going to |
192 |
| - * show/hide results. |
193 |
| - */ |
194 |
| - onStartShouldSetResponderCapture: PropTypes.func, |
195 |
| - /** |
196 |
| - * renders custom TextInput. All props passed to this function. |
197 |
| - */ |
198 |
| - renderTextInput: PropTypes.func, |
199 |
| - /** |
200 |
| - * renders custom result list. Can be used to replace FlatList. |
201 |
| - * All props passed to this function. |
202 |
| - */ |
203 |
| - renderResultList: PropTypes.func, |
204 |
| -}; |
0 commit comments