Skip to content

Commit

Permalink
adding default value for search textinput
Browse files Browse the repository at this point in the history
  • Loading branch information
FaridSafi committed Oct 16, 2015
1 parent b7a0c35 commit 40119c0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Example/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ var GooglePlacesAutocomplete = require('react-native-google-places-autocomplete'
console.log(data);
console.log(details);
},
getDefaultValue() {
return ''; // text input default value
},
query: {
// available options: https://developers.google.com/places/web-service/autocomplete
key: 'YOUR API KEY',
Expand Down
3 changes: 3 additions & 0 deletions Example/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ var GooglePlacesAutocomplete = require('react-native-google-places-autocomplete'
console.log(data);
console.log(details);
},
getDefaultValue() {
return ''; // text input default value
},
query: {
// available options: https://developers.google.com/places/web-service/autocomplete
key: 'YOUR API KEY',
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ var GooglePlacesAutocomplete = require('react-native-google-places-autocomplete'
console.log(data);
console.log(details);
},
getDefaultValue() {
return ''; // text input default value
},
query: {
// available options: https://developers.google.com/places/web-service/autocomplete
key: 'YOUR API KEY',
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exports.create = function(options = {}) {
options.minLength = options.minLength || 0;
options.fetchDetails = options.fetchDetails || false;
options.autoFocus = options.autoFocus || false;
options.getDefaultValue = options.getDefaultValue || function() { return ''; };
options.timeout = options.timeout || 20000;
options.onTimeout = options.onTimeout || () => {
console.warn('google places autocomplete: request timeout');
Expand Down Expand Up @@ -88,7 +89,7 @@ exports.create = function(options = {}) {
return r1 !== r2;
}});
return {
text: '',
text: options.getDefaultValue(),
dataSource: ds.cloneWithRows([]),
};
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-google-places-autocomplete",
"version": "1.0.9",
"version": "1.0.10",
"description": "Customizable Google Places autocomplete component for iOS and Android React-Native apps",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 40119c0

Please sign in to comment.