react-geosuggest-updated
Advanced tools
Comparing version 2.3.7 to 2.3.8
@@ -380,2 +380,11 @@ 'use strict'; | ||
suggests = suggests.map(function (suggest) { | ||
var data = _this3.geocode(suggest); | ||
console.log(data); | ||
var newSuggest = suggest; | ||
newSuggest.gmaps = data.gmaps; | ||
newSuggest.location = data.location; | ||
return newSuggest; | ||
}); | ||
console.log(suggests); | ||
this.props.getSuggests(suggests); | ||
@@ -508,3 +517,39 @@ activeSuggest = this.updateActiveSuggest(suggests); | ||
} | ||
}, { | ||
key: 'geocode', | ||
value: function geocode(suggest) { | ||
var _this5 = this; | ||
var options = null; | ||
if (suggest.placeId && !suggest.isFixture) { | ||
options = { | ||
placeId: suggest.placeId | ||
}; | ||
} else { | ||
options = { | ||
address: suggest.label, | ||
location: this.props.location, | ||
bounds: this.props.bounds, | ||
componentRestrictions: this.props.country ? { country: this.props.country } : null | ||
}; | ||
} | ||
var data = { | ||
gmaps: null, | ||
location: {} | ||
}; | ||
this.geocoder.geocode(options, function (results, status) { | ||
if (status === _this5.googleMaps.GeocoderStatus.OK) { | ||
var gmaps = results[0], | ||
location = gmaps.geometry.location; | ||
data.gmaps = gmaps; | ||
data.location = { | ||
lat: location.lat(), | ||
lng: location.lng() | ||
}; | ||
} | ||
}); | ||
return data; | ||
} | ||
/** | ||
@@ -518,3 +563,3 @@ * Render the view | ||
value: function render() { | ||
var _this5 = this; | ||
var _this6 = this; | ||
@@ -526,3 +571,3 @@ var attributes = (0, _filterInputAttributes2.default)(this.props), | ||
ref: function ref(i) { | ||
return _this5.input = i; | ||
return _this6.input = i; | ||
}, | ||
@@ -529,0 +574,0 @@ value: this.state.userInput, |
{ | ||
"name": "react-geosuggest-updated", | ||
"version": "2.3.7", | ||
"version": "2.3.8", | ||
"description": "A React autosuggest for the Google Maps Places API.", | ||
@@ -5,0 +5,0 @@ "main": "module/Geosuggest.js", |
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
270963
4302