Skip to content

Commit

Permalink
chore: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Aug 24, 2023
1 parent d55620c commit 9fc2605
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/TabNavList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface TabNavListProps {
children?: (node: React.ReactElement) => React.ReactElement;
getPopupContainer?: (node: HTMLElement) => HTMLElement;
popupClassName?: string;
getIndicatorLength?: GetIndicatorLength;
indicatorLength?: GetIndicatorLength;
}

const getSize = (refObj: React.RefObject<HTMLElement>): SizeInfo => {
Expand Down Expand Up @@ -82,7 +82,7 @@ function TabNavList(props: TabNavListProps, ref: React.Ref<HTMLDivElement>) {
children,
onTabClick,
onTabScroll,
getIndicatorLength,
indicatorLength,
} = props;
const containerRef = useRef<HTMLDivElement>();
const extraLeftRef = useRef<HTMLDivElement>();
Expand Down Expand Up @@ -369,7 +369,7 @@ function TabNavList(props: TabNavListProps, ref: React.Ref<HTMLDivElement>) {
activeTabOffset,
horizontal: tabPositionTopOrBottom,
rtl,
getIndicatorLength,
indicatorLength,
})

// ========================= Effect ========================
Expand Down
6 changes: 3 additions & 3 deletions src/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export interface TabsProps
popupClassName?: string;

// Indicator
getIndicatorLength?: GetIndicatorLength;
indicatorLength?: GetIndicatorLength;
}

function Tabs(
Expand Down Expand Up @@ -99,7 +99,7 @@ function Tabs(
onTabScroll,
getPopupContainer,
popupClassName,
getIndicatorLength,
indicatorLength,
...restProps
}: TabsProps,
ref: React.Ref<HTMLDivElement>,
Expand Down Expand Up @@ -185,7 +185,7 @@ function Tabs(
panes: null,
getPopupContainer,
popupClassName,
getIndicatorLength,
indicatorLength,
};

return (
Expand Down
14 changes: 7 additions & 7 deletions src/hooks/useIndicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type UseIndicator = (options: {
activeTabOffset: TabOffset,
horizontal: boolean;
rtl: boolean;
getIndicatorLength: GetIndicatorLength;
indicatorLength: GetIndicatorLength;
}) => {
style: React.CSSProperties;
}
Expand All @@ -17,17 +17,17 @@ const useIndicator: UseIndicator = ({
activeTabOffset,
horizontal,
rtl,
getIndicatorLength,
indicatorLength,
}) => {
const [inkStyle, setInkStyle] = useState<React.CSSProperties>();
const inkBarRafRef = useRef<number>();

const getLength = (origin: number) => {
if (typeof getIndicatorLength === 'function') {
return getIndicatorLength(origin);
if (typeof indicatorLength === 'function') {
return indicatorLength(origin);
}
if (typeof getIndicatorLength === 'number') {
return getIndicatorLength;
if (typeof indicatorLength === 'number') {
return indicatorLength;
}
return origin;
}
Expand Down Expand Up @@ -63,7 +63,7 @@ const useIndicator: UseIndicator = ({
});

return cleanInkBarRaf;
}, [activeTabOffset, horizontal, rtl, getIndicatorLength]);
}, [activeTabOffset, horizontal, rtl, indicatorLength]);

return {
style: inkStyle,
Expand Down

0 comments on commit 9fc2605

Please sign in to comment.