From 5bf2d9801bad72ad88ac321b6c4f0328dd26b34d Mon Sep 17 00:00:00 2001 From: sunhao Date: Thu, 6 Jun 2024 09:36:52 +0800 Subject: [PATCH] * pick: fix onPopShow triggered multi times. --- lib/pick/src/components/pick.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pick/src/components/pick.tsx b/lib/pick/src/components/pick.tsx index 4280eebd1f..c75fd1110b 100644 --- a/lib/pick/src/components/pick.tsx +++ b/lib/pick/src/components/pick.tsx @@ -198,7 +198,7 @@ export class Pick = 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); @@ -222,7 +222,7 @@ export class Pick = Pi componentWillUpdate(_nextProps: Readonly, nextState: Readonly): void { const {open: opened} = this.state; const {open: nextOpened} = nextState; - if (opened === nextOpened) { + if (!opened === !nextOpened) { return; } const {onPopShow, onPopHide} = this.props;