gmaps-places-autocomplete
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -55,5 +55,4 @@ "use strict"; | ||
handleInputChange: { | ||
value: function handleInputChange() { | ||
var userInput = React.findDOMNode(this.refs.geosuggestInput).value; | ||
this.setState({ userInput: userInput }); | ||
value: function handleInputChange(e) { | ||
this.setState({ userInput: e.target.value }); | ||
} | ||
@@ -104,2 +103,23 @@ }, | ||
}, | ||
handleSuggestSelect: { | ||
value: function handleSuggestSelect(suggest) { | ||
if (!suggest) { | ||
suggest = { | ||
label: this.state.userInput | ||
}; | ||
} | ||
this.setState({ | ||
isSuggestsHidden: true, | ||
userInput: suggest.label | ||
}); | ||
if (suggest.location) { | ||
this.props.onSuggestSelect(suggest); | ||
return; | ||
} | ||
this.geocodeSuggest(suggest); | ||
} | ||
}, | ||
updateSuggests: { | ||
@@ -151,23 +171,2 @@ value: function updateSuggests(suggestsGoogle) { | ||
}, | ||
selectSuggest: { | ||
value: function selectSuggest(suggest) { | ||
if (!suggest) { | ||
suggest = { | ||
label: this.state.userInput | ||
}; | ||
} | ||
this.setState({ | ||
isSuggestsHidden: true, | ||
userInput: suggest.label | ||
}); | ||
if (suggest.location) { | ||
this.props.onSuggestSelect(suggest); | ||
return; | ||
} | ||
this.geocodeSuggest(suggest); | ||
} | ||
}, | ||
geocodeSuggest: { | ||
@@ -206,3 +205,3 @@ value: function geocodeSuggest(suggest) { | ||
isActive: isActive, | ||
onSuggestSelect: _this.selectSuggest | ||
onSuggestSelect: _this.handleSuggestSelect | ||
}); | ||
@@ -216,3 +215,3 @@ }); | ||
"div", | ||
{ className: "geosuggest", onClick: this.onClick.bind(this) }, | ||
{ className: "geosuggest" }, | ||
React.createElement("input", { | ||
@@ -219,0 +218,0 @@ className: "geosuggest__input", |
{ | ||
"name": "gmaps-places-autocomplete", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A React autosuggest input for the Google Maps Places API.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -29,6 +29,5 @@ import React from 'react'; | ||
handleInputChange() { | ||
let userInput = (React.findDOMNode(this.refs.geosuggestInput)).value; | ||
this.setState({userInput: userInput}); | ||
} | ||
handleInputChange(e) { | ||
this.setState({userInput: e.target.value}); | ||
} | ||
@@ -68,2 +67,22 @@ handleInputFocus() { | ||
handleSuggestSelect(suggest) { | ||
if (!suggest) { | ||
suggest = { | ||
label: this.state.userInput | ||
}; | ||
} | ||
this.setState({ | ||
isSuggestsHidden: true, | ||
userInput: suggest.label | ||
}); | ||
if (suggest.location) { | ||
this.props.onSuggestSelect(suggest); | ||
return; | ||
} | ||
this.geocodeSuggest(suggest); | ||
} | ||
updateSuggests(suggestsGoogle) { | ||
@@ -113,23 +132,3 @@ let suggests = []; | ||
selectSuggest(suggest) { | ||
if (!suggest) { | ||
suggest = { | ||
label: this.state.userInput | ||
}; | ||
} | ||
this.setState({ | ||
isSuggestsHidden: true, | ||
userInput: suggest.label | ||
}); | ||
if (suggest.location) { | ||
this.props.onSuggestSelect(suggest); | ||
return; | ||
} | ||
this.geocodeSuggest(suggest); | ||
} | ||
geocodeSuggest(suggest) { | ||
geocodeSuggest(suggest) { | ||
this.state.geocoder.geocode({ | ||
@@ -160,3 +159,3 @@ address: suggest.label | ||
isActive={isActive} | ||
onSuggestSelect={this.selectSuggest} | ||
onSuggestSelect={this.handleSuggestSelect} | ||
/> | ||
@@ -169,3 +168,3 @@ ); | ||
return ( | ||
<div className="geosuggest" onClick={this.onClick.bind(this)}> | ||
<div className="geosuggest"> | ||
<input | ||
@@ -172,0 +171,0 @@ className="geosuggest__input" |
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
19186
485