Skip to content

Commit df719bb

Browse files
committed
Merge branch 'master' of github.com:ErrorPro/react-google-autocomplete
2 parents d0bcb40 + b2f3b9d commit df719bb

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,18 @@
66

77
`npm i react-google-autocomplete --save`
88

9-
You also have to include google autocomplete link api in your app. Somewhere in index.html or somwhere else.
9+
<hr>
10+
11+
As of version 1.2.4, you can now pass an `apiKey` prop to automatically load the Google maps scripts. The api key can be found in your [google cloud console.](https://developers.google.com/maps/documentation/javascript/get-api-key)
12+
13+
```js
14+
<AutoComplete
15+
apiKey={YOUR_GOOGLE_MAPS_API_KEY}
16+
onPlaceSelected={() => 'do something on select'}
17+
/>
18+
```
19+
20+
Alternatively if not passing the `apiKey` prop, you can include google autocomplete link api in your app. Somewhere in index.html or somewhere else.
1021

1122
```html
1223
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[YOUR_API_KEY]&libraries=places"></script>

lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ var ReactGoogleAutocomplete = function (_React$Component) {
144144
bounds = _props2.bounds,
145145
options = _props2.options,
146146
apiKey = _props2.apiKey,
147-
rest = _objectWithoutProperties(_props2, ['onPlaceSelected', 'types', 'componentRestrictions', 'bounds', 'options', 'apiKey']);
147+
inputAutocompleteValue = _props2.inputAutocompleteValue,
148+
rest = _objectWithoutProperties(_props2, ['onPlaceSelected', 'types', 'componentRestrictions', 'bounds', 'options', 'apiKey', 'inputAutocompleteValue']);
148149

149150
return _react2.default.createElement('input', _extends({ ref: 'input' }, rest));
150151
}

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export default class ReactGoogleAutocomplete extends React.Component {
130130
bounds,
131131
options,
132132
apiKey,
133+
inputAutocompleteValue,
133134
...rest
134135
} = this.props;
135136

0 commit comments

Comments
 (0)