forked from vergnet/application-amicale
fixed focus repeating every 500ms
This commit is contained in:
parent
ab7e8f92fc
commit
4cb0d2f8b5
1 changed files with 2 additions and 2 deletions
|
@ -43,9 +43,9 @@ export default class CustomHeader extends React.Component<Props> {
|
|||
};
|
||||
|
||||
componentDidMount() {
|
||||
if (this.refs.searchInput !== undefined && this.props.shouldFocusSearchBar) {
|
||||
if (this.refs.searchInput !== undefined && this.refs.searchInput._root !== undefined && this.props.shouldFocusSearchBar) {
|
||||
// does not work if called to early for some reason...
|
||||
setInterval(() => this.refs.searchInput._root.focus(), 500);
|
||||
setTimeout(() => this.refs.searchInput._root.focus(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue