UNPKG

@react-navigation/core

Version:

Core utilities for building navigators

17 lines (16 loc) 515 B
"use strict"; import * as React from 'react'; import { NavigationRouteContext } from "./NavigationRouteContext.js"; /** * Hook to access the route prop of the parent screen anywhere. * * @returns Route prop of the parent screen. */ export function useRoute() { const route = React.useContext(NavigationRouteContext); if (route === undefined) { throw new Error("Couldn't find a route object. Is your component inside a screen in a navigator?"); } return route; } //# sourceMappingURL=useRoute.js.map