react-google-autocomplete
Advanced tools
Comparing version 1.0.18 to 1.1.0
@@ -50,7 +50,10 @@ 'use strict'; | ||
componentRestrictions = _props.componentRestrictions, | ||
bounds = _props.bounds; | ||
bounds = _props.bounds, | ||
_props$fields = _props.fields, | ||
fields = _props$fields === undefined ? ["address_components", "geometry.location", "place_id", "formatted_address"] : _props$fields; | ||
var config = { | ||
types: types, | ||
bounds: bounds | ||
bounds: bounds, | ||
fields: fields | ||
}; | ||
@@ -122,3 +125,4 @@ | ||
componentRestrictions: _propTypes2.default.object, | ||
bounds: _propTypes2.default.object | ||
bounds: _propTypes2.default.object, | ||
fields: _propTypes2.default.array | ||
}; | ||
@@ -125,0 +129,0 @@ exports.default = ReactGoogleAutocomplete; |
{ | ||
"name": "react-google-autocomplete", | ||
"version": "1.0.18", | ||
"version": "1.1.0", | ||
"description": "React component for google autocomplete.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,5 +9,5 @@ ## React google autocomplete | ||
You also have to include google autocomplete link api in your app. Somewhere in index.html or somwehrer else. | ||
You also have to include google autocomplete link api in your app. Somewhere in index.html or somwhere else. | ||
``` | ||
```html | ||
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[YOUR_API_KEY]&libraries=places"></script> | ||
@@ -18,3 +18,3 @@ ``` | ||
``` | ||
```js | ||
import Autocomplete from 'react-google-autocomplete'; | ||
@@ -36,3 +36,3 @@ | ||
A [bounds](https://developers.google.com/maps/documentation/javascript/reference#AutocompleteOptions) prop by default is empty. | ||
You also can pass any props you want to the final input. | ||
You also can pass any props you want to the final input. You can also set [fields](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult) prop if you need extra information, now it defaults to basic data in order to control expenses. | ||
@@ -39,0 +39,0 @@ ## Contribution |
@@ -10,2 +10,3 @@ import React from 'react'; | ||
bounds: PropTypes.object, | ||
fields: PropTypes.array, | ||
} | ||
@@ -20,6 +21,12 @@ | ||
componentDidMount() { | ||
const { types=['(cities)'], componentRestrictions, bounds, } = this.props; | ||
const { | ||
types=['(cities)'], | ||
componentRestrictions, | ||
bounds, | ||
fields = ["address_components", "geometry.location", "place_id", "formatted_address"] | ||
} = this.props; | ||
const config = { | ||
types, | ||
bounds, | ||
fields, | ||
}; | ||
@@ -26,0 +33,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15366
287