From e82f395426b20dc438b08679a4a292aaafaeb9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=9D=B0?= Date: Mon, 14 Oct 2024 15:40:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dpicker=E5=9C=A8?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=90=8E=E6=97=A0=E6=B3=95=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E7=AC=AC=E4=B8=80=E4=B8=AA=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/cold-kids-happen.md | 5 +++++ .../src/picker/components/Normal/useNormalPicker.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/cold-kids-happen.md diff --git a/.changeset/cold-kids-happen.md b/.changeset/cold-kids-happen.md new file mode 100644 index 000000000..c82d501b2 --- /dev/null +++ b/.changeset/cold-kids-happen.md @@ -0,0 +1,5 @@ +--- +'@td-design/react-native-picker': patch +--- + +fix: 修复picker在取消后无法自动选择第一个选项的bug diff --git a/packages/react-native-picker/src/picker/components/Normal/useNormalPicker.ts b/packages/react-native-picker/src/picker/components/Normal/useNormalPicker.ts index 5c77ed254..1358b8877 100644 --- a/packages/react-native-picker/src/picker/components/Normal/useNormalPicker.ts +++ b/packages/react-native-picker/src/picker/components/Normal/useNormalPicker.ts @@ -32,7 +32,7 @@ export default function useNormalPicker({ }; const handleOk = () => { - onChange?.(selectedValue); + onChange?.(selectedValue || initialValue); onClose?.(); };