From 40cf1b512995f216ac0547aee0a0f234f1904b34 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Tue, 25 Oct 2022 20:39:03 +0800 Subject: [PATCH] build: resolve ts problems --- src/collapse/Collapse.tsx | 3 ++- src/picker/PickerView.tsx | 5 +++-- src/textarea/type.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/collapse/Collapse.tsx b/src/collapse/Collapse.tsx index 3f6acd9e..9f195e5a 100644 --- a/src/collapse/Collapse.tsx +++ b/src/collapse/Collapse.tsx @@ -99,7 +99,8 @@ const Collapse = function(props: CollapseProps) { if (!React.isValidElement(child)) { return child; } - return React.cloneElement(child, {value: index}) + const childProps = { value: index } + return React.cloneElement(child, childProps) })} diff --git a/src/picker/PickerView.tsx b/src/picker/PickerView.tsx index fe6ca352..cdda9c30 100644 --- a/src/picker/PickerView.tsx +++ b/src/picker/PickerView.tsx @@ -34,11 +34,12 @@ const PickerView: FC = (props) => { if (isUndefined(innerValue[index])) { innerValue[index] = innerDefaultValue[index]; } - return React.cloneElement(child, { + const childProps = { value: value && value[index], defaultValue: innerDefaultValue[index], itemIndex: index, - }); + }; + return React.cloneElement(child, childProps); }); const [internalValue, setInternalValue] = useDefault(innerValue, innerDefaultValue, onChange); diff --git a/src/textarea/type.ts b/src/textarea/type.ts index 3c41890f..3d4b6c11 100644 --- a/src/textarea/type.ts +++ b/src/textarea/type.ts @@ -17,7 +17,7 @@ export interface TdTextareaProps { * 是否自动增高,值为 autosize 时,style.height 不生效 * @default false */ - autosize?: boolean; + autosize?: boolean | { minRows?: number; maxRows?: number }; /** * 是否禁用文本框 * @default false