diff --git a/src/TabNavList/index.tsx b/src/TabNavList/index.tsx index 28d9b864..704a618a 100644 --- a/src/TabNavList/index.tsx +++ b/src/TabNavList/index.tsx @@ -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): SizeInfo => { @@ -82,7 +82,7 @@ function TabNavList(props: TabNavListProps, ref: React.Ref) { children, onTabClick, onTabScroll, - getIndicatorLength, + indicatorLength, } = props; const containerRef = useRef(); const extraLeftRef = useRef(); @@ -369,7 +369,7 @@ function TabNavList(props: TabNavListProps, ref: React.Ref) { activeTabOffset, horizontal: tabPositionTopOrBottom, rtl, - getIndicatorLength, + indicatorLength, }) // ========================= Effect ======================== diff --git a/src/Tabs.tsx b/src/Tabs.tsx index 0960c23f..e9ff7dbe 100644 --- a/src/Tabs.tsx +++ b/src/Tabs.tsx @@ -71,7 +71,7 @@ export interface TabsProps popupClassName?: string; // Indicator - getIndicatorLength?: GetIndicatorLength; + indicatorLength?: GetIndicatorLength; } function Tabs( @@ -99,7 +99,7 @@ function Tabs( onTabScroll, getPopupContainer, popupClassName, - getIndicatorLength, + indicatorLength, ...restProps }: TabsProps, ref: React.Ref, @@ -185,7 +185,7 @@ function Tabs( panes: null, getPopupContainer, popupClassName, - getIndicatorLength, + indicatorLength, }; return ( diff --git a/src/hooks/useIndicator.ts b/src/hooks/useIndicator.ts index 40c16bbd..ee2f1a47 100644 --- a/src/hooks/useIndicator.ts +++ b/src/hooks/useIndicator.ts @@ -8,7 +8,7 @@ export type UseIndicator = (options: { activeTabOffset: TabOffset, horizontal: boolean; rtl: boolean; - getIndicatorLength: GetIndicatorLength; + indicatorLength: GetIndicatorLength; }) => { style: React.CSSProperties; } @@ -17,17 +17,17 @@ const useIndicator: UseIndicator = ({ activeTabOffset, horizontal, rtl, - getIndicatorLength, + indicatorLength, }) => { const [inkStyle, setInkStyle] = useState(); const inkBarRafRef = useRef(); 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; } @@ -63,7 +63,7 @@ const useIndicator: UseIndicator = ({ }); return cleanInkBarRaf; - }, [activeTabOffset, horizontal, rtl, getIndicatorLength]); + }, [activeTabOffset, horizontal, rtl, indicatorLength]); return { style: inkStyle,