Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: retire deprecated api #768

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions docs/demo/renderTabBar-use-panes.md

This file was deleted.

43 changes: 0 additions & 43 deletions docs/examples/renderTabBar-use-panes.tsx

This file was deleted.

15 changes: 2 additions & 13 deletions src/TabNavList/Wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,14 @@
import * as React from 'react';
import type { TabNavListProps } from '.';
import TabNavList from '.';
import TabContext from '../TabContext';
import TabPane from '../TabPanelList/TabPane';


export type TabNavListWrapperProps = Required<Omit<TabNavListProps, 'children' | 'className'>> &
TabNavListProps;

// We have to create a TabNavList components.
const TabNavListWrapper: React.FC<TabNavListWrapperProps> = ({ renderTabBar, ...restProps }) => {
const { tabs } = React.useContext(TabContext);
if (renderTabBar) {
const tabNavBarProps = {
...restProps,
// Legacy support. We do not use this actually
panes: tabs.map<React.ReactNode>(({ label, key, ...restTabProps }) => (
<TabPane tab={label} key={key} tabKey={key} {...restTabProps} />
)),
};

return renderTabBar(tabNavBarProps, TabNavList);
return renderTabBar(restProps, TabNavList);
}

return <TabNavList {...restProps} />;
Expand Down
1 change: 0 additions & 1 deletion src/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ const Tabs = React.forwardRef<HTMLDivElement, TabsProps>((props, ref) => {
onTabScroll,
extra: tabBarExtraContent,
style: tabBarStyle,
panes: null,
getPopupContainer,
popupClassName,
indicator,
Expand Down
2 changes: 0 additions & 2 deletions src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ type RenderTabBarProps = {
onTabScroll: OnTabScroll;
extra: TabBarExtraContent;
style: React.CSSProperties;
/** @deprecated It do not pass real TabPane node. Only for compatible usage. */
panes: React.ReactNode;
};

export type RenderTabBar = (
Expand Down
17 changes: 0 additions & 17 deletions tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,23 +310,6 @@ describe('Tabs.Basic', () => {
expect(container.querySelector('.my-node')).toBeTruthy();
expect(renderTabBar).toHaveBeenCalled();
});
it('has panes property in props', () => {
const renderTabBar = props => {
return (
<div>
{props.panes.map(pane => (
<span key={pane.key} data-key={pane.key}>
tab
</span>
))}
</div>
);
};
const { container } = render(getTabs({ renderTabBar }));
expect(container.querySelector('[data-key="light"]')).toBeTruthy();
expect(container.querySelector('[data-key="bamboo"]')).toBeTruthy();
expect(container.querySelector('[data-key="cute"]')).toBeTruthy();
});
});

it('destroyInactiveTabPane', () => {
Expand Down
Loading