Skip to content

Commit a887d56

Browse files
Linkodtli-jia-nan
andauthored
fix(MeasureRow): clone the column without ref so that ref can point to the real columnHeader. (#1362)
* fix(MeasureRow): clone the column without ref so that ref can point to the real columnHeader. * fix(Body/MeasureRow): fix the type error when clone ReactElement * Refactor titleForMeasure assignment logic --------- Co-authored-by: lijianan <574980606@qq.com>
1 parent ee7bfc1 commit a887d56

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Body/MeasureRow.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,16 @@ const MeasureRow: React.FC<MeasureRowProps> = ({
3636
>
3737
{columnsKey.map(columnKey => {
3838
const column = columns.find(col => col.key === columnKey);
39+
const rawTitle = column?.title;
40+
const titleForMeasure = React.isValidElement<React.RefAttributes<any>>(rawTitle)
41+
? React.cloneElement(rawTitle, { ref: null })
42+
: rawTitle;
3943
return (
4044
<MeasureCell
4145
key={columnKey}
4246
columnKey={columnKey}
4347
onColumnResize={onColumnResize}
44-
title={column?.title}
48+
title={titleForMeasure}
4549
/>
4650
);
4751
})}

0 commit comments

Comments
 (0)