From 5c7281eda148004416574731f7711c06cbb19718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=85=A7=E6=98=8E=E8=83=A7?= <25151442+mmmml-zhao@users.noreply.github.com> Date: Sun, 22 Sep 2024 10:34:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20useControllableValue=20=E5=BD=93props?= =?UTF-8?q?=E4=B8=BAnull=E6=97=B6=E4=BB=A3=E7=A0=81=E5=85=BC=E5=AE=B9(#263?= =?UTF-8?q?0)=20(#2636)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hooks/src/useControllableValue/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/hooks/src/useControllableValue/index.ts b/packages/hooks/src/useControllableValue/index.ts index eb656966c8..6fa2f1384b 100644 --- a/packages/hooks/src/useControllableValue/index.ts +++ b/packages/hooks/src/useControllableValue/index.ts @@ -26,7 +26,9 @@ function useControllableValue( props?: Props, options?: Options, ): [T, (v: SetStateAction, ...args: any[]) => void]; -function useControllableValue(props: Props = {}, options: Options = {}) { +function useControllableValue(defaultProps: Props, options: Options = {}) { + const props = defaultProps ?? {}; + const { defaultValue, defaultValuePropName = 'defaultValue',