From d7642dd960fcd06a37855101a4f072032c3cdac4 Mon Sep 17 00:00:00 2001 From: zombiej Date: Tue, 20 Oct 2020 16:05:14 +0800 Subject: [PATCH 1/2] chore: Show scrollbar when open --- package.json | 2 +- src/OptionList.tsx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0d4aaba81..661a89fc4 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "rc-motion": "^2.0.1", "rc-trigger": "^5.0.4", "rc-util": "^5.0.1", - "rc-virtual-list": "^3.0.3", + "rc-virtual-list": "^3.2.0", "warning": "^4.0.3" }, "devDependencies": { diff --git a/src/OptionList.tsx b/src/OptionList.tsx index d3864c56d..e2691c555 100644 --- a/src/OptionList.tsx +++ b/src/OptionList.tsx @@ -154,6 +154,11 @@ const OptionList: React.RefForwardingComponent< } }); + // Force trigger scrollbar visible when open + if (open) { + listRef.current.scrollTo(undefined); + } + return () => clearTimeout(timeoutId); }, [open]); From 536c55e0218097f2505983ea61bd990bb087cf6b Mon Sep 17 00:00:00 2001 From: zombiej Date: Tue, 20 Oct 2020 16:13:23 +0800 Subject: [PATCH 2/2] fix logic --- src/OptionList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OptionList.tsx b/src/OptionList.tsx index e2691c555..d2f7738ab 100644 --- a/src/OptionList.tsx +++ b/src/OptionList.tsx @@ -156,7 +156,7 @@ const OptionList: React.RefForwardingComponent< // Force trigger scrollbar visible when open if (open) { - listRef.current.scrollTo(undefined); + listRef.current?.scrollTo(undefined); } return () => clearTimeout(timeoutId);