UNPKG

2.08 kBTypeScriptView Raw
1import React from 'react';
2import { PropsType } from './PropsType';
3import { Models } from './Models';
4export declare class StateType {
5 currentTab: number;
6}
7export declare abstract class Tabs<P extends PropsType = PropsType, S extends StateType = StateType> extends React.PureComponent<P, S> {
8 static defaultProps: PropsType;
9 protected instanceId: number;
10 protected prevCurrentTab: number;
11 protected tabCache: {
12 [index: number]: React.ReactNode;
13 };
14 /** compatible for different between react and preact in `setState`. */
15 private nextCurrentTab;
16 constructor(props: P);
17 getTabIndex(props: P): number;
18 isTabVertical: (direction?: "horizontal" | "vertical" | undefined) => boolean;
19 shouldRenderTab: (idx: number) => boolean;
20 componentWillReceiveProps(nextProps: P): void;
21 componentDidMount(): void;
22 componentDidUpdate(): void;
23 getOffsetIndex: (current: number, width: number, threshold?: P["distanceToChangeTab"]) => number;
24 goToTab(index: number, force?: boolean, newState?: any, props?: P): boolean;
25 tabClickGoToTab(index: number): void;
26 getTabBarBaseProps(): {
27 activeTab: S["currentTab"];
28 animated: boolean;
29 goToTab: any;
30 onTabClick: P["onTabClick"];
31 tabBarActiveTextColor: P["tabBarActiveTextColor"];
32 tabBarBackgroundColor: P["tabBarBackgroundColor"];
33 tabBarInactiveTextColor: P["tabBarInactiveTextColor"];
34 tabBarPosition: P["tabBarPosition"];
35 tabBarTextStyle: P["tabBarTextStyle"];
36 tabBarUnderlineStyle: P["tabBarUnderlineStyle"];
37 tabs: P["tabs"];
38 instanceId: number;
39 };
40 renderTabBar(tabBarProps: any, DefaultTabBar: React.ComponentClass): {} | null | undefined;
41 getSubElements: () => (defaultPrefix?: string, allPrefix?: string) => {
42 [key: string]: React.ReactNode;
43 };
44 getSubElement(tab: Models.TabData, index: number, subElements: (defaultPrefix: string, allPrefix: string) => {
45 [key: string]: any;
46 }, defaultPrefix?: string, allPrefix?: string): any;
47}