Skip to content

Commit 9e74910

Browse files
authored
feat: retire deprecated api (#768)
1 parent 14ed495 commit 9e74910

File tree

6 files changed

+2
-84
lines changed

6 files changed

+2
-84
lines changed

docs/demo/renderTabBar-use-panes.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/examples/renderTabBar-use-panes.tsx

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/TabNavList/Wrapper.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,14 @@
33
import * as React from 'react';
44
import type { TabNavListProps } from '.';
55
import TabNavList from '.';
6-
import TabContext from '../TabContext';
7-
import TabPane from '../TabPanelList/TabPane';
8-
6+
97
export type TabNavListWrapperProps = Required<Omit<TabNavListProps, 'children' | 'className'>> &
108
TabNavListProps;
119

1210
// We have to create a TabNavList components.
1311
const TabNavListWrapper: React.FC<TabNavListWrapperProps> = ({ renderTabBar, ...restProps }) => {
14-
const { tabs } = React.useContext(TabContext);
1512
if (renderTabBar) {
16-
const tabNavBarProps = {
17-
...restProps,
18-
// Legacy support. We do not use this actually
19-
panes: tabs.map<React.ReactNode>(({ label, key, ...restTabProps }) => (
20-
<TabPane tab={label} key={key} tabKey={key} {...restTabProps} />
21-
)),
22-
};
23-
24-
return renderTabBar(tabNavBarProps, TabNavList);
13+
return renderTabBar(restProps, TabNavList);
2514
}
2615

2716
return <TabNavList {...restProps} />;

src/Tabs.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ const Tabs = React.forwardRef<HTMLDivElement, TabsProps>((props, ref) => {
178178
onTabScroll,
179179
extra: tabBarExtraContent,
180180
style: tabBarStyle,
181-
panes: null,
182181
getPopupContainer,
183182
popupClassName,
184183
indicator,

src/interface.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ type RenderTabBarProps = {
5151
onTabScroll: OnTabScroll;
5252
extra: TabBarExtraContent;
5353
style: React.CSSProperties;
54-
/** @deprecated It do not pass real TabPane node. Only for compatible usage. */
55-
panes: React.ReactNode;
5654
};
5755

5856
export type RenderTabBar = (

tests/index.test.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -310,23 +310,6 @@ describe('Tabs.Basic', () => {
310310
expect(container.querySelector('.my-node')).toBeTruthy();
311311
expect(renderTabBar).toHaveBeenCalled();
312312
});
313-
it('has panes property in props', () => {
314-
const renderTabBar = props => {
315-
return (
316-
<div>
317-
{props.panes.map(pane => (
318-
<span key={pane.key} data-key={pane.key}>
319-
tab
320-
</span>
321-
))}
322-
</div>
323-
);
324-
};
325-
const { container } = render(getTabs({ renderTabBar }));
326-
expect(container.querySelector('[data-key="light"]')).toBeTruthy();
327-
expect(container.querySelector('[data-key="bamboo"]')).toBeTruthy();
328-
expect(container.querySelector('[data-key="cute"]')).toBeTruthy();
329-
});
330313
});
331314

332315
it('destroyInactiveTabPane', () => {

0 commit comments

Comments
 (0)