UNPKG

1.05 kBSource Map (JSON)View Raw
1{"version":3,"names":["useRoute","route","React","useContext","NavigationRouteContext","undefined","Error"],"sources":["useRoute.tsx"],"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"],"mappings":";;;;;;;AACA;;AAEA;;;;;;;;AAGA;AACA;AACA;AACA;AACA;AACe,SAASA,QAAT,GAA2D;EACxE,MAAMC,KAAK,GAAGC,KAAK,CAACC,UAAN,CAAiBC,+BAAjB,CAAd;;EAEA,IAAIH,KAAK,KAAKI,SAAd,EAAyB;IACvB,MAAM,IAAIC,KAAJ,CACJ,iFADI,CAAN;EAGD;;EAED,OAAOL,KAAP;AACD"}
\No newline at end of file