UNPKG

2.2 kBSource Map (JSON)View Raw
1{"version":3,"names":["NavigationBuilderContext","React","createContext","onDispatchAction","undefined","onOptionsChange"],"sources":["NavigationBuilderContext.tsx"],"sourcesContent":["import type {\n NavigationAction,\n NavigationState,\n ParamListBase,\n} from '@react-navigation/routers';\nimport * as React from 'react';\n\nimport type { NavigationHelpers } from './types';\n\nexport type ListenerMap = {\n action: ChildActionListener;\n focus: FocusedNavigationListener;\n};\n\nexport type KeyedListenerMap = {\n getState: GetStateListener;\n beforeRemove: ChildBeforeRemoveListener;\n};\n\nexport type AddListener = <T extends keyof ListenerMap>(\n type: T,\n listener: ListenerMap[T]\n) => void;\n\nexport type AddKeyedListener = <T extends keyof KeyedListenerMap>(\n type: T,\n key: string,\n listener: KeyedListenerMap[T]\n) => void;\n\nexport type ChildActionListener = (\n action: NavigationAction,\n visitedNavigators?: Set<string>\n) => boolean;\n\nexport type FocusedNavigationCallback<T> = (\n navigation: NavigationHelpers<ParamListBase>\n) => T;\n\nexport type FocusedNavigationListener = <T>(\n callback: FocusedNavigationCallback<T>\n) => {\n handled: boolean;\n result: T;\n};\n\nexport type GetStateListener = () => NavigationState;\n\nexport type ChildBeforeRemoveListener = (action: NavigationAction) => boolean;\n\n/**\n * Context which holds the required helpers needed to build nested navigators.\n */\nconst NavigationBuilderContext = React.createContext<{\n onAction?: (\n action: NavigationAction,\n visitedNavigators?: Set<string>\n ) => boolean;\n addListener?: AddListener;\n addKeyedListener?: AddKeyedListener;\n onRouteFocus?: (key: string) => void;\n onDispatchAction: (action: NavigationAction, noop: boolean) => void;\n onOptionsChange: (options: object) => void;\n stackRef?: React.MutableRefObject<string | undefined>;\n}>({\n onDispatchAction: () => undefined,\n onOptionsChange: () => undefined,\n});\n\nexport default NavigationBuilderContext;\n"],"mappings":";;;;;;;AAKA;;;;;;AA6CA;AACA;AACA;AACA,MAAMA,wBAAwB,gBAAGC,KAAK,CAACC,aAAN,CAW9B;EACDC,gBAAgB,EAAE,MAAMC,SADvB;EAEDC,eAAe,EAAE,MAAMD;AAFtB,CAX8B,CAAjC;eAgBeJ,wB"}
\No newline at end of file