fixed focus repeating every 500ms

Esse commit está contido em:
keplyx 2019-11-15 19:38:43 +01:00
commit 4cb0d2f8b5

Ver arquivo

@ -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);
}
}