diff --git a/.changeset/shiny-months-roll.md b/.changeset/shiny-months-roll.md new file mode 100644 index 0000000000..9ad456ecb3 --- /dev/null +++ b/.changeset/shiny-months-roll.md @@ -0,0 +1,5 @@ +--- +'@td-design/react-native': patch +--- + +fix: 修复 TextArea 的标签高度跟其他表单项不一致的问题 diff --git a/packages/react-native/src/form/FormItem.tsx b/packages/react-native/src/form/FormItem.tsx index 456f11696d..f581c80962 100644 --- a/packages/react-native/src/form/FormItem.tsx +++ b/packages/react-native/src/form/FormItem.tsx @@ -56,7 +56,7 @@ const FormItem: FC = ({ children, type = 'bottom', name, ...field return ( = ({ children, type = 'bottom', name, ...field {React.cloneElement(children, { ref, brief: Error, + labelHeight: formItemHeight, })} diff --git a/packages/react-native/src/form/FormListItem.tsx b/packages/react-native/src/form/FormListItem.tsx index 299a23cb73..47302efa36 100644 --- a/packages/react-native/src/form/FormListItem.tsx +++ b/packages/react-native/src/form/FormListItem.tsx @@ -64,7 +64,7 @@ const FormListItem: FC = ({ } style={[ { - height: formItemHeight, + minHeight: formItemHeight, paddingHorizontal: 0, }, errors.length > 0 diff --git a/packages/react-native/src/input/TextArea.tsx b/packages/react-native/src/input/TextArea.tsx index 6a761c3d54..3fa50e6344 100644 --- a/packages/react-native/src/input/TextArea.tsx +++ b/packages/react-native/src/input/TextArea.tsx @@ -31,11 +31,25 @@ export interface TextAreaProps style?: StyleProp; /** 额外内容 */ brief?: ReactNode; + /** 在表单项里时 label 的高度应该要跟其他的高度保持一致 */ + labelHeight?: number; } const TextArea = forwardRef( ( - { label, height = px(150), limit, value = '', border = true, onChange, style, brief, required, ...restProps }, + { + label, + height = px(150), + limit, + value = '', + border = true, + onChange, + style, + brief, + required, + labelHeight, + ...restProps + }, ref ) => { const theme = useTheme(); @@ -53,7 +67,7 @@ const TextArea = forwardRef( return ( -