Skip to content

Commit

Permalink
chore: update ts def (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored Nov 11, 2021
1 parent 7738731 commit a4ce7c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"trailingComma": "all",
"printWidth": 100,
"proseWrap": "never",
"arrowParens": "avoid",
"overrides": [
{
"files": ".prettierrc",
Expand Down
6 changes: 3 additions & 3 deletions src/TabNavList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function TabNavList(props: TabNavListProps, ref: React.Ref<HTMLDivElement>) {

useTouchMove(tabsWrapperRef, (offsetX, offsetY) => {
function doMove(setState: React.Dispatch<React.SetStateAction<number>>, offset: number) {
setState((value) => {
setState(value => {
const newValue = alignInRange(value + offset);

return newValue;
Expand Down Expand Up @@ -299,7 +299,7 @@ function TabNavList(props: TabNavListProps, ref: React.Ref<HTMLDivElement>) {
renderWrapper={children}
removeAriaLabel={locale?.removeAriaLabel}
ref={getBtnRef(key)}
onClick={(e) => {
onClick={e => {
onTabClick(key, e);
}}
onRemove={() => {
Expand Down Expand Up @@ -413,7 +413,7 @@ function TabNavList(props: TabNavListProps, ref: React.Ref<HTMLDivElement>) {
// Should recalculate when rtl changed
useEffect(() => {
onListHolderResize();
}, [rtl, tabBarGutter, activeKey, tabs.map((tab) => tab.key).join('_')]);
}, [rtl, tabBarGutter, activeKey, tabs.map(tab => tab.key).join('_')]);

// ========================= Render ========================
const hasDropdown = !!hiddenTabs.length;
Expand Down
8 changes: 6 additions & 2 deletions src/interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { TabNavListProps } from './TabNavList';
import type { TabPaneProps } from './TabPanelList/TabPane';

export type TabSizeMap = Map<
Expand Down Expand Up @@ -38,9 +39,12 @@ type RenderTabBarProps = {
extra: TabBarExtraContent;
style: React.CSSProperties;
panes: React.ReactNode;
}
};

export type RenderTabBar = (props: RenderTabBarProps, DefaultTabBar: React.ComponentType) => React.ReactElement;
export type RenderTabBar = (
props: RenderTabBarProps,
DefaultTabBar: React.ComponentType<TabNavListProps>,
) => React.ReactElement;

export interface TabsLocale {
dropdownAriaLabel?: string;
Expand Down

1 comment on commit a4ce7c4

@vercel
Copy link

@vercel vercel bot commented on a4ce7c4 Nov 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.