react-native-tab-view

  • Version 4.0.5
  • Published
  • 345 kB
  • 1 dependency
  • MIT license

Install

npm i react-native-tab-view
yarn add react-native-tab-view
pnpm add react-native-tab-view

Overview

Tab view component for React Native

Index

Functions

function SceneMap

SceneMap: <T>(scenes: {
[key: string]: React.ComponentType<T>;
}) => ({ route, jumpTo, position }: SceneProps) => any;

    function TabBar

    TabBar: <T extends Route>({
    renderIndicator,
    gap,
    scrollEnabled,
    jumpTo,
    navigationState,
    position,
    activeColor,
    bounces,
    contentContainerStyle,
    inactiveColor,
    indicatorContainerStyle,
    indicatorStyle,
    onTabLongPress,
    onTabPress,
    pressColor,
    pressOpacity,
    direction,
    renderTabBarItem,
    style,
    tabStyle,
    layout: propLayout,
    testID,
    android_ripple,
    options,
    }: Props<T>) => any;

      function TabBarIndicator

      TabBarIndicator: <T extends Route>({
      getTabWidth,
      layout,
      navigationState,
      position,
      width,
      direction,
      gap,
      style,
      children,
      }: Props<T>) => any;

        function TabBarItem

        TabBarItem: <T extends Route>(props: Props<T>) => any;

          function TabView

          TabView: <T extends Route>({
          onIndexChange,
          navigationState,
          renderScene,
          initialLayout,
          keyboardDismissMode,
          lazy,
          lazyPreloadDistance,
          onSwipeStart,
          onSwipeEnd,
          renderLazyPlaceholder,
          renderTabBar,
          pagerStyle,
          style,
          direction,
          swipeEnabled,
          tabBarPosition,
          animationEnabled,
          overScrollMode,
          options: sceneOptions,
          commonOptions,
          }: Props<T>) => any;

            Type Aliases

            type NavigationState<T extends Route> = {
            index: number;
            routes: T[];
            };

              type Route

              type Route = {
              key: string;
              icon?: string;
              title?: string;
              accessible?: boolean;
              accessibilityLabel?: string;
              testID?: string;
              };

                type SceneRendererProps

                type SceneRendererProps = {
                layout: Layout;
                position: Animated.AnimatedInterpolation<number>;
                jumpTo: (key: string) => void;
                };

                  type TabBarIndicatorProps

                  type Props<T extends Route> = SceneRendererProps & {
                  navigationState: NavigationState<T>;
                  width: 'auto' | `${number}%` | number;
                  getTabWidth: GetTabWidth;
                  direction: LocaleDirection;
                  style?: StyleProp<ViewStyle>;
                  gap?: number;
                  children?: React.ReactNode;
                  };

                    type TabBarItemProps

                    type Props<T extends Route> = TabDescriptor<T> & {
                    position: Animated.AnimatedInterpolation<number>;
                    route: T;
                    navigationState: NavigationState<T>;
                    activeColor?: string;
                    inactiveColor?: string;
                    pressColor?: string;
                    pressOpacity?: number;
                    onLayout?: (event: LayoutChangeEvent) => void;
                    onPress: () => void;
                    onLongPress: () => void;
                    defaultTabWidth?: number;
                    style: StyleProp<ViewStyle>;
                    android_ripple?: PressableAndroidRippleConfig;
                    };

                      type TabBarProps

                      type Props<T extends Route> = SceneRendererProps & {
                      navigationState: NavigationState<T>;
                      scrollEnabled?: boolean;
                      bounces?: boolean;
                      activeColor?: string;
                      inactiveColor?: string;
                      pressColor?: string;
                      pressOpacity?: number;
                      options?: Record<string, TabDescriptor<T>>;
                      renderIndicator?: (props: IndicatorProps<T>) => React.ReactNode;
                      renderTabBarItem?: (
                      props: TabBarItemProps<T> & {
                      key: string;
                      }
                      ) => React.ReactElement;
                      onTabPress?: (scene: Scene<T> & Event) => void;
                      onTabLongPress?: (scene: Scene<T>) => void;
                      tabStyle?: StyleProp<ViewStyle>;
                      indicatorStyle?: StyleProp<ViewStyle>;
                      indicatorContainerStyle?: StyleProp<ViewStyle>;
                      contentContainerStyle?: StyleProp<ViewStyle>;
                      style?: StyleProp<ViewStyle>;
                      direction?: LocaleDirection;
                      gap?: number;
                      testID?: string;
                      android_ripple?: PressableAndroidRippleConfig;
                      };

                        type TabDescriptor

                        type TabDescriptor<T extends Route> = {
                        accessibilityLabel?: string;
                        accessible?: boolean;
                        testID?: string;
                        labelText?: string;
                        labelAllowFontScaling?: boolean;
                        href?: string;
                        label?: (props: {
                        route: T;
                        labelText?: string;
                        focused: boolean;
                        color: string;
                        allowFontScaling?: boolean;
                        style?: StyleProp<TextStyle>;
                        }) => React.ReactNode;
                        labelStyle?: StyleProp<TextStyle>;
                        icon?: (props: {
                        route: T;
                        focused: boolean;
                        color: string;
                        size: number;
                        }) => React.ReactNode;
                        badge?: (props: { route: T }) => React.ReactElement;
                        sceneStyle?: StyleProp<ViewStyle>;
                        };

                          type TabViewProps

                          type Props<T extends Route> = Omit<PagerProps, 'layoutDirection'> & {
                          onIndexChange: (index: number) => void;
                          navigationState: NavigationState<T>;
                          renderLazyPlaceholder?: (props: { route: T }) => React.ReactNode;
                          renderTabBar?: (
                          props: SceneRendererProps & {
                          navigationState: NavigationState<T>;
                          options: Record<string, TabDescriptor<T>> | undefined;
                          }
                          ) => React.ReactNode;
                          tabBarPosition?: 'top' | 'bottom';
                          initialLayout?: Partial<Layout>;
                          lazy?: ((props: { route: T }) => boolean) | boolean;
                          lazyPreloadDistance?: number;
                          direction?: LocaleDirection;
                          pagerStyle?: StyleProp<ViewStyle>;
                          style?: StyleProp<ViewStyle>;
                          renderScene: (
                          props: SceneRendererProps & {
                          route: T;
                          }
                          ) => React.ReactNode;
                          options?: Record<string, TabDescriptor<T>>;
                          commonOptions?: TabDescriptor<T>;
                          };

                            Package Files (7)

                            Dependencies (1)

                            Dev Dependencies (8)

                            Peer Dependencies (3)

                            Badge

                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-native-tab-view.

                            • Markdown
                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/react-native-tab-view)
                            • HTML
                              <a href="https://www.jsdocs.io/package/react-native-tab-view"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>