Skip to content

Commit 30074c9

Browse files
committed
Add onChangeText
1 parent 5f28dfe commit 30074c9

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ Change valueExtractor and pass the data to Autocomplete without fetchDataUrl
162162
handleSelectItem | Selection callback (agrs: item, index) | Function | -
163163
onDropdownShow | Show keyboard | Function | -
164164
onDropdownClose | Hide keyboard | Function | -
165+
onChangeText | Autocomplete input text changes | Function | -
165166
renderIcon | Render icon near input | Function | -
166167
valueExtractor | Extract value from item (args: item, index) | Function | ({ value }) => value
167168
rightTextExtractor | Extract value from item (args: item, index) | Function | ({ value }) => value

components/Autocomplete/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class Autocomplete extends Component {
2929
}
3030

3131
handleInputChange(text) {
32-
const {minimumCharactersCount, waitInterval} = this.props;
32+
const {onChangeText, minimumCharactersCount, waitInterval} = this.props;
33+
if (onChangeText) {
34+
onChangeText(text);
35+
}
3336
clearTimeout(this.timer);
3437
this.setState({inputValue: text});
3538
if (text.length > minimumCharactersCount) {

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type AutocompleteProps = {
3737
handleSelectItem: (item: any, index: number) => void,
3838
onDropdownShow: () => void,
3939
onDropdownClose: () => void,
40+
onChangeText?: (search: string) => void,
4041
renderIcon?: () => void,
4142
valueExtractor?: (item: any) => void,
4243
rightTextExtractor?: (item: any) => void,

0 commit comments

Comments
 (0)