Skip to content

Commit

Permalink
* pick: fix onPopShow triggered multi times.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Jun 6, 2024
1 parent cb4ad13 commit 5bf2d98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pick/src/components/pick.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class Pick<S extends PickState = PickState, O extends PickOptions<S> = Pi

protected _handlePopToggle(opened: boolean) {
const {onPopShown, onPopHidden} = this.props;
if (opened && onPopShown) {
if (opened === true && onPopShown) {
onPopShown.call(this);
} else if (!opened && onPopHidden) {
onPopHidden.call(this);
Expand All @@ -222,7 +222,7 @@ export class Pick<S extends PickState = PickState, O extends PickOptions<S> = Pi
componentWillUpdate(_nextProps: Readonly<O>, nextState: Readonly<S>): void {
const {open: opened} = this.state;
const {open: nextOpened} = nextState;
if (opened === nextOpened) {
if (!opened === !nextOpened) {
return;
}
const {onPopShow, onPopHide} = this.props;
Expand Down

0 comments on commit 5bf2d98

Please sign in to comment.