1 | import * as React from 'react';
|
2 | import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
3 | import { Props as TabBarItemProps } from './TabBarItem';
|
4 | import { Props as IndicatorProps } from './TabBarIndicator';
|
5 | import type { Route, Scene, SceneRendererProps, NavigationState, Layout, Event } from './types';
|
6 | export declare type Props<T extends Route> = SceneRendererProps & {
|
7 | navigationState: NavigationState<T>;
|
8 | scrollEnabled?: boolean;
|
9 | bounces?: boolean;
|
10 | activeColor?: string;
|
11 | inactiveColor?: string;
|
12 | pressColor?: string;
|
13 | pressOpacity?: number;
|
14 | getLabelText: (scene: Scene<T>) => string | undefined;
|
15 | getAccessible: (scene: Scene<T>) => boolean | undefined;
|
16 | getAccessibilityLabel: (scene: Scene<T>) => string | undefined;
|
17 | getTestID: (scene: Scene<T>) => string | undefined;
|
18 | renderLabel?: (scene: Scene<T> & {
|
19 | focused: boolean;
|
20 | color: string;
|
21 | }) => React.ReactNode;
|
22 | renderIcon?: (scene: Scene<T> & {
|
23 | focused: boolean;
|
24 | color: string;
|
25 | }) => React.ReactNode;
|
26 | renderBadge?: (scene: Scene<T>) => React.ReactNode;
|
27 | renderIndicator: (props: IndicatorProps<T>) => React.ReactNode;
|
28 | renderTabBarItem?: (props: TabBarItemProps<T> & {
|
29 | key: string;
|
30 | }) => React.ReactElement;
|
31 | onTabPress?: (scene: Scene<T> & Event) => void;
|
32 | onTabLongPress?: (scene: Scene<T>) => void;
|
33 | tabStyle?: StyleProp<ViewStyle>;
|
34 | indicatorStyle?: StyleProp<ViewStyle>;
|
35 | indicatorContainerStyle?: StyleProp<ViewStyle>;
|
36 | labelStyle?: StyleProp<TextStyle>;
|
37 | contentContainerStyle?: StyleProp<ViewStyle>;
|
38 | style?: StyleProp<ViewStyle>;
|
39 | };
|
40 | declare type State = {
|
41 | layout: Layout;
|
42 | tabWidths: {
|
43 | [key: string]: number;
|
44 | };
|
45 | };
|
46 | export default class TabBar<T extends Route> extends React.Component<Props<T>, State> {
|
47 | static defaultProps: {
|
48 | getLabelText: ({ route }: Scene<Route>) => string | undefined;
|
49 | getAccessible: ({ route }: Scene<Route>) => boolean;
|
50 | getAccessibilityLabel: ({ route }: Scene<Route>) => string | undefined;
|
51 | getTestID: ({ route }: Scene<Route>) => string | undefined;
|
52 | renderIndicator: (props: IndicatorProps<Route>) => JSX.Element;
|
53 | };
|
54 | state: State;
|
55 | componentDidUpdate(prevProps: Props<T>, prevState: State): void;
|
56 | private measuredTabWidths;
|
57 | private scrollAmount;
|
58 | private scrollViewRef;
|
59 | private getFlattenedTabWidth;
|
60 | private getComputedTabWidth;
|
61 | private getMaxScrollDistance;
|
62 | private getTabBarWidth;
|
63 | private normalizeScrollValue;
|
64 | private getScrollAmount;
|
65 | private resetScroll;
|
66 | private handleLayout;
|
67 | private getTranslateX;
|
68 | render(): JSX.Element;
|
69 | }
|
70 | export {};
|