1
0
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:
Michael An
2025-03-10 14:27:08 +08:00
committed by GitHub
parent 00707d1d05
commit 55719ccbdf
43 changed files with 214 additions and 438 deletions

View File

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