AutoSuggest TextInput Component
Installation
npm install autosuggest --save
Example:
import { TextInput } from 'react-native'
import AutoSuggest from 'react-native-autosuggest';
<AutoSuggest
onChangeText={(el) => console.log('input changing!')}
terms={['Apple', 'Banana', 'Orange', 'Strawberry', 'Lemon', 'Cantaloupe', 'Peach', 'Mandarin', 'Date', 'Kiwi']}
...
/>
Props:
Refer to React's TextInput documentation for more information on placeholder
and onChangeText
.
Refer to the source code for more information about the rest.
onChangeText
(function, fired when the input changes.)onChangeTextDebounce
(integer, the minimum break in milliseconds that the onChangeText callback needs to take before firing again. default is 0.)onItemPress
(function fired when an item in the menu is pressed with that item's string value as the argument. You probably don't need this, and should just use onChangeText)clearBtn
(Array e.g. [[] -- only if you want a custom btn component, default is undefined.)clearBtnStyles
(Object)terms
(Array e.g. ['Chicago', 'New York', 'San Francisco'])placeholder
(String e.g. "Please enter a City.")placeholderTextColor
(string)otherTextInputProps
(object, check the TextInput docs for the full list)containerStyles
(object)textInputStyles
(Object applies to the TextInput component e.g {width: 400, backgroundColor: "black"})containerStyles
(Object)rowWrapperStyles
(Object)rowTextStyles
(Object)