UNPKG

3.17 kBTypeScriptView Raw
1/// <reference types="react" />
2import { Models } from './Models';
3export interface TabBarPropsType {
4 /** call this function to switch tab */
5 goToTab: (index: number) => void;
6 /** tabs data */
7 tabs: Models.TabData[];
8 /** current active tab */
9 activeTab: number;
10 /** use animate | default: true */
11 animated: boolean;
12 /** render the tab of tabbar */
13 renderTab?: (tab: Models.TabData) => React.ReactNode;
14 /** render the underline of tabbar */
15 renderUnderline?: (style: React.CSSProperties | any) => React.ReactNode;
16 /** page size of tabbar's tab | default: 5 */
17 page?: number;
18 /** on tab click */
19 onTabClick?: (tab: Models.TabData, index: number) => void;
20 /** tabBar's position | defualt: top */
21 tabBarPosition?: 'top' | 'bottom' | 'left' | 'right';
22 /** tabBar underline style */
23 tabBarUnderlineStyle?: React.CSSProperties | any;
24 /** tabBar background color */
25 tabBarBackgroundColor?: string;
26 /** tabBar active text color */
27 tabBarActiveTextColor?: string;
28 /** tabBar inactive text color */
29 tabBarInactiveTextColor?: string;
30 /** tabBar text style */
31 tabBarTextStyle?: React.CSSProperties | any;
32 instanceId: number;
33}
34export interface PropsType {
35 /** tabs data */
36 tabs: Models.TabData[];
37 /** TabBar's position | default: top */
38 tabBarPosition?: 'top' | 'bottom' | 'left' | 'right';
39 /** render for TabBar */
40 renderTabBar?: ((props: TabBarPropsType) => React.ReactNode) | false;
41 /** initial Tab, index or key */
42 initialPage?: number | string;
43 /** current tab, index or key */
44 page?: number | string;
45 /** whether to switch tabs with swipe gestrue in the content | default: true */
46 swipeable?: boolean;
47 /** use scroll follow pan | default: true */
48 useOnPan?: boolean;
49 /** pre-render nearby # sibling, Infinity: render all the siblings, 0: render current page | default: 1 */
50 prerenderingSiblingsNumber?: number;
51 /** whether to change tabs with animation | default: true */
52 animated?: boolean;
53 /** callback when tab is switched */
54 onChange?: (tab: Models.TabData, index: number) => void;
55 /** on tab click */
56 onTabClick?: (tab: Models.TabData, index: number) => void;
57 /** destroy inactive tab | default: false */
58 destroyInactiveTab?: boolean;
59 /** distance to change tab, width ratio | default: 0.3 */
60 distanceToChangeTab?: number;
61 /** use paged | default: true */
62 usePaged?: boolean;
63 /** tab paging direction | default: horizontal */
64 tabDirection?: 'horizontal' | 'vertical';
65 /** tabBar underline style */
66 tabBarUnderlineStyle?: React.CSSProperties | any;
67 /** tabBar background color */
68 tabBarBackgroundColor?: string;
69 /** tabBar active text color */
70 tabBarActiveTextColor?: string;
71 /** tabBar inactive text color */
72 tabBarInactiveTextColor?: string;
73 /** tabBar text style */
74 tabBarTextStyle?: React.CSSProperties | any;
75 /** can't render content | default: false */
76 noRenderContent?: boolean;
77 /** use left instead of transform | default: false */
78 useLeftInsteadTransform?: boolean;
79}