Skip to content

Commit 38a8a5e

Browse files
committed
wrapping span to avoid expandIcon is a Higher Component (#471)
1 parent 5b2b4e9 commit 38a8a5e

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/hooks/useColumns.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,11 @@ function useColumns<RecordType>(
165165
record,
166166
onExpand: onTriggerExpand,
167167
});
168-
return React.isValidElement(icon)
169-
? React.cloneElement(icon, {
170-
onClick: (e: MouseEvent) => {
171-
if (expandRowByClick) {
172-
e.stopPropagation();
173-
}
174-
if (icon && icon.props && icon.props.onClick) {
175-
icon.props.onClick(e);
176-
}
177-
},
178-
})
179-
: icon;
168+
169+
if (expandRowByClick) {
170+
return <span onClick={e => e.stopPropagation()}>{icon}</span>;
171+
}
172+
return icon;
180173
},
181174
};
182175

0 commit comments

Comments
 (0)