1- import React , { useEffect , useRef , useState } from 'react' ;
1+ import type React from 'react' ;
2+ import { useEffect , useRef , useState } from 'react' ;
23import raf from 'rc-util/lib/raf' ;
3- import { TabOffset } from '../interface' ;
4+ import type { TabOffset } from '../interface' ;
45
5- export type GetIndicatorLength = number | ( ( origin : number ) => number ) ;
6+ export type GetIndicatorSize = number | ( ( origin : number ) => number ) ;
67
78export type UseIndicator = ( options : {
89 activeTabOffset : TabOffset ,
910 horizontal : boolean ;
1011 rtl : boolean ;
11- indicatorLength : GetIndicatorLength ;
12+ indicatorSize : GetIndicatorSize ;
1213} ) => {
1314 style : React . CSSProperties ;
1415}
@@ -17,17 +18,17 @@ const useIndicator: UseIndicator = ({
1718 activeTabOffset,
1819 horizontal,
1920 rtl,
20- indicatorLength ,
21+ indicatorSize ,
2122 } ) => {
2223 const [ inkStyle , setInkStyle ] = useState < React . CSSProperties > ( ) ;
2324 const inkBarRafRef = useRef < number > ( ) ;
2425
2526 const getLength = ( origin : number ) => {
26- if ( typeof indicatorLength === 'function' ) {
27- return indicatorLength ( origin ) ;
27+ if ( typeof indicatorSize === 'function' ) {
28+ return indicatorSize ( origin ) ;
2829 }
29- if ( typeof indicatorLength === 'number' ) {
30- return indicatorLength ;
30+ if ( typeof indicatorSize === 'number' ) {
31+ return indicatorSize ;
3132 }
3233 return origin ;
3334 }
@@ -63,7 +64,7 @@ const useIndicator: UseIndicator = ({
6364 } ) ;
6465
6566 return cleanInkBarRaf ;
66- } , [ activeTabOffset , horizontal , rtl , indicatorLength ] ) ;
67+ } , [ activeTabOffset , horizontal , rtl , indicatorSize ] ) ;
6768
6869 return {
6970 style : inkStyle ,
0 commit comments