1
0
Fork 0
mirror of https://github.com/Alamantus/Lexiconga.git synced 2025-03-25 12:50:45 +01:00

Focus search box when opening search header

This commit is contained in:
Robbie Antenesse 2017-06-25 14:48:19 -06:00
parent b8354a3ae5
commit b5d57393c2

View file

@ -18,6 +18,12 @@ export class SearchBox extends Component {
};
}
componentDidUpdate(prevProps, prevState) {
if (this.state.showHeader && this.searchBox) {
this.searchBox.focus();
}
}
search () {
const {searchingIn, searchTerm, filteredPartsOfSpeech} = this.state;
const searchConfig = {
@ -57,6 +63,9 @@ export class SearchBox extends Component {
</p>
<p className='control is-expanded'>
<input className='input' type='text' placeholder='Search Term'
ref={input => {
this.searchBox = input;
}}
value={this.state.searchTerm}
onChange={event => {
console.log(event);