react-google-autocomplete
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -68,2 +68,3 @@ 'use strict'; | ||
// TODO: only take options as configuration object, remove config props from the components props. | ||
var _props = this.props, | ||
@@ -76,9 +77,11 @@ _props$types = _props.types, | ||
_props$fields = _props.fields, | ||
fields = _props$fields === undefined ? ['address_components', 'geometry.location', 'place_id', 'formatted_address'] : _props$fields; | ||
fields = _props$fields === undefined ? ['address_components', 'geometry.location', 'place_id', 'formatted_address'] : _props$fields, | ||
_props$options = _props.options, | ||
options = _props$options === undefined ? {} : _props$options; | ||
var config = { | ||
var config = _extends({}, options, { | ||
types: types, | ||
bounds: bounds, | ||
fields: fields | ||
}; | ||
}); | ||
@@ -144,4 +147,5 @@ if (componentRestrictions) { | ||
bounds = _props2.bounds, | ||
options = _props2.options, | ||
apiKey = _props2.apiKey, | ||
rest = _objectWithoutProperties(_props2, ['onPlaceSelected', 'types', 'componentRestrictions', 'bounds', 'apiKey']); | ||
rest = _objectWithoutProperties(_props2, ['onPlaceSelected', 'types', 'componentRestrictions', 'bounds', 'options', 'apiKey']); | ||
@@ -157,3 +161,3 @@ return _react2.default.createElement('input', _extends({ ref: 'input' }, rest)); | ||
onPlaceSelected: _propTypes2.default.func, | ||
types: _propTypes2.default.array, | ||
types: _propTypes2.default.arrayOf(_propTypes2.default.string), | ||
componentRestrictions: _propTypes2.default.object, | ||
@@ -163,2 +167,12 @@ bounds: _propTypes2.default.object, | ||
inputAutocompleteValue: _propTypes2.default.string, | ||
options: _propTypes2.default.shape({ | ||
componentRestrictions: _propTypes2.default.object, | ||
bounds: _propTypes2.default.object, | ||
location: _propTypes2.default.object, | ||
offset: _propTypes2.default.number, | ||
origin: _propTypes2.default.object, | ||
radius: _propTypes2.default.number, | ||
sessionToken: _propTypes2.default.object, | ||
types: _propTypes2.default.arrayOf(_propTypes2.default.string) | ||
}), | ||
apiKey: _propTypes2.default.string | ||
@@ -165,0 +179,0 @@ }; |
{ | ||
"name": "react-google-autocomplete", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "React component for google autocomplete.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -35,2 +35,3 @@ ## React google autocomplete | ||
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. | ||
The `options`(optional) prop is the optional configuration to your Autocomplete instance. You can see full options [here](https://developers.google.com/maps/documentation/javascript/places-autocomplete#add_autocomplete) | ||
@@ -37,0 +38,0 @@ ## Contribution |
@@ -7,3 +7,3 @@ import React from 'react'; | ||
onPlaceSelected: PropTypes.func, | ||
types: PropTypes.array, | ||
types: PropTypes.arrayOf(PropTypes.string), | ||
componentRestrictions: PropTypes.object, | ||
@@ -13,2 +13,12 @@ bounds: PropTypes.object, | ||
inputAutocompleteValue: PropTypes.string, | ||
options: PropTypes.shape({ | ||
componentRestrictions: PropTypes.object, | ||
bounds: PropTypes.object, | ||
location: PropTypes.object, | ||
offset: PropTypes.number, | ||
origin: PropTypes.object, | ||
radius: PropTypes.number, | ||
sessionToken: PropTypes.object, | ||
types: PropTypes.arrayOf(PropTypes.string) | ||
}), | ||
apiKey: PropTypes.string | ||
@@ -24,2 +34,3 @@ }; | ||
componentDidMount() { | ||
// TODO: only take options as configuration object, remove config props from the components props. | ||
const { | ||
@@ -35,5 +46,7 @@ types = ['(cities)'], | ||
'formatted_address' | ||
] | ||
], | ||
options = {} | ||
} = this.props; | ||
const config = { | ||
...options, | ||
types, | ||
@@ -122,2 +135,3 @@ bounds, | ||
bounds, | ||
options, | ||
apiKey, | ||
@@ -124,0 +138,0 @@ ...rest |
19123
383
40