Skip to content

Commit

Permalink
feat: add blur()
Browse files Browse the repository at this point in the history
  • Loading branch information
ro-ka committed Dec 14, 2016
1 parent d706366 commit d16c610
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -242,6 +242,9 @@ These functions are accessible by setting "ref" on the component (see example be
#### focus()
Call `focus` to focus on the element. The suggest list will be expanded with the current suggestions.

#### blur()
Call `blur` to blur (unfocus) the element. The suggest list will be closed.

#### update(value)
It is possible to update the value of the input contained within the GeoSuggest component by calling the `update` function with a new desired `value` of the type String.

Expand Down
7 changes: 7 additions & 0 deletions src/Geosuggest.jsx
Expand Up @@ -144,6 +144,13 @@ class Geosuggest extends React.Component {
this.refs.input.focus();
}

/**
* Blur the input
*/
blur() {
this.refs.input.blur();
}

/**
* Update the value of the user input
* @param {String} userInput the new value of the user input
Expand Down
7 changes: 7 additions & 0 deletions src/input.jsx
Expand Up @@ -91,6 +91,13 @@ class Input extends React.Component {
this.refs.input.focus();
}

/**
* Blur the input
*/
blur() {
this.refs.input.blur();
}

/**
* Render the view
* @return {Function} The React element to render
Expand Down

0 comments on commit d16c610

Please sign in to comment.