Skip to content

Commit

Permalink
chore(release): version 1.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ro-ka committed Oct 22, 2015
1 parent 8fadde7 commit 7d66eb7
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 10 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 1.12.0 (2015-10-22)


#### Bug Fixes

* doc comments, backward compatible changes ([96cca392](https://github.com/ubilabs/react-geosuggest/commit/96cca392f5b569247523cf784d34f1e1eb8b89d8))
* add copy css in build module ([bb988a1c](https://github.com/ubilabs/react-geosuggest/commit/bb988a1c5bf3079b170cd24c79bbd21093f49f93))
* googleMaps object moved out of props and set in componentDidMount ([955812df](https://github.com/ubilabs/react-geosuggest/commit/955812dfb702e8ea6318d89b2ef36d866c5c4354))


### 1.11.1 (2015-10-12)


Expand Down
44 changes: 36 additions & 8 deletions dist/react-geosuggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var Geosuggest = _react2['default'].createClass({
bounds: null,
country: null,
types: null,
googleMaps: google && google.maps,
googleMaps: null,
onSuggestSelect: function onSuggestSelect() {},
onFocus: function onFocus() {},
onBlur: function onBlur() {},
Expand All @@ -56,9 +56,7 @@ var Geosuggest = _react2['default'].createClass({
isSuggestsHidden: true,
userInput: this.props.initialValue,
activeSuggest: null,
suggests: [],
geocoder: new this.props.googleMaps.Geocoder(),
autocompleteService: new this.props.googleMaps.places.AutocompleteService()
suggests: []
};
},

Expand All @@ -72,6 +70,36 @@ var Geosuggest = _react2['default'].createClass({
}
},

/**
* Called on the client side after component is mounted.
* Google api sdk object will be obtained and cached as a instance property.
* Necessary objects of google api will also be determined and saved.
*/
componentDidMount: function componentDidMount() {
this.setInputValue(this.props.initialValue);

var googleMaps = this.props.googleMaps || google && google.maps || this.googleMaps;

if (!googleMaps) {
console.error('Google map api was not found in the page.');
} else {
this.googleMaps = googleMaps;
}

this.autocompleteService = new googleMaps.places.AutocompleteService();
this.geocoder = new googleMaps.Geocoder();
},

/**
* Method used for setting initial value.
* @param {string} value to set in input
*/
setInputValue: function setInputValue(value) {
this.setState({
userInput: value
});
},

/**
* When the input got changed
*/
Expand Down Expand Up @@ -121,7 +149,7 @@ var Geosuggest = _react2['default'].createClass({

var options = {
input: this.state.userInput,
location: this.props.location || new this.props.googleMaps.LatLng(0, 0),
location: this.props.location || new this.googleMaps.LatLng(0, 0),
radius: this.props.radius
};

Expand All @@ -139,7 +167,7 @@ var Geosuggest = _react2['default'].createClass({
};
}

this.state.autocompleteService.getPlacePredictions(options, (function (suggestsGoogle) {
this.autocompleteService.getPlacePredictions(options, (function (suggestsGoogle) {
this.updateSuggests(suggestsGoogle);

if (this.props.autoActivateFirstSuggest) {
Expand Down Expand Up @@ -296,8 +324,8 @@ var Geosuggest = _react2['default'].createClass({
* @param {Object} suggest The suggest
*/
geocodeSuggest: function geocodeSuggest(suggest) {
this.state.geocoder.geocode({ address: suggest.label }, (function (results, status) {
if (status !== this.props.googleMaps.GeocoderStatus.OK) {
this.geocoder.geocode({ address: suggest.label }, (function (results, status) {
if (status !== this.googleMaps.GeocoderStatus.OK) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/react-geosuggest.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-geosuggest",
"version": "1.11.1",
"version": "1.12.0",
"description": "A React autosuggest for the Google Maps Places API.",
"main": "module/Geosuggest.js",
"author": "Robert Katzki <katzki@ubilabs.net>",
Expand Down

0 comments on commit 7d66eb7

Please sign in to comment.