mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-13 13:50:07 +00:00
remove react old defaultProps (#7576)
This commit is contained in:
@@ -24,7 +24,7 @@ class SearchInput extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
searchValue: props.value,
|
||||
searchValue: props.value || '',
|
||||
};
|
||||
this.isInputtingChinese = false;
|
||||
this.timer = null;
|
||||
@@ -57,7 +57,7 @@ class SearchInput extends Component {
|
||||
|
||||
onChange = (e) => {
|
||||
this.timer && clearTimeout(this.timer);
|
||||
const { onChange, wait } = this.props;
|
||||
const { onChange, wait = 100 } = this.props;
|
||||
let text = e.target.value;
|
||||
this.setState({ searchValue: text || '' }, () => {
|
||||
if (this.isInputtingChinese) return;
|
||||
@@ -104,7 +104,7 @@ class SearchInput extends Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { placeholder, autoFocus, className, onKeyDown, disabled, style } = this.props;
|
||||
const { placeholder, autoFocus, className, onKeyDown, disabled = false, style } = this.props;
|
||||
const { searchValue } = this.state;
|
||||
|
||||
return (
|
||||
@@ -131,10 +131,4 @@ class SearchInput extends Component {
|
||||
|
||||
SearchInput.propTypes = propTypes;
|
||||
|
||||
SearchInput.defaultProps = {
|
||||
wait: 100,
|
||||
disabled: false,
|
||||
value: '',
|
||||
};
|
||||
|
||||
export default SearchInput;
|
||||
|
Reference in New Issue
Block a user