UNPKG

1.1 kBSource Map (JSON)View Raw
1{"version":3,"names":["React","NavigationRouteContext","useRoute","route","useContext","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,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,sBAAP,MAAmC,0BAAnC;;AAGA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,QAAT,GAA2D;EACxE,MAAMC,KAAK,GAAGH,KAAK,CAACI,UAAN,CAAiBH,sBAAjB,CAAd;;EAEA,IAAIE,KAAK,KAAKE,SAAd,EAAyB;IACvB,MAAM,IAAIC,KAAJ,CACJ,iFADI,CAAN;EAGD;;EAED,OAAOH,KAAP;AACD"}
\No newline at end of file