this.removeTab(child.key as string, e)}
- />
- ) : null;
- childrenWithClose.push(
- React.cloneElement(child, {
- tab: (
-
- {child.props.tab}
- {closeIcon}
-
- ),
- key: child.key || index,
- }),
- );
- },
- );
+ React.Children.forEach(children as React.ReactNode, (child, index) => {
+ if (!React.isValidElement(child)) return child;
+ let closable = child.props.closable;
+ closable = typeof closable === 'undefined' ? true : closable;
+ const closeIcon = closable ? (
+ this.removeTab(child.key as string, e)}
+ />
+ ) : null;
+ childrenWithClose.push(
+ React.cloneElement(child, {
+ tab: (
+
+ {child.props.tab}
+ {closeIcon}
+
+ ),
+ key: child.key || index,
+ }),
+ );
+ });
// Add new tab handler
if (!hideAdd) {
tabBarExtraContent = (