react-navigation-drawer

  • Version 2.7.2
  • Published
  • 384 kB
  • No dependencies
  • MIT license

Install

npm i react-navigation-drawer
yarn add react-navigation-drawer
pnpm add react-navigation-drawer

Overview

Drawer navigator component for React Navigation

Index

Variables

variable DrawerGestureContext

const DrawerGestureContext: React.Context<any>;

    variable DrawerProgressContext

    const DrawerProgressContext: React.Context<any>;

      Functions

      function createDrawerNavigator

      createDrawerNavigator: (
      routeConfigs: NavigationRouteConfigMap<NavigationDrawerOptions, any>,
      config?: CreateNavigatorConfig<
      NavigationDrawerConfig,
      NavigationDrawerRouterConfig,
      NavigationDrawerOptions,
      any
      >
      ) => any;

        function DrawerRouter

        DrawerRouter: (
        routeConfigs: NavigationRouteConfigMap<any, any>,
        config?: {
        unmountInactiveRoutes?: boolean;
        resetOnBlur?: boolean;
        initialRouteName?: string;
        }
        ) => {
        getActionCreators(
        route: NavigationRoute,
        navStateKey: string
        ): { openDrawer: () => any; closeDrawer: () => any; toggleDrawer: () => any };
        getStateForAction(
        action: NavigationAction,
        state?:
        | (import('react-navigation').NavigationLeafRoute<
        import('react-navigation').NavigationParams
        > & { isDrawerOpen?: any })
        | (import('react-navigation').NavigationLeafRoute<
        import('react-navigation').NavigationParams
        > &
        import('react-navigation').NavigationState & {
        isDrawerOpen?: any;
        })
        | undefined
        ): any;
        getActionForPathAndParams: (
        path: string,
        params?: import('react-navigation').NavigationParams | undefined
        ) =>
        | import('react-navigation').NavigationInitAction
        | import('react-navigation').NavigationNavigateAction
        | import('react-navigation').NavigationBackAction
        | import('react-navigation').NavigationSetParamsAction
        | import('react-navigation').NavigationResetAction
        | import('react-navigation').NavigationReplaceAction
        | import('react-navigation').NavigationPopAction
        | import('react-navigation').NavigationPushAction
        | import('react-navigation').NavigationPopToTopAction
        | import('react-navigation').NavigationCompleteTransitionAction
        | import('react-navigation').NavigationDrawerOpenedAction
        | import('react-navigation').NavigationDrawerClosedAction
        | import('react-navigation').NavigationOpenDrawerAction
        | import('react-navigation').NavigationCloseDrawerAction
        | import('react-navigation').NavigationToggleDrawerAction
        | import('react-navigation').NavigationJumpToAction
        | { type: 'CHILD_ACTION'; key?: string | undefined }
        | null;
        getPathAndParamsForState: (state: any) => {
        path: string;
        params?: import('react-navigation').NavigationParams | undefined;
        };
        getComponentForRouteName: (routeName: string) => any;
        getComponentForState: (state: any) => any;
        getScreenOptions: any;
        };

          Classes

          class DrawerItems

          class DrawerNavigatorItems extends React.Component<DrawerNavigatorItemsProps> {}
          • Component that renders the navigation list in the drawer.

          property context

          context: React.ContextType<any>;

            property contextType

            static contextType: React.Context<any>;

              property defaultProps

              static defaultProps: {
              activeTintColor: { light: string; dark: string };
              activeBackgroundColor: { light: string; dark: string };
              inactiveTintColor: { light: string; dark: string };
              inactiveBackgroundColor: { light: string; dark: string };
              };

                method render

                render: () => JSX.Element;

                  class DrawerNavigatorItems

                  class DrawerNavigatorItems extends React.Component<DrawerNavigatorItemsProps> {}
                  • Component that renders the navigation list in the drawer.

                  property context

                  context: React.ContextType<any>;

                    property contextType

                    static contextType: React.Context<any>;

                      property defaultProps

                      static defaultProps: {
                      activeTintColor: { light: string; dark: string };
                      activeBackgroundColor: { light: string; dark: string };
                      inactiveTintColor: { light: string; dark: string };
                      inactiveBackgroundColor: { light: string; dark: string };
                      };

                        method render

                        render: () => JSX.Element;

                          class DrawerSidebar

                          class DrawerSidebar extends React.PureComponent<Props> {}
                          • Component that renders the sidebar screen of the drawer.

                          method render

                          render: () => JSX.Element | null;

                            class DrawerView

                            class DrawerView extends React.PureComponent<Props, State> {}
                            • Component that renders the drawer.

                            property context

                            context: React.ContextType<any>;

                              property contextType

                              static contextType: React.Context<any>;

                                property defaultProps

                                static defaultProps: { lazy: boolean };

                                  property state

                                  state: State;

                                    method componentDidMount

                                    componentDidMount: () => void;

                                      method componentDidUpdate

                                      componentDidUpdate: (prevProps: Props) => void;

                                        method componentWillUnmount

                                        componentWillUnmount: () => void;

                                          method getDerivedStateFromProps

                                          static getDerivedStateFromProps: (
                                          nextProps: Props,
                                          prevState: State
                                          ) => { loaded: number[] };

                                            method render

                                            render: () => JSX.Element;

                                              Type Aliases

                                              type DrawerContentComponentProps

                                              type DrawerContentComponentProps = DrawerNavigatorItemsProps & {
                                              navigation: NavigationScreenProp<NavigationDrawerState>;
                                              descriptors: SceneDescriptorMap;
                                              drawerOpenProgress: Animated.Node<number>;
                                              screenProps: unknown;
                                              };

                                                type DrawerIconProps

                                                type DrawerIconProps = {
                                                tintColor?: string;
                                                focused: boolean;
                                                };

                                                  type DrawerLabelProps

                                                  type DrawerLabelProps = {
                                                  tintColor?: string;
                                                  focused: boolean;
                                                  };

                                                    type DrawerLockMode

                                                    type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';
                                                      type NavigationDrawerConfig = {
                                                      contentComponent?: React.ComponentType<DrawerContentComponentProps>;
                                                      edgeWidth?: number;
                                                      minSwipeDistance?: number;
                                                      drawerWidth?: number | (() => number);
                                                      drawerPosition?: 'left' | 'right';
                                                      drawerType?: 'front' | 'back' | 'slide';
                                                      drawerLockMode?: DrawerLockMode;
                                                      keyboardDismissMode?: 'none' | 'on-drag';
                                                      swipeEdgeWidth?: number;
                                                      swipeDistanceThreshold?: number;
                                                      swipeVelocityThreshold?: number;
                                                      hideStatusBar?: boolean;
                                                      statusBarAnimation?: 'slide' | 'none' | 'fade';
                                                      drawerBackgroundColor?: ThemedColor;
                                                      overlayColor?: ThemedColor;
                                                      screenContainerStyle?: StyleProp<ViewStyle>;
                                                      detachInactiveScreens?: boolean;
                                                      };
                                                        type NavigationDrawerOptions = {
                                                        title?: string;
                                                        drawerLabel?: React.ReactNode | ((props: DrawerLabelProps) => React.ReactNode);
                                                        drawerIcon?: React.ReactNode | ((props: DrawerIconProps) => React.ReactNode);
                                                        drawerLockMode?: DrawerLockMode;
                                                        };
                                                          type NavigationDrawerProp<
                                                          State = NavigationRoute,
                                                          Params = NavigationParams
                                                          > = NavigationScreenProp<State, Params> & {
                                                          openDrawer: () => void;
                                                          closeDrawer: () => void;
                                                          toggleDrawer: () => void;
                                                          jumpTo: (routeName: string, key?: string) => void;
                                                          };
                                                            type NavigationDrawerRouterConfig = {
                                                            unmountInactiveRoutes?: boolean;
                                                            resetOnBlur?: boolean;
                                                            initialRouteName?: string;
                                                            contentComponent?: React.ComponentType<DrawerContentComponentProps>;
                                                            contentOptions?: {
                                                            /**
                                                            * the array of routes, can be modified or overridden
                                                            */
                                                            items?: NavigationRoute[];
                                                            /**
                                                            * key identifying the active route
                                                            */
                                                            activeItemKey?: string;
                                                            /**
                                                            * label and icon color of the active label
                                                            */
                                                            activeTintColor?: string;
                                                            /**
                                                            * background color of the active label
                                                            */
                                                            activeBackgroundColor?: string;
                                                            /**
                                                            * label and icon color of the inactive label
                                                            */
                                                            inactiveTintColor?: string;
                                                            /**
                                                            * background color of the inactive label
                                                            */
                                                            inactiveBackgroundColor?: string;
                                                            /**
                                                            * function to be invoked when an item is pressed
                                                            */
                                                            onItemPress?: (info: DrawerItem) => void;
                                                            /**
                                                            * style object for the content section
                                                            */
                                                            itemsContainerStyle?: StyleProp<ViewStyle>;
                                                            /**
                                                            * style object for the single item, which can contain an Icon and/or a Label
                                                            */
                                                            itemStyle?: StyleProp<ViewStyle>;
                                                            /**
                                                            * style object to overwrite Text style inside content section, when your label is a string
                                                            */
                                                            labelStyle?: StyleProp<TextStyle>;
                                                            /**
                                                            * style object to overwrite Text style of the active label, when your label is a string (merged with labelStyle)
                                                            */
                                                            activeLabelStyle?: StyleProp<TextStyle>;
                                                            /**
                                                            * style object to overwrite Text style of the inactive label, when your label is a string (merged with labelStyle)
                                                            */
                                                            inactiveLabelStyle?: StyleProp<TextStyle>;
                                                            /**
                                                            * style object to overwrite View icon container styles
                                                            */
                                                            iconContainerStyle?: StyleProp<ViewStyle>;
                                                            };
                                                            backBehavior?: 'none' | 'initialRoute' | 'history';
                                                            };
                                                              type NavigationDrawerScreenComponent<
                                                              Params = NavigationParams,
                                                              ScreenProps = unknown
                                                              > = React.ComponentType<NavigationDrawerScreenProps<Params, ScreenProps>> & {
                                                              navigationOptions?: NavigationScreenConfig<
                                                              NavigationDrawerOptions,
                                                              NavigationDrawerProp<NavigationRoute, Params>,
                                                              ScreenProps
                                                              >;
                                                              };
                                                                type NavigationDrawerScreenProps<
                                                                Params = NavigationParams,
                                                                ScreenProps = unknown
                                                                > = {
                                                                theme: SupportedThemes;
                                                                navigation: NavigationDrawerProp<NavigationRoute, Params>;
                                                                screenProps: ScreenProps;
                                                                };
                                                                  type NavigationDrawerState = NavigationState & {
                                                                  isDrawerOpen: boolean;
                                                                  };

                                                                    Namespaces

                                                                    namespace DrawerActions

                                                                    module 'lib/typescript/src/routers/DrawerActions.d.ts' {}

                                                                      variable CLOSE_DRAWER

                                                                      const CLOSE_DRAWER: string;

                                                                        variable DRAWER_CLOSED

                                                                        const DRAWER_CLOSED: string;

                                                                          variable DRAWER_OPENED

                                                                          const DRAWER_OPENED: string;

                                                                            variable MARK_DRAWER_ACTIVE

                                                                            const MARK_DRAWER_ACTIVE: string;

                                                                              variable MARK_DRAWER_IDLE

                                                                              const MARK_DRAWER_IDLE: string;

                                                                                variable MARK_DRAWER_SETTLING

                                                                                const MARK_DRAWER_SETTLING: string;

                                                                                  variable OPEN_DRAWER

                                                                                  const OPEN_DRAWER: string;

                                                                                    variable TOGGLE_DRAWER

                                                                                    const TOGGLE_DRAWER: string;

                                                                                      function closeDrawer

                                                                                      closeDrawer: (payload?: any) => any;

                                                                                        function openDrawer

                                                                                        openDrawer: (payload?: any) => any;

                                                                                          function toggleDrawer

                                                                                          toggleDrawer: (payload?: any) => any;

                                                                                            type DrawerActionType

                                                                                            type DrawerActionType =
                                                                                            | typeof OPEN_DRAWER
                                                                                            | typeof CLOSE_DRAWER
                                                                                            | typeof TOGGLE_DRAWER;

                                                                                              Package Files (10)

                                                                                              Dependencies (0)

                                                                                              No dependencies.

                                                                                              Dev Dependencies (13)

                                                                                              Peer Dependencies (6)

                                                                                              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-navigation-drawer.

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