Skip to content

Commit 3089c76

Browse files
committed
[Docs] Created README
1 parent 030fe06 commit 3089c76

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,68 @@
1+
# react-native-autocomplete-select
2+
3+
> Simple AutoComplete with selection for react-native
4+
15
[![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)
26
[![Code Climate](https://codeclimate.com/github/Vizir/react-native-autocomplete-select/badges/gpa.svg)](https://codeclimate.com/github/Vizir/react-native-autocomplete-select)
37
[![Test Coverage](https://codeclimate.com/github/Vizir/react-native-autocomplete-select/badges/coverage.svg)](https://codeclimate.com/github/Vizir/react-native-autocomplete-select/coverage)
48
[![Issue Count](https://codeclimate.com/github/Vizir/react-native-autocomplete-select/badges/issue_count.svg)](https://codeclimate.com/github/Vizir/react-native-autocomplete-select)
9+
10+
11+
## Install
12+
13+
```bash
14+
15+
npm install --save react-native-autocomplete-select
16+
17+
```
18+
19+
## Usage
20+
21+
Simple example:
22+
23+
```JavaScript
24+
25+
import AutoComplete from 'react-native-autocomplete-select'
26+
27+
...
28+
29+
const onSelect = (suggestion) => {
30+
console.log(suggestion) // the pressed suggestion
31+
}
32+
33+
const suggestions = [
34+
{text: 'suggestion1', anotherProperty: 'value'},
35+
{text: 'suggestion2', anotherProperty: 'value2'}
36+
]
37+
38+
<AutoComplete
39+
onSelect={onSelect}
40+
suggestions={suggestions}
41+
suggestionObjectTextProperty='text'
42+
value='sug'
43+
/>
44+
45+
```
46+
47+
Will output:
48+
49+
![alt text](example.png "Example visual")
50+
51+
| Available Properties | Description |
52+
-----------------------|-----------------
53+
| suggestions | An array of objects or values to use as suggestions |
54+
| value | Current value of the input |
55+
| 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. |
56+
| comparationFuzziness | Value from 0 to 1, defaults to 0.5. This is the fuzziness level used on similarity comparation. |
57+
| 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. |
58+
| onChangeText | Function to execute when the input value changes. |
59+
| onSelect | (Required) Function to call when a suggestion is pressed. Will be called with the suggestion as a parameter |
60+
| suggestionsWrapperStyle | Style of the list of suggestion. |
61+
| suggestionStyle | Style of the suggestion item in the list. |
62+
| suggestionTextStyle | Style of the suggestion text. |
63+
| style | Style of the component. |
64+
| inputStyle | Style of the text input. |
65+
66+
## License
67+
68+
[MIT](https://opensource.org/licenses/MIT)

example.png

11.7 KB
Loading

0 commit comments

Comments
 (0)