From c66d622ae0476c476dcbc71fcd758eeca62c2d88 Mon Sep 17 00:00:00 2001 From: kkaaddff <36986519+kkaaddff@users.noreply.github.com> Date: Tue, 8 Dec 2020 16:02:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9Efix(Dropdown):=20onVisibleChang?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit click on menu content trigger onVisibleChange --- src/Dropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index b22f9f9..b94435e 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -69,7 +69,7 @@ function Dropdown(props: DropdownProps, ref) { const onClick = e => { const { onOverlayClick } = props; const overlayProps = getOverlayElement().props; - setTriggerVisible(false); + onVisibleChange(false); if (onOverlayClick) { onOverlayClick(e); From c21c4c0882abbf4daffd3949aa177f803454a09c Mon Sep 17 00:00:00 2001 From: kkaaddff <36986519+kkaaddff@users.noreply.github.com> Date: Tue, 8 Dec 2020 18:43:35 +0800 Subject: [PATCH 2/3] Update Dropdown.tsx onVisibleChange --- src/Dropdown.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index b94435e..bf72223 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -65,6 +65,14 @@ function Dropdown(props: DropdownProps, ref) { } return overlayElement; }; + + const onVisibleChange = (visible: boolean) => { + const { onVisibleChange } = props; + setTriggerVisible(visible); + if (typeof onVisibleChange === 'function') { + onVisibleChange(visible); + } + }; const onClick = e => { const { onOverlayClick } = props; @@ -79,14 +87,6 @@ function Dropdown(props: DropdownProps, ref) { } }; - const onVisibleChange = (visible: boolean) => { - const { onVisibleChange } = props; - setTriggerVisible(visible); - if (typeof onVisibleChange === 'function') { - onVisibleChange(visible); - } - }; - const getMenuElement = () => { const overlayElement = getOverlayElement(); const extraOverlayProps = { From b77feb8630e3570399c9e48feeedb35570203b04 Mon Sep 17 00:00:00 2001 From: kkaaddff <36986519+kkaaddff@users.noreply.github.com> Date: Tue, 8 Dec 2020 20:06:13 +0800 Subject: [PATCH 3/3] Update Dropdown.tsx --- src/Dropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index bf72223..b9542fd 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -65,7 +65,7 @@ function Dropdown(props: DropdownProps, ref) { } return overlayElement; }; - + const onVisibleChange = (visible: boolean) => { const { onVisibleChange } = props; setTriggerVisible(visible);