UNPKG

1.05 kBSource Map (JSON)View Raw
1{"version":3,"sources":["useRoute.tsx"],"names":["useRoute","route","React","useContext","NavigationRouteContext","undefined","Error"],"mappings":";;;;;;;AACA;;AAEA;;;;;;;;AAGA;AACA;AACA;AACA;AACA;AACe,SAASA,QAAT,GAA2D;AACxE,QAAMC,KAAK,GAAGC,KAAK,CAACC,UAAN,CAAiBC,+BAAjB,CAAd;;AAEA,MAAIH,KAAK,KAAKI,SAAd,EAAyB;AACvB,UAAM,IAAIC,KAAJ,CACJ,iFADI,CAAN;AAGD;;AAED,SAAOL,KAAP;AACD","sourcesContent":["import type { ParamListBase } from '@react-navigation/routers';\nimport * as React from 'react';\n\nimport NavigationRouteContext from './NavigationRouteContext';\nimport type { RouteProp } from './types';\n\n/**\n * Hook to access the route prop of the parent screen anywhere.\n *\n * @returns Route prop of the parent screen.\n */\nexport default function useRoute<T extends RouteProp<ParamListBase>>(): T {\n const route = React.useContext(NavigationRouteContext);\n\n if (route === undefined) {\n throw new Error(\n \"Couldn't find a route object. Is your component inside a screen in a navigator?\"\n );\n }\n\n return route as T;\n}\n"]}
\No newline at end of file