Skip to content

Commit

Permalink
fix: search
Browse files Browse the repository at this point in the history
  • Loading branch information
linjinze999 committed Dec 16, 2024
1 parent 0959059 commit 82dae25
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/hippy_ui_react/src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import { isWeb } from '../../utils/Utils';
* @visibleName Search 搜索框
*/
export class Search extends Component<SearchProps, SearchState> {
state: SearchState = {
value: '',
};
constructor(props: SearchProps) {
super(props);
this.state = {
value: props.inputProps?.value || props.inputProps?.defaultValue || '',
};
}

private isSubmitByClear = false;
public refInput: TextInput | null = null;
Expand Down Expand Up @@ -70,6 +73,9 @@ export class Search extends Component<SearchProps, SearchState> {
* */
public setValue = (value: string) => {
this.refInput?.setValue(value);
this.setState({
value,
});
};

/**
Expand Down

0 comments on commit 82dae25

Please sign in to comment.