From 6306c2f54395b407afbfac997222c426a1e96d42 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 8 Nov 2017 14:41:56 +0800 Subject: [PATCH] Fix HeaderSearch onPressEnter, close #131 --- src/components/HeaderSearch/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js index 5d58b110..5fd3f5f5 100644 --- a/src/components/HeaderSearch/index.js +++ b/src/components/HeaderSearch/index.js @@ -8,7 +8,6 @@ export default class HeaderSearch extends PureComponent { static defaultProps = { defaultActiveFirstOption: false, onPressEnter: () => {}, - onChange: () => {}, onSearch: () => {}, className: '', placeholder: '', @@ -19,7 +18,6 @@ export default class HeaderSearch extends PureComponent { placeholder: PropTypes.string, onSearch: PropTypes.func, onPressEnter: PropTypes.func, - onChange: PropTypes.func, defaultActiveFirstOption: PropTypes.bool, dataSource: PropTypes.array, }; @@ -39,7 +37,9 @@ export default class HeaderSearch extends PureComponent { } onChange = (value) => { this.setState({ value }); - this.props.onChange(); + if (this.props.onChange) { + this.props.onChange(); + } } enterSearchMode = () => { this.setState({ searchMode: true }, () => { @@ -66,10 +66,10 @@ export default class HeaderSearch extends PureComponent { >