From 5051bc424a4f508fa8dcff6683c690cc1ab9c2dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Loi=CC=88c=20Padier?= Date: Fri, 7 Aug 2015 13:01:10 +0200 Subject: [PATCH] Added onFocus and onBlur callbacks --- src/Geosuggest.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Geosuggest.jsx b/src/Geosuggest.jsx index f32d56c5..84e4f784 100644 --- a/src/Geosuggest.jsx +++ b/src/Geosuggest.jsx @@ -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 @@ -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 }; }, @@ -99,6 +103,7 @@ var Geosuggest = React.createClass({ * When the input gets focused */ showSuggests: function() { + this.props.onFocus(); this.searchSuggests(); this.setState({isSuggestsHidden: false}); @@ -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);