{
}}
speed={speed}
pageSize={pageSize}
hammerOptions={tabBarhammerOptions}
styles={{
inkBar: {
width: this.props.inkBarWidth,
},
}}
/>
);
}
return (
);
}
renderAllBtn(fix) {
const { locale } = this.props;
const bottom = fix === 'fix-bottom';
const BottomIcon = bottom ? Top : Bottom;
/* eslint-disable react/no-array-index-key */
return (
{
this.allTitle = ref;
}}
className={prefixClass('tab-all-title PA')}
>
{i18n[locale].allCategories}
{
this.arrowBtnWrap = ref;
}}
className={prefixClass('tab-all PA FBH FBAC FBJC')}
onClick={() => {
this.toggleAll();
}}
>
{
this.allTabs = ref;
}}
className={prefixClass('tab-all-body FBH')}
>
{this.tabs.map((item, i) => (
- { this.handleItemClick(item.key, item.datas, e); }}
className={classnames(prefixClass('tab-all-item'), {
[prefixClass('tab-all-item__disabled')]: `${item.key}` === `${this.state.activeKey}`,
[prefixClass('tab-all-item-row-last')]: i % 3 === 2,
})}
role="menuitem"
>
{item.title}
))}
);
/* eslint-enable react/no-array-index-key */
}
render() {
const { children, wrapClassName } = this.props;
const shouldFixBug = isChromeLargerThan55();
const clonedChildren = [];
let fix = '';
if (this.props.fixedTop) {
fix = 'fix-top';
} else if (this.props.fixedBottom) {
fix = 'fix-bottom';
}
this.tabs = [];
React.Children.forEach(children, (child, index) => {
if (!child) return;
this.tabs.push({
title: child.props.title,
key: child.key || index,
data: child.props.data,
});
clonedChildren.push(React.cloneElement(child, {
tab: child.props.title,
key: child.key || index,
}));
});
const showAllBtn = this.props.showExpandAll && this.tabs.length > this.props.pageSize;
return (
{
this.root = ref;
}}
className={classnames(prefixClass(`tab-wrap PR ${fix}`), {
[prefixClass('tab-pan-bugfix')]: shouldFixBug,
'show-all-btn': showAllBtn,
[wrapClassName]: !!wrapClassName,
})}
>
{ this.handleTabChange(key); }}
>
{clonedChildren}
{showAllBtn ?
this.renderAllBtn(fix) : null}
);
}
}
polyfill(Tabs);
export default Tabs;