Skip to content

Commit

Permalink
Added onFocus and onBlur callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
lPadier committed Aug 7, 2015
1 parent f8abe46 commit 5051bc4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Geosuggest.jsx
Expand Up @@ -3,6 +3,8 @@
var React = require('react'),
GeosuggestItem = require('./GeosuggestItem.jsx'); // eslint-disable-line

var noop = function() {};

var Geosuggest = React.createClass({
/**
* Get the default props
Expand All @@ -17,7 +19,9 @@ var Geosuggest = React.createClass({
onSuggestSelect: function() {},
location: null,
radius: 0,
googleMaps: google && google.maps
googleMaps: google && google.maps,
onFocus: noop,
onBlur: noop
};
},

Expand Down Expand Up @@ -99,6 +103,7 @@ var Geosuggest = React.createClass({
* When the input gets focused
*/
showSuggests: function() {
this.props.onFocus();
this.searchSuggests();

this.setState({isSuggestsHidden: false});
Expand All @@ -108,6 +113,7 @@ var Geosuggest = React.createClass({
* When the input loses focused
*/
hideSuggests: function() {
this.props.onBlur();
setTimeout(function() {
this.setState({isSuggestsHidden: true});
}.bind(this), 100);
Expand Down

0 comments on commit 5051bc4

Please sign in to comment.