react-router-native

  • Version 6.26.2
  • Published
  • 39.5 kB
  • 2 dependencies
  • MIT license

Install

npm i react-router-native
yarn add react-router-native
pnpm add react-router-native

Overview

Declarative routing for React Native applications

Index

Functions

function createSearchParams

createSearchParams: (init?: URLSearchParamsInit) => URLSearchParams;
  • Creates a URLSearchParams object using the given initializer.

    This is identical to new URLSearchParams(init) except it also supports arrays as values in the object form of the initializer instead of just strings. This is convenient when you need multiple values for a given key, but don't want to use an array initializer.

    For example, instead of:

    let searchParams = new URLSearchParams([ ['sort', 'name'], ['sort', 'price'] ]);

    you can do:

    let searchParams = createSearchParams({ sort: ['name', 'price'] });

Link: ({
onPress,
relative,
replace,
state,
to,
...rest
}: LinkProps) => React.JSX.Element;
  • A <TouchableHighlight> that navigates to a different URL when touched.

function NativeRouter

NativeRouter: (props: NativeRouterProps) => React.JSX.Element;
  • A <Router> that runs on React Native.

function useAndroidBackButton

useAndroidBackButton: () => void;
  • Enables support for the hardware back button on Android.

function useDeepLinking

useDeepLinking: () => void;
  • Enables deep linking, both on the initial app launch and for subsequent incoming links.

function useHardwareBackButton

useHardwareBackButton: () => void;
  • Enables support for the hardware back button on Android.

function useLinkPressHandler

useLinkPressHandler: (
to: To,
{
replace,
state,
relative,
}?: { replace?: boolean; state?: any; relative?: RelativeRoutingType }
) => (event: GestureResponderEvent) => void;
  • Handles the press behavior for router <Link> components. This is useful if you need to create custom <Link> components with the same press behavior we use in our exported <Link>.

function useSearchParams

useSearchParams: (
defaultInit?: URLSearchParamsInit
) => [URLSearchParams, SetURLSearchParams];
  • A convenient wrapper for accessing individual query parameters via the URLSearchParams interface.

Interfaces

interface LinkProps

interface LinkProps extends TouchableHighlightProps {}

    property children

    children?: React.ReactNode;

      property onPress

      onPress?: (event: GestureResponderEvent) => void;

        property relative

        relative?: RelativeRoutingType;

          property replace

          replace?: boolean;

            property state

            state?: any;

              property to

              to: To;

                interface NativeRouterProps

                interface NativeRouterProps extends MemoryRouterProps {}

                  Type Aliases

                  type ParamKeyValuePair

                  type ParamKeyValuePair = [string, string];

                    type SetURLSearchParams

                    type SetURLSearchParams = (
                    nextInit?:
                    | URLSearchParamsInit
                    | ((prev: URLSearchParams) => URLSearchParamsInit),
                    navigateOpts?: NavigateOptions
                    ) => void;

                      type URLSearchParamsInit

                      type URLSearchParamsInit =
                      | string
                      | ParamKeyValuePair[]
                      | Record<string, string | string[]>
                      | URLSearchParams;

                        Package Files (1)

                        Dependencies (2)

                        Dev Dependencies (5)

                        Peer Dependencies (2)

                        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-router-native.

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