From f060bbd258017e431cf903393775b700440a23b2 Mon Sep 17 00:00:00 2001 From: Yueyanc <38248854+Yueyanc@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:36:46 +0800 Subject: [PATCH] fix: pick strictly equal --- src/components/picker-view/wheel.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/picker-view/wheel.tsx b/src/components/picker-view/wheel.tsx index a5d19203e7..b5bf557ad4 100644 --- a/src/components/picker-view/wheel.tsx +++ b/src/components/picker-view/wheel.tsx @@ -59,7 +59,7 @@ export const Wheel = memo( useIsomorphicLayoutEffect(() => { if (draggingRef.current) return if (value === null) return - const targetIndex = column.findIndex(item => item.value === value) + const targetIndex = column.findIndex(item => item.value == value) if (targetIndex < 0) return const finalPosition = targetIndex * -itemHeight.current api.start({ y: finalPosition, immediate: y.goal !== finalPosition }) @@ -71,7 +71,7 @@ export const Wheel = memo( onSelect(null) } } else { - if (!column.some(item => item.value === value)) { + if (!column.some(item => item.value == value)) { const firstItem = column[0] onSelect(firstItem.value) } @@ -269,7 +269,7 @@ export const Wheel = memo( aria-hidden > {column.map((item, index) => { - const selected = props.value === item.value + const selected = props.value == item.value if (selected) selectedIndex = index function handleClick() { draggingRef.current = false @@ -278,7 +278,7 @@ export const Wheel = memo( return (