Skip to content

Commit 926341b

Browse files
authored
update: searchBar组件focus (#1526)
* update: searchBar组件focus * update: searchBar组件focus
1 parent f5cb72d commit 926341b

File tree

1 file changed

+6
-0
lines changed
  • packages/taro-ui/src/components/search-bar

1 file changed

+6
-0
lines changed

packages/taro-ui/src/components/search-bar/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ export default class AtSearchBar extends React.Component<
5959
this.props.onActionClick && this.props.onActionClick(event)
6060
}
6161

62+
public UNSAFE_componentWillReceiveProps(nextProps: AtSearchBarProps): void {
63+
if (nextProps.focus !== this.props.focus) {
64+
this.setState({ isFocus: !!nextProps.focus })
65+
}
66+
}
67+
6268
public render(): JSX.Element {
6369
const {
6470
value,

0 commit comments

Comments
 (0)