Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

native-autocomplete-input

x139459MIT0.6.0TypeScript support: included

AutoComplete component for react-native

react-native, ios, android

readme

native-autocomplete-input

This is an auto complete input component for react-native. For the native, Android use AutoCompleteTextView, iOS use UITextField.

For now, we only implement the Android, iOS is on the way.

Installation

npm install native-autocomplete-input

Usage

import AutoCompleteInputView from "native-autocomplete-input";

// ...

      <AutoCompleteInputView
        suggestions={['android', 'apple', 'bob', 'banana']}
        onChangeText={(value: string) => {
          console.log(value);
        }}
        onChangeSuggestion={(index:number, value:string) =>{
          console.log('index', index, 'value', value);
        }}
        textColor={'#f00'}
        style={styles.box}
      />

Props

Prop Type Description
suggestions string array An array with suggestion items
textColor string of rgba Text color of the input view
fontSize number Font size for the input view
onChangeText Function Callback that is called when the text input's text changes. Changed text is passed as an argument to the callback handler
defaultValue string Default value for the input view
placeholderColor string of color Text color of the input view holder
placeholder string Placeholder for text input view
onChangeSuggestion Function Callback while user select suggestion

TODO

  • iOS support
  • Custom style for the suggest item.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT