Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vizir/react-native-autocomplete-select
AutoComplete with selection for react-native
https://github.com/vizir/react-native-autocomplete-select
auto-complete autocomplete autocomplete-component component react-native
Last synced: 16 days ago
JSON representation
AutoComplete with selection for react-native
- Host: GitHub
- URL: https://github.com/vizir/react-native-autocomplete-select
- Owner: Vizir
- License: mit
- Created: 2017-01-30T19:58:55.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-13T19:18:21.000Z (about 6 years ago)
- Last Synced: 2024-12-19T05:38:37.999Z (29 days ago)
- Topics: auto-complete, autocomplete, autocomplete-component, component, react-native
- Language: JavaScript
- Size: 309 KB
- Stars: 67
- Watchers: 5
- Forks: 23
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# react-native-autocomplete-select
![alt text](autocompleteSelect.jpg "Autocomplete React Native")
> Simple AutoComplete with selection for react-native
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![Build Status](https://travis-ci.org/Vizir/react-native-autocomplete-select.svg?branch=master)](https://travis-ci.org/Vizir/react-native-autocomplete-select)
[![Code Climate](https://codeclimate.com/github/Vizir/react-native-autocomplete-select/badges/gpa.svg)](https://codeclimate.com/github/Vizir/react-native-autocomplete-select)
[![Test Coverage](https://codeclimate.com/github/Vizir/react-native-autocomplete-select/badges/coverage.svg)](https://codeclimate.com/github/Vizir/react-native-autocomplete-select/coverage)
[![Issue Count](https://codeclimate.com/github/Vizir/react-native-autocomplete-select/badges/issue_count.svg)](https://codeclimate.com/github/Vizir/react-native-autocomplete-select)## Install
```bash
npm install --save react-native-autocomplete-select
```
## Usage
Simple example:
```JavaScript
import AutoComplete from 'react-native-autocomplete-select'
...
const onSelect = (suggestion) => {
console.log(suggestion) // the pressed suggestion
}const suggestions = [
{text: 'suggestion1', anotherProperty: 'value'},
{text: 'suggestion2', anotherProperty: 'value2'}
]```
Will output:
![alt text](example.png "Example visual")
| Available Properties | Description |
-----------------------|-----------------
| suggestions | An array of objects or values to use as suggestions |
| value | Current value of the input |
| minimumSimilarityScore | Value from 0 (matches anything) to 1 (only matches if the strings are the same), defaults to 0.6. The input value will be compared to the suggestion, the suggestion score should be greater than or equal to this value to be shown. |
| comparationFuzziness | Value from 0 to 1, defaults to 0.5. This is the fuzziness level used on similarity comparation. |
| suggestionObjectTextProperty | If the suggestions in the array are objects, this will be used to get the suggestion value. The value will be shown on the list and will be used to check the similarity of the suggestion to the input value. |
| onChangeText | Function to execute when the input value changes. |
| onSelect | (Required) Function to call when a suggestion is pressed. Will be called with the suggestion as a parameter |
| suggestionsWrapperStyle | Style of the list of suggestion. |
| suggestionStyle | Style of the suggestion item in the list. |
| suggestionTextStyle | Style of the suggestion text. |
| style | Style of the component. |
| inputStyle | Style of the text input. |## Contributing
1. Fork this repository
2. Create a branch based on master about what you are doing
- Names should be separated by hyphen: example-name
3. Commit using the format: \[\\] \
- The type should be: Feat, Fix, Refactor or Docs
- Example message: \[Docs\] Added contributing to readme
- Do not forget to add tests!
4. Run all tests `npm test` and linter `npm run lint`
5. Create a pull request describing the changes you made## License
[MIT](https://opensource.org/licenses/MIT)