diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js index dbcabbc9c15d231c5e73780e97856f1a3212dc43..95d946c02d2d055f575f733ba48c22bdb5f2dc50 100644 --- a/src/components/HeaderSearch/index.js +++ b/src/components/HeaderSearch/index.js @@ -69,14 +69,14 @@ export default class HeaderSearch extends PureComponent { }; enterSearchMode = () => { + const { onVisibleChange } = this.props; + onVisibleChange(true); this.setState({ searchMode: true }, () => { const { searchMode } = this.state; if (searchMode) { this.input.focus(); } }); - const { onVisibleChange } = this.props; - onVisibleChange(true); }; leaveSearchMode = () => { @@ -110,11 +110,9 @@ export default class HeaderSearch extends PureComponent { className={classNames(className, styles.headerSearch)} onClick={this.enterSearchMode} onTransitionEnd={({ propertyName }) => { - if (propertyName === 'width') { - if (!searchMode) { - const { onVisibleChange } = this.props; - onVisibleChange(searchMode); - } + if (propertyName === 'width' && !searchMode) { + const { onVisibleChange } = this.props; + onVisibleChange(searchMode); } }} >