From 1b0f2904ffaa09aa183cb663243abd1b12e0692d Mon Sep 17 00:00:00 2001 From: Chen Yu Date: Thu, 28 Sep 2023 03:05:50 +0900 Subject: [PATCH] fix: patch label of textfield when it's not a string (#2851) --- .../neuron-ui/src/widgets/TextField/index.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/neuron-ui/src/widgets/TextField/index.tsx b/packages/neuron-ui/src/widgets/TextField/index.tsx index a7dc1769bc..2f86f88783 100644 --- a/packages/neuron-ui/src/widgets/TextField/index.tsx +++ b/packages/neuron-ui/src/widgets/TextField/index.tsx @@ -30,7 +30,7 @@ const TextField = React.forwardRef( ...rest }: { field: string - label?: string + label?: string | React.ReactNode value?: string hint?: string error?: string @@ -58,6 +58,8 @@ const TextField = React.forwardRef( const changePasswordHide = useCallback(() => { setIsPasswordHidden(v => !v) }, [setIsPasswordHidden]) + // FIXME: label should be limited to a string because it has its own semantic meaning + const labelStr = typeof label === 'string' ? label : field return (
{label ? ( -