Skip to content

Commit e75ee40

Browse files
authored
Merge pull request #17 from maxkordiyak/initial-value
Option to set an initial value
2 parents cb23031 + 1561771 commit e75ee40

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ Change valueExtractor and pass the data to Autocomplete without fetchDataUrl
145145
listHeader | Text at the beginning of suggestions | String | -
146146
fetchDataUrl | Data source url | String | -
147147
noDataText | Text to display when no results | String | No Results
148+
initialValue | Text to display initially | String | -
148149
inputContainerStyle | Styles for autocomplete container | Object | -
149150
inputStyle | Styles for autocomplete input | Object | -
150151
spinnerStyle | Styles for activity indicator | Object | -

components/Autocomplete/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Autocomplete extends Component {
1313
constructor(props) {
1414
super(props);
1515
this.state = {
16-
inputValue: "",
16+
inputValue: props.initialValue || "",
1717
loading: false,
1818
filteredItems: [],
1919
};

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type AutocompleteProps = {
1919
listHeader?: string,
2020
fetchDataUrl?: string,
2121
noDataText?: string;
22+
initialValue?: string;
2223
inputContainerStyle?: StyleProp<ViewStyle>;
2324
inputStyle?: StyleProp<TextStyle>;
2425
spinnerStyle?: StyleProp<ViewStyle>;

0 commit comments

Comments
 (0)