diff --git a/types/react-native-autocomplete-input/index.d.ts b/types/react-native-autocomplete-input/index.d.ts index df5ab5e507..eb4bca3986 100644 --- a/types/react-native-autocomplete-input/index.d.ts +++ b/types/react-native-autocomplete-input/index.d.ts @@ -12,6 +12,7 @@ import { StyleProp, TextInputProperties, ViewStyle, + FlatListProps, } from 'react-native'; export interface AutocompleteProps extends TextInputProperties { @@ -33,12 +34,24 @@ export interface AutocompleteProps extends TextInputProperties { */ data: T[]; + /** + * object + * Props to pass on to the underlying FlatList. + */ + flatListProps?: Partial>; + /** * style * These styles will be applied to the container which surrounds the textInput component. */ inputContainerStyle?: StyleProp; + /** + * function + * keyExtractor will be called to get key for each item. It's up to you which string to return as a key. + */ + keyExtractor?(item: T, i: number): string; + /** * style * These styles will be applied to the container which surrounds the result list. diff --git a/types/react-native-autocomplete-input/react-native-autocomplete-input-tests.tsx b/types/react-native-autocomplete-input/react-native-autocomplete-input-tests.tsx index 36dd6b516f..8de641a11a 100644 --- a/types/react-native-autocomplete-input/react-native-autocomplete-input-tests.tsx +++ b/types/react-native-autocomplete-input/react-native-autocomplete-input-tests.tsx @@ -1,10 +1,8 @@ import Autocomplete from 'react-native-autocomplete-input'; import * as React from 'react'; import { - StyleSheet, Text, TouchableOpacity, - View } from 'react-native'; interface Item { query: string; value: string; } @@ -24,6 +22,8 @@ class AutocompleteExample extends React.Component<{}, {query: string}> { return ( {} }} + keyExtractor={item => item.value} onChangeText={text => this.setState({ query: text })} renderItem={({ item }) => ( this.setState({ query: item.query })}>