• Version 6.23.1
  • Published
  • 38.9 kB
  • 2 dependencies
  • MIT license


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


Declarative routing for React Native applications



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: ({
}: 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?: 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.


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 = (
                    | 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)


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

                        You may also use to create a custom badge linking to

                        • Markdown
                        • HTML
                          <a href=""><img src="" alt=""></a>