diff --git a/components/CustomHeader.js b/components/CustomHeader.js index 837e8d6..9ca3104 100644 --- a/components/CustomHeader.js +++ b/components/CustomHeader.js @@ -43,9 +43,9 @@ export default class CustomHeader extends React.Component { }; 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); } }