Skip to content

Commit

Permalink
Remove defaults for search radius and location.
Browse files Browse the repository at this point in the history
By using LatLng(0, 0) as the default location, react-geosuggest was biasing
results to the Gulf of Guinea.

When radius and location are not supplied to Google's AutocompleteService, it
biases results based on the estimated location of the clients IP address.
  • Loading branch information
escholtz committed Oct 29, 2015
1 parent 7d66eb7 commit 17f0bf0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Geosuggest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Geosuggest = React.createClass({
disabled: false,
className: '',
location: null,
radius: 0,
radius: null,
bounds: null,
country: null,
types: null,
Expand Down Expand Up @@ -133,11 +133,17 @@ const Geosuggest = React.createClass({
}

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

if (this.props.location) {
options.location = this.props.location;
}

if (this.props.radius) {
options.radius = this.props.radius;
}

if (this.props.bounds) {
options.bounds = this.props.bounds;
}
Expand Down

0 comments on commit 17f0bf0

Please sign in to comment.