@react-navigation/native 6.0.6 → 6.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/Link.js +6 -5
- package/lib/commonjs/Link.js.map +1 -1
- package/lib/commonjs/NavigationContainer.js +9 -8
- package/lib/commonjs/NavigationContainer.js.map +1 -1
- package/lib/commonjs/ServerContainer.js +5 -4
- package/lib/commonjs/ServerContainer.js.map +1 -1
- package/lib/commonjs/ServerContext.js.map +1 -1
- package/lib/commonjs/index.js +16 -16
- package/lib/commonjs/theming/ThemeProvider.js +5 -4
- package/lib/commonjs/theming/ThemeProvider.js.map +1 -1
- package/lib/commonjs/useDocumentTitle.js +9 -8
- package/lib/commonjs/useDocumentTitle.js.map +1 -1
- package/lib/commonjs/useLinkProps.js +8 -5
- package/lib/commonjs/useLinkProps.js.map +1 -1
- package/lib/commonjs/useLinking.js +61 -40
- package/lib/commonjs/useLinking.js.map +1 -1
- package/lib/commonjs/useLinking.native.js +34 -29
- package/lib/commonjs/useLinking.native.js.map +1 -1
- package/lib/module/Link.js +6 -5
- package/lib/module/Link.js.map +1 -1
- package/lib/module/NavigationContainer.js +9 -8
- package/lib/module/NavigationContainer.js.map +1 -1
- package/lib/module/ServerContainer.js +5 -4
- package/lib/module/ServerContainer.js.map +1 -1
- package/lib/module/ServerContext.js.map +1 -1
- package/lib/module/theming/ThemeProvider.js +5 -4
- package/lib/module/theming/ThemeProvider.js.map +1 -1
- package/lib/module/useDocumentTitle.js +8 -7
- package/lib/module/useDocumentTitle.js.map +1 -1
- package/lib/module/useLinkProps.js +8 -5
- package/lib/module/useLinkProps.js.map +1 -1
- package/lib/module/useLinking.js +58 -38
- package/lib/module/useLinking.js.map +1 -1
- package/lib/module/useLinking.native.js +33 -28
- package/lib/module/useLinking.native.js.map +1 -1
- package/package.json +7 -6
- package/src/ServerContext.tsx +3 -2
- package/src/useLinking.native.tsx +6 -1
- package/src/useLinking.tsx +47 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useLinking.tsx"],"names":["createMemoryHistory","index","items","pending","interrupt","forEach","it","cb","history","id","window","state","findIndex","item","get","backIndex","path","i","push","slice","length","pushState","replace","replaceState","go","n","Math","min","Promise","resolve","reject","done","interrupted","clearTimeout","timer","Error","title","document","ref","setTimeout","splice","onPopState","currentIndex","max","last","pop","removeEventListener","addEventListener","listen","listener","findMatchingState","a","b","undefined","key","aHistoryLength","routes","bHistoryLength","aRoute","bRoute","aChildState","bChildState","series","handling","queue","callback","unshift","linkingHandlers","useLinking","independent","enabled","config","getStateFromPath","getStateFromPathDefault","getPathFromState","getPathFromStateDefault","getActionFromState","getActionFromStateDefault","React","useEffect","process","env","NODE_ENV","console","error","join","trim","handler","Symbol","indexOf","useState","enabledRef","useRef","configRef","getStateFromPathRef","getPathFromStateRef","getActionFromStateRef","current","server","useContext","ServerContext","getInitialState","useCallback","value","location","pathname","search","thenable","then","onfulfilled","catch","previousIndexRef","previousStateRef","pendingPopStatePathRef","navigation","previousIndex","record","resetRoot","rootState","getRootState","some","r","routeNames","includes","name","warn","action","dispatch","e","message","route","onStateChange","previousState","pendingPath","previousFocusedState","focusedState","historyDelta","nextIndex","addListener"],"mappings":";;;;;;;AAAA;;AASA;;AACA;;AAEA;;;;;;;;AAcA,MAAMA,mBAAmB,GAAG,MAAM;AAChC,MAAIC,KAAK,GAAG,CAAZ;AACA,MAAIC,KAAsB,GAAG,EAA7B,CAFgC,CAIhC;AACA;;AACA,QAAMC,OAAgE,GAAG,EAAzE;;AAEA,QAAMC,SAAS,GAAG,MAAM;AACtB;AACA;AACA;AACAD,IAAAA,OAAO,CAACE,OAAR,CAAiBC,EAAD,IAAQ;AACtB,YAAMC,EAAE,GAAGD,EAAE,CAACC,EAAd;;AACAD,MAAAA,EAAE,CAACC,EAAH,GAAQ,MAAMA,EAAE,CAAC,IAAD,CAAhB;AACD,KAHD;AAID,GARD;;AAUA,QAAMC,OAAO,GAAG;AACd,Q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O,CAACP,KAA7B;;AAEA,cAAI;AACF,gBAAIwI,SAAS,KAAK,CAAC,CAAf,IAAoBA,SAAS,GAAG/F,YAApC,EAAkD;AAChD;AACA,oBAAMlC,OAAO,CAACgB,EAAR,CAAWiH,SAAS,GAAG/F,YAAvB,CAAN;AACD,aAHD,MAGO;AACL;AACA;AACA;AACA,oBAAMlC,OAAO,CAACgB,EAAR,CAAWgH,YAAX,CAAN;AACD,aATC,CAWF;;;AACAhI,YAAAA,OAAO,CAACc,OAAR,CAAgB;AAAEN,cAAAA,IAAF;AAAQL,cAAAA;AAAR,aAAhB;AACD,WAbD,CAaE,OAAOqH,CAAP,EAAU,CACV;AACD;AACF,SAtBM,MAsBA;AACL;AACAxH,UAAAA,OAAO,CAACc,OAAR,CAAgB;AAAEN,YAAAA,IAAF;AAAQL,YAAAA;AAAR,WAAhB;AACD;AACF,OA7CD,MA6CO;AACL;AACA;AACAH,QAAAA,OAAO,CAACc,OAAR,CAAgB;AAAEN,UAAAA,IAAF;AAAQL,UAAAA;AAAR,SAAhB;AACD;AACF,KA7ED,CAvBoB,CAsGpB;AACA;AACA;;;AACA,2BAAO2B,GAAG,CAAC2D,OAAX,iDAAO,aAAayC,WAAb,CAAyB,OAAzB,EAAkC5E,MAAM,CAACqE,aAAD,CAAxC,CAAP;AACD,GA1GD;AA4GA,SAAO;AACL9B,IAAAA;AADK,GAAP;AAGD","sourcesContent":["import {\n findFocusedRoute,\n getActionFromState as getActionFromStateDefault,\n getPathFromState as getPathFromStateDefault,\n getStateFromPath as getStateFromPathDefault,\n NavigationContainerRef,\n NavigationState,\n ParamListBase,\n} from '@react-navigation/core';\nimport { nanoid } from 'nanoid/non-secure';\nimport * as React from 'react';\n\nimport ServerContext from './ServerContext';\nimport type { LinkingOptions } from './types';\n\ntype ResultState = ReturnType<typeof getStateFromPathDefault>;\n\ntype HistoryRecord = {\n // Unique identifier for this record to match it with window.history.state\n id: string;\n // Navigation state object for the history entry\n state: NavigationState;\n // Path of the history entry\n path: string;\n};\n\nconst createMemoryHistory = () => {\n let index = 0;\n let items: HistoryRecord[] = [];\n\n // Pending callbacks for `history.go(n)`\n // We might modify the callback stored if it was interrupted, so we have a ref to identify it\n const pending: { ref: unknown; cb: (interrupted?: boolean) => void }[] = [];\n\n const interrupt = () => {\n // If another history operation was performed we need to interrupt existing ones\n // This makes sure that calls such as `history.replace` after `history.go` don't happen\n // Since otherwise it won't be correct if something else has changed\n pending.forEach((it) => {\n const cb = it.cb;\n it.cb = () => cb(true);\n });\n };\n\n const history = {\n get index(): number {\n // We store an id in the state instead of an index\n // Index could get out of sync with in-memory values if page reloads\n const id = window.history.state?.id;\n\n if (id) {\n const index = items.findIndex((item) => item.id === id);\n\n return index > -1 ? index : 0;\n }\n\n return 0;\n },\n\n get(index: number) {\n return items[index];\n },\n\n backIndex({ path }: { path: string }) {\n // We need to find the index from the element before current to get closest path to go back to\n for (let i = index - 1; i >= 0; i--) {\n const item = items[i];\n\n if (item.path === path) {\n return i;\n }\n }\n\n return -1;\n },\n\n push({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = nanoid();\n\n // When a new entry is pushed, all the existing entries after index will be inaccessible\n // So we remove any existing entries after the current index to clean them up\n items = items.slice(0, index + 1);\n\n items.push({ path, state, id });\n index = items.length - 1;\n\n // We pass empty string for title because it's ignored in all browsers except safari\n // We don't store state object in history.state because:\n // - browsers have limits on how big it can be, and we don't control the size\n // - while not recommended, there could be non-serializable data in state\n window.history.pushState({ id }, '', path);\n },\n\n replace({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = window.history.state?.id ?? nanoid();\n\n if (!items.length || items.findIndex((item) => item.id === id) < 0) {\n // There are two scenarios for creating an array with only one history record:\n // - When loaded id not found in the items array, this function by default will replace\n // the first item. We need to keep only the new updated object, otherwise it will break\n // the page when navigating forward in history.\n // - This is the first time any state modifications are done\n // So we need to push the entry as there's nothing to replace\n items = [{ path, state, id }];\n } else {\n items[index] = { path, state, id };\n }\n\n window.history.replaceState({ id }, '', path);\n },\n\n // `history.go(n)` is asynchronous, there are couple of things to keep in mind:\n // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.\n // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.\n // - the `popstate` event fires before the next frame after calling `history.go(n)`.\n // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.\n go(n: number) {\n interrupt();\n\n if (n > 0) {\n // We shouldn't go forward more than available index\n n = Math.min(n, items.length - 1);\n } else if (n < 0) {\n // We shouldn't go back more than the 0 index\n // Otherwise we'll exit the page\n n = index + n < 0 ? -index : n;\n }\n\n if (n === 0) {\n return;\n }\n\n index += n;\n\n // When we call `history.go`, `popstate` will fire when there's history to go back to\n // So we need to somehow handle following cases:\n // - There's history to go back, `history.go` is called, and `popstate` fires\n // - `history.go` is called multiple times, we need to resolve on respective `popstate`\n // - No history to go back, but `history.go` was called, browser has no API to detect it\n return new Promise<void>((resolve, reject) => {\n const done = (interrupted?: boolean) => {\n clearTimeout(timer);\n\n if (interrupted) {\n reject(new Error('History was changed during navigation.'));\n return;\n }\n\n // There seems to be a bug in Chrome regarding updating the title\n // If we set a title just before calling `history.go`, the title gets lost\n // However the value of `document.title` is still what we set it to\n // It's just not displayed in the tab bar\n // To update the tab bar, we need to reset the title to something else first (e.g. '')\n // And set the title to what it was before so it gets applied\n // It won't work without setting it to empty string coz otherwise title isn't changing\n // Which means that the browser won't do anything after setting the title\n const { title } = window.document;\n\n window.document.title = '';\n window.document.title = title;\n\n resolve();\n };\n\n pending.push({ ref: done, cb: done });\n\n // If navigation didn't happen within 100ms, assume that it won't happen\n // This may not be accurate, but hopefully it won't take so much time\n // In Chrome, navigation seems to happen instantly in next microtask\n // But on Firefox, it seems to take much longer, around 50ms from our testing\n // We're using a hacky timeout since there doesn't seem to be way to know for sure\n const timer = setTimeout(() => {\n const index = pending.findIndex((it) => it.ref === done);\n\n if (index > -1) {\n pending[index].cb();\n pending.splice(index, 1);\n }\n }, 100);\n\n const onPopState = () => {\n const id = window.history.state?.id;\n const currentIndex = items.findIndex((item) => item.id === id);\n\n // Fix createMemoryHistory.index variable's value\n // as it may go out of sync when navigating in the browser.\n index = Math.max(currentIndex, 0);\n\n const last = pending.pop();\n\n window.removeEventListener('popstate', onPopState);\n last?.cb();\n };\n\n window.addEventListener('popstate', onPopState);\n window.history.go(n);\n });\n },\n\n // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`\n // If we call `history.go(n)` ourselves, we don't want it to trigger the listener\n // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener\n listen(listener: () => void) {\n const onPopState = () => {\n if (pending.length) {\n // This was triggered by `history.go(n)`, we shouldn't call the listener\n return;\n }\n\n listener();\n };\n\n window.addEventListener('popstate', onPopState);\n\n return () => window.removeEventListener('popstate', onPopState);\n },\n };\n\n return history;\n};\n\n/**\n * Find the matching navigation state that changed between 2 navigation states\n * e.g.: a -> b -> c -> d and a -> b -> c -> e -> f, if history in b changed, b is the matching state\n */\nconst findMatchingState = <T extends NavigationState>(\n a: T | undefined,\n b: T | undefined\n): [T | undefined, T | undefined] => {\n if (a === undefined || b === undefined || a.key !== b.key) {\n return [undefined, undefined];\n }\n\n // Tab and drawer will have `history` property, but stack will have history in `routes`\n const aHistoryLength = a.history ? a.history.length : a.routes.length;\n const bHistoryLength = b.history ? b.history.length : b.routes.length;\n\n const aRoute = a.routes[a.index];\n const bRoute = b.routes[b.index];\n\n const aChildState = aRoute.state as T | undefined;\n const bChildState = bRoute.state as T | undefined;\n\n // Stop here if this is the state object that changed:\n // - history length is different\n // - focused routes are different\n // - one of them doesn't have child state\n // - child state keys are different\n if (\n aHistoryLength !== bHistoryLength ||\n aRoute.key !== bRoute.key ||\n aChildState === undefined ||\n bChildState === undefined ||\n aChildState.key !== bChildState.key\n ) {\n return [a, b];\n }\n\n return findMatchingState(aChildState, bChildState);\n};\n\n/**\n * Run async function in series as it's called.\n */\nconst series = (cb: () => Promise<void>) => {\n // Whether we're currently handling a callback\n let handling = false;\n let queue: (() => Promise<void>)[] = [];\n\n const callback = async () => {\n try {\n if (handling) {\n // If we're currently handling a previous event, wait before handling this one\n // Add the callback to the beginning of the queue\n queue.unshift(callback);\n return;\n }\n\n handling = true;\n\n await cb();\n } finally {\n handling = false;\n\n if (queue.length) {\n // If we have queued items, handle the last one\n const last = queue.pop();\n\n last?.();\n }\n }\n };\n\n return callback;\n};\n\nlet linkingHandlers: Symbol[] = [];\n\ntype Options = LinkingOptions<ParamListBase> & {\n independent?: boolean;\n};\n\nexport default function useLinking(\n ref: React.RefObject<NavigationContainerRef<ParamListBase>>,\n {\n independent,\n enabled = true,\n config,\n getStateFromPath = getStateFromPathDefault,\n getPathFromState = getPathFromStateDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options\n) {\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n ]\n .join('\\n')\n .trim()\n );\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n const [history] = React.useState(createMemoryHistory);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = React.useRef(enabled);\n const configRef = React.useRef(config);\n const getStateFromPathRef = React.useRef(getStateFromPath);\n const getPathFromStateRef = React.useRef(getPathFromState);\n const getActionFromStateRef = React.useRef(getActionFromState);\n\n React.useEffect(() => {\n enabledRef.current = enabled;\n configRef.current = config;\n getStateFromPathRef.current = getStateFromPath;\n getPathFromStateRef.current = getPathFromState;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const server = React.useContext(ServerContext);\n\n const getInitialState = React.useCallback(() => {\n let value: ResultState | undefined;\n\n if (enabledRef.current) {\n const location =\n server?.location ??\n (typeof window !== 'undefined' ? window.location : undefined);\n\n const path = location ? location.pathname + location.search : undefined;\n\n if (path) {\n value = getStateFromPathRef.current(path, configRef.current);\n }\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(value) : value);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike<ResultState | undefined>;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const previousIndexRef = React.useRef<number | undefined>(undefined);\n const previousStateRef = React.useRef<NavigationState | undefined>(undefined);\n const pendingPopStatePathRef = React.useRef<string | undefined>(undefined);\n\n React.useEffect(() => {\n previousIndexRef.current = history.index;\n\n return history.listen(() => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const path = location.pathname + location.search;\n const index = history.index;\n\n const previousIndex = previousIndexRef.current ?? 0;\n\n previousIndexRef.current = index;\n pendingPopStatePathRef.current = path;\n\n // When browser back/forward is clicked, we first need to check if state object for this index exists\n // If it does we'll reset to that state object\n // Otherwise, we'll handle it like a regular deep link\n const record = history.get(index);\n\n if (record?.path === path && record?.state) {\n navigation.resetRoot(record.state);\n return;\n }\n\n const state = getStateFromPathRef.current(path, configRef.current);\n\n // We should only dispatch an action when going forward\n // Otherwise the action will likely add items to history, which would mess things up\n if (state) {\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n const rootState = navigation.getRootState();\n\n if (state.routes.some((r) => !rootState?.routeNames.includes(r.name))) {\n console.warn(\n \"The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration.\"\n );\n return;\n }\n\n if (index > previousIndex) {\n const action = getActionFromStateRef.current(\n state,\n configRef.current\n );\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${path}': ${e.message}`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n // if current path didn't return any state, we should revert to initial state\n navigation.resetRoot(state);\n }\n });\n }, [enabled, history, ref]);\n\n React.useEffect(() => {\n if (!enabled) {\n return;\n }\n\n if (ref.current) {\n // We need to record the current metadata on the first render if they aren't set\n // This will allow the initial state to be in the history entry\n const state = ref.current.getRootState();\n\n if (state) {\n const route = findFocusedRoute(state);\n const path =\n route?.path ?? getPathFromStateRef.current(state, configRef.current);\n\n if (previousStateRef.current === undefined) {\n previousStateRef.current = state;\n }\n\n history.replace({ path, state });\n }\n }\n\n const onStateChange = async () => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const previousState = previousStateRef.current;\n const state = navigation.getRootState();\n\n const pendingPath = pendingPopStatePathRef.current;\n const route = findFocusedRoute(state);\n const path =\n route?.path ?? getPathFromStateRef.current(state, configRef.current);\n\n previousStateRef.current = state;\n pendingPopStatePathRef.current = undefined;\n\n // To detect the kind of state change, we need to:\n // - Find the common focused navigation state in previous and current state\n // - If only the route keys changed, compare history/routes.length to check if we go back/forward/replace\n // - If no common focused navigation state found, it's a replace\n const [previousFocusedState, focusedState] = findMatchingState(\n previousState,\n state\n );\n\n if (\n previousFocusedState &&\n focusedState &&\n // We should only handle push/pop if path changed from what was in last `popstate`\n // Otherwise it's likely a change triggered by `popstate`\n path !== pendingPath\n ) {\n const historyDelta =\n (focusedState.history\n ? focusedState.history.length\n : focusedState.routes.length) -\n (previousFocusedState.history\n ? previousFocusedState.history.length\n : previousFocusedState.routes.length);\n\n if (historyDelta > 0) {\n // If history length is increased, we should pushState\n // Note that path might not actually change here, for example, drawer open should pushState\n history.push({ path, state });\n } else if (historyDelta < 0) {\n // If history length is decreased, i.e. entries were removed, we want to go back\n\n const nextIndex = history.backIndex({ path });\n const currentIndex = history.index;\n\n try {\n if (nextIndex !== -1 && nextIndex < currentIndex) {\n // An existing entry for this path exists and it's less than current index, go back to that\n await history.go(nextIndex - currentIndex);\n } else {\n // We couldn't find an existing entry to go back to, so we'll go back by the delta\n // This won't be correct if multiple routes were pushed in one go before\n // Usually this shouldn't happen and this is a fallback for that\n await history.go(historyDelta);\n }\n\n // Store the updated state as well as fix the path if incorrect\n history.replace({ path, state });\n } catch (e) {\n // The navigation was interrupted\n }\n } else {\n // If history length is unchanged, we want to replaceState\n history.replace({ path, state });\n }\n } else {\n // If no common navigation state was found, assume it's a replace\n // This would happen if the user did a reset/conditionally changed navigators\n history.replace({ path, state });\n }\n };\n\n // We debounce onStateChange coz we don't want multiple state changes to be handled at one time\n // This could happen since `history.go(n)` is asynchronous\n // If `pushState` or `replaceState` were called before `history.go(n)` completes, it'll mess stuff up\n return ref.current?.addListener('state', series(onStateChange));\n });\n\n return {\n getInitialState,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["useLinking.tsx"],"names":["createMemoryHistory","index","items","pending","interrupt","forEach","it","cb","history","id","window","state","findIndex","item","get","backIndex","path","i","push","slice","length","pushState","replace","replaceState","go","n","Math","max","min","Promise","resolve","reject","done","interrupted","clearTimeout","timer","Error","title","document","ref","setTimeout","splice","onPopState","currentIndex","last","pop","removeEventListener","addEventListener","listen","listener","findMatchingState","a","b","undefined","key","aHistoryLength","routes","bHistoryLength","aRoute","bRoute","aChildState","bChildState","series","handling","queue","callback","unshift","linkingHandlers","useLinking","independent","enabled","config","getStateFromPath","getStateFromPathDefault","getPathFromState","getPathFromStateDefault","getActionFromState","getActionFromStateDefault","React","useEffect","process","env","NODE_ENV","console","error","join","trim","handler","Symbol","indexOf","useState","enabledRef","useRef","configRef","getStateFromPathRef","getPathFromStateRef","getActionFromStateRef","current","server","useContext","ServerContext","getInitialState","useCallback","value","location","pathname","search","thenable","then","onfulfilled","catch","previousIndexRef","previousStateRef","pendingPopStatePathRef","navigation","previousIndex","record","resetRoot","rootState","getRootState","some","r","routeNames","includes","name","warn","action","dispatch","e","message","getPathForRoute","route","stateForPath","focusedRoute","params","onStateChange","previousState","pendingPath","previousFocusedState","focusedState","historyDelta","nextIndex","addListener"],"mappings":";;;;;;;AAAA;;AASA;;AACA;;AACA;;AAEA;;;;;;;;AAcA,MAAMA,mBAAmB,GAAG,MAAM;AAChC,MAAIC,KAAK,GAAG,CAAZ;AACA,MAAIC,KAAsB,GAAG,EAA7B,CAFgC,CAIhC;AACA;;AACA,QAAMC,OAAgE,GAAG,EAAzE;;AAEA,QAAMC,SAAS,GAAG,MAAM;AACtB;AACA;AACA;AACAD,IAAAA,OAAO,CAACE,OAAR,CAAiBC,EAAD,IAAQ;AACtB,YAAMC,EAAE,GAAGD,EAAE,CAACC,EAAd;;AACAD,MAAAA,EAAE,CAACC,EAAH,GAAQ,MAAMA,EAAE,CAAC,IAAD,CAAhB;AACD,KAHD;AAID,GARD;;AAUA,QAAMC,OAAO,GAAG;AACd,QAAIP,KAAJ,GAAoB;AAAA;;AAClB;AACA;AACA,YAAMQ,EAAE,4BAAGC,MAAM,CAACF,OAAP,CAAeG,KAAlB,0DAAG,sBAAsBF,EAAjC;;AAEA,UAAIA,EAAJ,EAAQ;AACN,cAAMR,KAAK,GAAGC,KAAK,CAACU,SAAN,CAAiBC,IAAD,IAAUA,IAAI,CAACJ,EAAL,KAAYA,EAAtC,CAAd;AAEA,eAAOR,KAAK,GAAG,CAAC,CAAT,GAAaA,KAAb,GAAqB,CAA5B;AACD;;AAED,aAAO,CAAP;AACD,KAba;;AAeda,IAAAA,GAAG,CAACb,KAAD,EAAgB;AACjB,aAAOC,KAAK,CAACD,KAAD,CAAZ;AACD,KAjBa;;AAmBdc,IAAAA,SAAS,OAA6B;AAAA,UAA5B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YAAAA;AAAF,WAAlB,CAAlB;AACA,gBAAM2B,YAAY,GAAGnC,OAAO,CAACP,KAA7B;;AAEA,cAAI;AACF,gBAAI4I,SAAS,KAAK,CAAC,CAAf,IAAoBA,SAAS,GAAGlG,YAApC,EAAkD;AAChD;AACA,oBAAMnC,OAAO,CAACgB,EAAR,CAAWqH,SAAS,GAAGlG,YAAvB,CAAN;AACD,aAHD,MAGO;AACL;AACA;AACA;AACA,oBAAMnC,OAAO,CAACgB,EAAR,CAAWoH,YAAX,CAAN;AACD,aATC,CAWF;;;AACApI,YAAAA,OAAO,CAACc,OAAR,CAAgB;AAAEN,cAAAA,IAAF;AAAQL,cAAAA;AAAR,aAAhB;AACD,WAbD,CAaE,OAAOqH,CAAP,EAAU,CACV;AACD;AACF,SAtBM,MAsBA;AACL;AACAxH,UAAAA,OAAO,CAACc,OAAR,CAAgB;AAAEN,YAAAA,IAAF;AAAQL,YAAAA;AAAR,WAAhB;AACD;AACF,OA7CD,MA6CO;AACL;AACA;AACAH,QAAAA,OAAO,CAACc,OAAR,CAAgB;AAAEN,UAAAA,IAAF;AAAQL,UAAAA;AAAR,SAAhB;AACD;AACF,KAjFD,CAlDoB,CAqIpB;AACA;AACA;;;AACA,2BAAO4B,GAAG,CAAC0D,OAAX,iDAAO,aAAa6C,WAAb,CAAyB,OAAzB,EAAkChF,MAAM,CAACyE,aAAD,CAAxC,CAAP;AACD,GAzID;AA2IA,SAAO;AACLlC,IAAAA;AADK,GAAP;AAGD","sourcesContent":["import {\n findFocusedRoute,\n getActionFromState as getActionFromStateDefault,\n getPathFromState as getPathFromStateDefault,\n getStateFromPath as getStateFromPathDefault,\n NavigationContainerRef,\n NavigationState,\n ParamListBase,\n} from '@react-navigation/core';\nimport isEqual from 'fast-deep-equal';\nimport { nanoid } from 'nanoid/non-secure';\nimport * as React from 'react';\n\nimport ServerContext from './ServerContext';\nimport type { LinkingOptions } from './types';\n\ntype ResultState = ReturnType<typeof getStateFromPathDefault>;\n\ntype HistoryRecord = {\n // Unique identifier for this record to match it with window.history.state\n id: string;\n // Navigation state object for the history entry\n state: NavigationState;\n // Path of the history entry\n path: string;\n};\n\nconst createMemoryHistory = () => {\n let index = 0;\n let items: HistoryRecord[] = [];\n\n // Pending callbacks for `history.go(n)`\n // We might modify the callback stored if it was interrupted, so we have a ref to identify it\n const pending: { ref: unknown; cb: (interrupted?: boolean) => void }[] = [];\n\n const interrupt = () => {\n // If another history operation was performed we need to interrupt existing ones\n // This makes sure that calls such as `history.replace` after `history.go` don't happen\n // Since otherwise it won't be correct if something else has changed\n pending.forEach((it) => {\n const cb = it.cb;\n it.cb = () => cb(true);\n });\n };\n\n const history = {\n get index(): number {\n // We store an id in the state instead of an index\n // Index could get out of sync with in-memory values if page reloads\n const id = window.history.state?.id;\n\n if (id) {\n const index = items.findIndex((item) => item.id === id);\n\n return index > -1 ? index : 0;\n }\n\n return 0;\n },\n\n get(index: number) {\n return items[index];\n },\n\n backIndex({ path }: { path: string }) {\n // We need to find the index from the element before current to get closest path to go back to\n for (let i = index - 1; i >= 0; i--) {\n const item = items[i];\n\n if (item.path === path) {\n return i;\n }\n }\n\n return -1;\n },\n\n push({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = nanoid();\n\n // When a new entry is pushed, all the existing entries after index will be inaccessible\n // So we remove any existing entries after the current index to clean them up\n items = items.slice(0, index + 1);\n\n items.push({ path, state, id });\n index = items.length - 1;\n\n // We pass empty string for title because it's ignored in all browsers except safari\n // We don't store state object in history.state because:\n // - browsers have limits on how big it can be, and we don't control the size\n // - while not recommended, there could be non-serializable data in state\n window.history.pushState({ id }, '', path);\n },\n\n replace({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = window.history.state?.id ?? nanoid();\n\n if (!items.length || items.findIndex((item) => item.id === id) < 0) {\n // There are two scenarios for creating an array with only one history record:\n // - When loaded id not found in the items array, this function by default will replace\n // the first item. We need to keep only the new updated object, otherwise it will break\n // the page when navigating forward in history.\n // - This is the first time any state modifications are done\n // So we need to push the entry as there's nothing to replace\n items = [{ path, state, id }];\n index = 0;\n } else {\n items[index] = { path, state, id };\n }\n\n window.history.replaceState({ id }, '', path);\n },\n\n // `history.go(n)` is asynchronous, there are couple of things to keep in mind:\n // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.\n // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.\n // - the `popstate` event fires before the next frame after calling `history.go(n)`.\n // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.\n go(n: number) {\n interrupt();\n\n if (n === 0) {\n return;\n }\n\n // We shouldn't go back more than the 0 index (otherwise we'll exit the page)\n // Or forward more than the available index (or the app will crash)\n index =\n n < 0 ? Math.max(index - n, 0) : Math.min(index + n, items.length - 1);\n\n // When we call `history.go`, `popstate` will fire when there's history to go back to\n // So we need to somehow handle following cases:\n // - There's history to go back, `history.go` is called, and `popstate` fires\n // - `history.go` is called multiple times, we need to resolve on respective `popstate`\n // - No history to go back, but `history.go` was called, browser has no API to detect it\n return new Promise<void>((resolve, reject) => {\n const done = (interrupted?: boolean) => {\n clearTimeout(timer);\n\n if (interrupted) {\n reject(new Error('History was changed during navigation.'));\n return;\n }\n\n // There seems to be a bug in Chrome regarding updating the title\n // If we set a title just before calling `history.go`, the title gets lost\n // However the value of `document.title` is still what we set it to\n // It's just not displayed in the tab bar\n // To update the tab bar, we need to reset the title to something else first (e.g. '')\n // And set the title to what it was before so it gets applied\n // It won't work without setting it to empty string coz otherwise title isn't changing\n // Which means that the browser won't do anything after setting the title\n const { title } = window.document;\n\n window.document.title = '';\n window.document.title = title;\n\n resolve();\n };\n\n pending.push({ ref: done, cb: done });\n\n // If navigation didn't happen within 100ms, assume that it won't happen\n // This may not be accurate, but hopefully it won't take so much time\n // In Chrome, navigation seems to happen instantly in next microtask\n // But on Firefox, it seems to take much longer, around 50ms from our testing\n // We're using a hacky timeout since there doesn't seem to be way to know for sure\n const timer = setTimeout(() => {\n const index = pending.findIndex((it) => it.ref === done);\n\n if (index > -1) {\n pending[index].cb();\n pending.splice(index, 1);\n }\n }, 100);\n\n const onPopState = () => {\n const id = window.history.state?.id;\n const currentIndex = items.findIndex((item) => item.id === id);\n\n // Fix createMemoryHistory.index variable's value\n // as it may go out of sync when navigating in the browser.\n index = Math.max(currentIndex, 0);\n\n const last = pending.pop();\n\n window.removeEventListener('popstate', onPopState);\n last?.cb();\n };\n\n window.addEventListener('popstate', onPopState);\n window.history.go(n);\n });\n },\n\n // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`\n // If we call `history.go(n)` ourselves, we don't want it to trigger the listener\n // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener\n listen(listener: () => void) {\n const onPopState = () => {\n if (pending.length) {\n // This was triggered by `history.go(n)`, we shouldn't call the listener\n return;\n }\n\n listener();\n };\n\n window.addEventListener('popstate', onPopState);\n\n return () => window.removeEventListener('popstate', onPopState);\n },\n };\n\n return history;\n};\n\n/**\n * Find the matching navigation state that changed between 2 navigation states\n * e.g.: a -> b -> c -> d and a -> b -> c -> e -> f, if history in b changed, b is the matching state\n */\nconst findMatchingState = <T extends NavigationState>(\n a: T | undefined,\n b: T | undefined\n): [T | undefined, T | undefined] => {\n if (a === undefined || b === undefined || a.key !== b.key) {\n return [undefined, undefined];\n }\n\n // Tab and drawer will have `history` property, but stack will have history in `routes`\n const aHistoryLength = a.history ? a.history.length : a.routes.length;\n const bHistoryLength = b.history ? b.history.length : b.routes.length;\n\n const aRoute = a.routes[a.index];\n const bRoute = b.routes[b.index];\n\n const aChildState = aRoute.state as T | undefined;\n const bChildState = bRoute.state as T | undefined;\n\n // Stop here if this is the state object that changed:\n // - history length is different\n // - focused routes are different\n // - one of them doesn't have child state\n // - child state keys are different\n if (\n aHistoryLength !== bHistoryLength ||\n aRoute.key !== bRoute.key ||\n aChildState === undefined ||\n bChildState === undefined ||\n aChildState.key !== bChildState.key\n ) {\n return [a, b];\n }\n\n return findMatchingState(aChildState, bChildState);\n};\n\n/**\n * Run async function in series as it's called.\n */\nconst series = (cb: () => Promise<void>) => {\n // Whether we're currently handling a callback\n let handling = false;\n let queue: (() => Promise<void>)[] = [];\n\n const callback = async () => {\n try {\n if (handling) {\n // If we're currently handling a previous event, wait before handling this one\n // Add the callback to the beginning of the queue\n queue.unshift(callback);\n return;\n }\n\n handling = true;\n\n await cb();\n } finally {\n handling = false;\n\n if (queue.length) {\n // If we have queued items, handle the last one\n const last = queue.pop();\n\n last?.();\n }\n }\n };\n\n return callback;\n};\n\nlet linkingHandlers: Symbol[] = [];\n\ntype Options = LinkingOptions<ParamListBase> & {\n independent?: boolean;\n};\n\nexport default function useLinking(\n ref: React.RefObject<NavigationContainerRef<ParamListBase>>,\n {\n independent,\n enabled = true,\n config,\n getStateFromPath = getStateFromPathDefault,\n getPathFromState = getPathFromStateDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options\n) {\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n ]\n .join('\\n')\n .trim()\n );\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n const [history] = React.useState(createMemoryHistory);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = React.useRef(enabled);\n const configRef = React.useRef(config);\n const getStateFromPathRef = React.useRef(getStateFromPath);\n const getPathFromStateRef = React.useRef(getPathFromState);\n const getActionFromStateRef = React.useRef(getActionFromState);\n\n React.useEffect(() => {\n enabledRef.current = enabled;\n configRef.current = config;\n getStateFromPathRef.current = getStateFromPath;\n getPathFromStateRef.current = getPathFromState;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const server = React.useContext(ServerContext);\n\n const getInitialState = React.useCallback(() => {\n let value: ResultState | undefined;\n\n if (enabledRef.current) {\n const location =\n server?.location ??\n (typeof window !== 'undefined' ? window.location : undefined);\n\n const path = location ? location.pathname + location.search : undefined;\n\n if (path) {\n value = getStateFromPathRef.current(path, configRef.current);\n }\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(value) : value);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike<ResultState | undefined>;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const previousIndexRef = React.useRef<number | undefined>(undefined);\n const previousStateRef = React.useRef<NavigationState | undefined>(undefined);\n const pendingPopStatePathRef = React.useRef<string | undefined>(undefined);\n\n React.useEffect(() => {\n previousIndexRef.current = history.index;\n\n return history.listen(() => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const path = location.pathname + location.search;\n const index = history.index;\n\n const previousIndex = previousIndexRef.current ?? 0;\n\n previousIndexRef.current = index;\n pendingPopStatePathRef.current = path;\n\n // When browser back/forward is clicked, we first need to check if state object for this index exists\n // If it does we'll reset to that state object\n // Otherwise, we'll handle it like a regular deep link\n const record = history.get(index);\n\n if (record?.path === path && record?.state) {\n navigation.resetRoot(record.state);\n return;\n }\n\n const state = getStateFromPathRef.current(path, configRef.current);\n\n // We should only dispatch an action when going forward\n // Otherwise the action will likely add items to history, which would mess things up\n if (state) {\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n const rootState = navigation.getRootState();\n\n if (state.routes.some((r) => !rootState?.routeNames.includes(r.name))) {\n console.warn(\n \"The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration.\"\n );\n return;\n }\n\n if (index > previousIndex) {\n const action = getActionFromStateRef.current(\n state,\n configRef.current\n );\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${path}': ${\n typeof e === 'object' && e != null && 'message' in e\n ? // @ts-expect-error: we're already checking for this\n e.message\n : e\n }`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n navigation.resetRoot(state);\n }\n } else {\n // if current path didn't return any state, we should revert to initial state\n navigation.resetRoot(state);\n }\n });\n }, [enabled, history, ref]);\n\n React.useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const getPathForRoute = (\n route: ReturnType<typeof findFocusedRoute>,\n state: NavigationState\n ): string => {\n // If the `route` object contains a `path`, use that path as long as `route.name` and `params` still match\n // This makes sure that we preserve the original URL for wildcard routes\n if (route?.path) {\n const stateForPath = getStateFromPathRef.current(\n route.path,\n configRef.current\n );\n\n if (stateForPath) {\n const focusedRoute = findFocusedRoute(stateForPath);\n\n if (\n focusedRoute &&\n focusedRoute.name === route.name &&\n isEqual(focusedRoute.params, route.params)\n ) {\n return route.path;\n }\n }\n }\n\n return getPathFromStateRef.current(state, configRef.current);\n };\n\n if (ref.current) {\n // We need to record the current metadata on the first render if they aren't set\n // This will allow the initial state to be in the history entry\n const state = ref.current.getRootState();\n\n if (state) {\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n if (previousStateRef.current === undefined) {\n previousStateRef.current = state;\n }\n\n history.replace({ path, state });\n }\n }\n\n const onStateChange = async () => {\n const navigation = ref.current;\n\n if (!navigation || !enabled) {\n return;\n }\n\n const previousState = previousStateRef.current;\n const state = navigation.getRootState();\n\n // root state may not available, for example when root navigators switch inside the container\n if (!state) {\n return;\n }\n\n const pendingPath = pendingPopStatePathRef.current;\n const route = findFocusedRoute(state);\n const path = getPathForRoute(route, state);\n\n previousStateRef.current = state;\n pendingPopStatePathRef.current = undefined;\n\n // To detect the kind of state change, we need to:\n // - Find the common focused navigation state in previous and current state\n // - If only the route keys changed, compare history/routes.length to check if we go back/forward/replace\n // - If no common focused navigation state found, it's a replace\n const [previousFocusedState, focusedState] = findMatchingState(\n previousState,\n state\n );\n\n if (\n previousFocusedState &&\n focusedState &&\n // We should only handle push/pop if path changed from what was in last `popstate`\n // Otherwise it's likely a change triggered by `popstate`\n path !== pendingPath\n ) {\n const historyDelta =\n (focusedState.history\n ? focusedState.history.length\n : focusedState.routes.length) -\n (previousFocusedState.history\n ? previousFocusedState.history.length\n : previousFocusedState.routes.length);\n\n if (historyDelta > 0) {\n // If history length is increased, we should pushState\n // Note that path might not actually change here, for example, drawer open should pushState\n history.push({ path, state });\n } else if (historyDelta < 0) {\n // If history length is decreased, i.e. entries were removed, we want to go back\n\n const nextIndex = history.backIndex({ path });\n const currentIndex = history.index;\n\n try {\n if (nextIndex !== -1 && nextIndex < currentIndex) {\n // An existing entry for this path exists and it's less than current index, go back to that\n await history.go(nextIndex - currentIndex);\n } else {\n // We couldn't find an existing entry to go back to, so we'll go back by the delta\n // This won't be correct if multiple routes were pushed in one go before\n // Usually this shouldn't happen and this is a fallback for that\n await history.go(historyDelta);\n }\n\n // Store the updated state as well as fix the path if incorrect\n history.replace({ path, state });\n } catch (e) {\n // The navigation was interrupted\n }\n } else {\n // If history length is unchanged, we want to replaceState\n history.replace({ path, state });\n }\n } else {\n // If no common navigation state was found, assume it's a replace\n // This would happen if the user did a reset/conditionally changed navigators\n history.replace({ path, state });\n }\n };\n\n // We debounce onStateChange coz we don't want multiple state changes to be handled at one time\n // This could happen since `history.go(n)` is asynchronous\n // If `pushState` or `replaceState` were called before `history.go(n)` completes, it'll mess stuff up\n return ref.current?.addListener('state', series(onStateChange));\n });\n\n return {\n getInitialState,\n };\n}\n"]}
|
|
@@ -21,34 +21,38 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
21
|
|
|
22
22
|
let linkingHandlers = [];
|
|
23
23
|
|
|
24
|
-
function useLinking(ref, {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
24
|
+
function useLinking(ref, _ref) {
|
|
25
|
+
let {
|
|
26
|
+
independent,
|
|
27
|
+
enabled = true,
|
|
28
|
+
prefixes,
|
|
29
|
+
filter,
|
|
30
|
+
config,
|
|
31
|
+
getInitialURL = () => Promise.race([_reactNative.Linking.getInitialURL(), new Promise(resolve => // Timeout in 150ms if `getInitialState` doesn't resolve
|
|
32
|
+
// Workaround for https://github.com/facebook/react-native/issues/25675
|
|
33
|
+
setTimeout(resolve, 150))]),
|
|
34
|
+
subscribe = listener => {
|
|
35
|
+
const callback = _ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
url
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return listener(url);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const subscription = _reactNative.Linking.addEventListener('url', callback);
|
|
43
|
+
|
|
44
|
+
return () => {
|
|
45
|
+
// https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7
|
|
46
|
+
if (subscription !== null && subscription !== void 0 && subscription.remove) {
|
|
47
|
+
subscription.remove();
|
|
48
|
+
} else {
|
|
49
|
+
_reactNative.Linking.removeEventListener('url', callback);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
getStateFromPath = _core.getStateFromPath,
|
|
54
|
+
getActionFromState = _core.getActionFromState
|
|
55
|
+
} = _ref;
|
|
52
56
|
React.useEffect(() => {
|
|
53
57
|
if (process.env.NODE_ENV === 'production') {
|
|
54
58
|
return undefined;
|
|
@@ -158,7 +162,8 @@ function useLinking(ref, {
|
|
|
158
162
|
} catch (e) {
|
|
159
163
|
// Ignore any errors from deep linking.
|
|
160
164
|
// This could happen in case of malformed links, navigation object not being initialized etc.
|
|
161
|
-
console.warn(`An error occurred when trying to handle the link '${url}': ${e
|
|
165
|
+
console.warn(`An error occurred when trying to handle the link '${url}': ${typeof e === 'object' && e != null && 'message' in e ? // @ts-expect-error: we're already checking for this
|
|
166
|
+
e.message : e}`);
|
|
162
167
|
}
|
|
163
168
|
} else {
|
|
164
169
|
navigation.resetRoot(state);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useLinking.native.tsx"],"names":["linkingHandlers","useLinking","ref","independent","enabled","prefixes","filter","config","getInitialURL","Promise","race","Linking","resolve","setTimeout","subscribe","listener","callback","url","subscription","addEventListener","remove","removeEventListener","getStateFromPath","getStateFromPathDefault","getActionFromState","getActionFromStateDefault","React","useEffect","process","env","NODE_ENV","undefined","length","console","error","Platform","OS","join","trim","handler","Symbol","push","index","indexOf","splice","enabledRef","useRef","prefixesRef","filterRef","configRef","getInitialURLRef","getStateFromPathRef","getActionFromStateRef","current","getStateFromURL","useCallback","path","getInitialState","state","then","thenable","onfulfilled","catch","navigation","rootState","getRootState","routes","some","r","routeNames","includes","name","warn","action","dispatch","e","message","resetRoot"],"mappings":";;;;;;;AAAA;;AAMA;;AACA;;AAEA;;;;;;;;AASA,IAAIA,eAAyB,GAAG,EAAhC;;AAEe,SAASC,UAAT,CACbC,GADa,EAEb;AACEC,EAAAA,WADF;AAEEC,EAAAA,OAAO,GAAG,IAFZ;AAGEC,EAAAA,QAHF;AAIEC,EAAAA,MAJF;AAKEC,EAAAA,MALF;AAMEC,EAAAA,aAAa,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romStateDefault,\n getStateFromPath as getStateFromPathDefault,\n NavigationContainerRef,\n ParamListBase,\n} from '@react-navigation/core';\nimport * as React from 'react';\nimport { Linking, Platform } from 'react-native';\n\nimport extractPathFromURL from './extractPathFromURL';\nimport type { LinkingOptions } from './types';\n\ntype ResultState = ReturnType<typeof getStateFromPathDefault>;\n\ntype Options = LinkingOptions<ParamListBase> & {\n independent?: boolean;\n};\n\nlet linkingHandlers: Symbol[] = [];\n\nexport default function useLinking(\n ref: React.RefObject<NavigationContainerRef<ParamListBase>>,\n {\n independent,\n enabled = true,\n prefixes,\n filter,\n config,\n getInitialURL = () =>\n Promise.race([\n Linking.getInitialURL(),\n new Promise<undefined>((resolve) =>\n // Timeout in 150ms if `getInitialState` doesn't resolve\n // Workaround for https://github.com/facebook/react-native/issues/25675\n setTimeout(resolve, 150)\n ),\n ]),\n subscribe = (listener) => {\n const callback = ({ url }: { url: string }) => listener(url);\n\n const subscription = Linking.addEventListener('url', callback) as\n | { remove(): void }\n | undefined;\n\n return () => {\n // https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7\n if (subscription?.remove) {\n subscription.remove();\n } else {\n Linking.removeEventListener('url', callback);\n }\n };\n },\n getStateFromPath = getStateFromPathDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options\n) {\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n Platform.OS === 'android'\n ? \"- You have set 'android:launchMode=singleTask' in the '<activity />' section of the 'AndroidManifest.xml' file to avoid launching multiple instances\"\n : '',\n ]\n .join('\\n')\n .trim()\n );\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = React.useRef(enabled);\n const prefixesRef = React.useRef(prefixes);\n const filterRef = React.useRef(filter);\n const configRef = React.useRef(config);\n const getInitialURLRef = React.useRef(getInitialURL);\n const getStateFromPathRef = React.useRef(getStateFromPath);\n const getActionFromStateRef = React.useRef(getActionFromState);\n\n React.useEffect(() => {\n enabledRef.current = enabled;\n prefixesRef.current = prefixes;\n filterRef.current = filter;\n configRef.current = config;\n getInitialURLRef.current = getInitialURL;\n getStateFromPathRef.current = getStateFromPath;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const getStateFromURL = React.useCallback(\n (url: string | null | undefined) => {\n if (!url || (filterRef.current && !filterRef.current(url))) {\n return undefined;\n }\n\n const path = extractPathFromURL(prefixesRef.current, url);\n\n return path\n ? getStateFromPathRef.current(path, configRef.current)\n : undefined;\n },\n []\n );\n\n const getInitialState = React.useCallback(() => {\n let state: ResultState | undefined;\n\n if (enabledRef.current) {\n const url = getInitialURLRef.current();\n\n if (url != null && typeof url !== 'string') {\n return url.then((url) => {\n const state = getStateFromURL(url);\n\n return state;\n });\n }\n\n state = getStateFromURL(url);\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(state) : state);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike<ResultState | undefined>;\n }, [getStateFromURL]);\n\n React.useEffect(() => {\n const listener = (url: string) => {\n if (!enabled) {\n return;\n }\n\n const navigation = ref.current;\n const state = navigation ? getStateFromURL(url) : undefined;\n\n if (navigation && state) {\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n const rootState = navigation.getRootState();\n\n if (state.routes.some((r) => !rootState?.routeNames.includes(r.name))) {\n console.warn(\n \"The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration.\"\n );\n return;\n }\n\n const action = getActionFromStateRef.current(state, configRef.current);\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${url}': ${e.message}`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n }\n };\n\n return subscribe(listener);\n }, [enabled, getStateFromURL, ref, subscribe]);\n\n return {\n getInitialState,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["useLinking.native.tsx"],"names":["linkingHandlers","useLinking","ref","independent","enabled","prefixes","filter","config","getInitialURL","Promise","race","Linking","resolve","setTimeout","subscribe","listener","callback","url","subscription","addEventListener","remove","removeEventListener","getStateFromPath","getStateFromPathDefault","getActionFromState","getActionFromStateDefault","React","useEffect","process","env","NODE_ENV","undefined","length","console","error","Platform","OS","join","trim","handler","Symbol","push","index","indexOf","splice","enabledRef","useRef","prefixesRef","filterRef","configRef","getInitialURLRef","getStateFromPathRef","getActionFromStateRef","current","getStateFromURL","useCallback","path","getInitialState","state","then","thenable","onfulfilled","catch","navigation","rootState","getRootState","routes","some","r","routeNames","includes","name","warn","action","dispatch","e","message","resetRoot"],"mappings":";;;;;;;AAAA;;AAMA;;AACA;;AAEA;;;;;;;;AASA,IAAIA,eAAyB,GAAG,EAAhC;;AAEe,SAASC,UAAT,CACbC,GADa,QAoCb;AAAA,MAlCA;AACEC,IAAAA,WADF;AAEEC,IAAAA,OAAO,GAAG,IAFZ;AAGEC,IAAAA,QAHF;AAIEC,IAAAA,MAJF;AAKEC,IAAAA,MALF;AAMEC,IAAAA,aAAa,GAAG,MACdC,OAAO,CAACC,IA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AAgCY,SAAhC,CA7CH;AA+CA,SAAO;AACL2C,IAAAA;AADK,GAAP;AAGD","sourcesContent":["import {\n getActionFromState as getActionFromStateDefault,\n getStateFromPath as getStateFromPathDefault,\n NavigationContainerRef,\n ParamListBase,\n} from '@react-navigation/core';\nimport * as React from 'react';\nimport { Linking, Platform } from 'react-native';\n\nimport extractPathFromURL from './extractPathFromURL';\nimport type { LinkingOptions } from './types';\n\ntype ResultState = ReturnType<typeof getStateFromPathDefault>;\n\ntype Options = LinkingOptions<ParamListBase> & {\n independent?: boolean;\n};\n\nlet linkingHandlers: Symbol[] = [];\n\nexport default function useLinking(\n ref: React.RefObject<NavigationContainerRef<ParamListBase>>,\n {\n independent,\n enabled = true,\n prefixes,\n filter,\n config,\n getInitialURL = () =>\n Promise.race([\n Linking.getInitialURL(),\n new Promise<undefined>((resolve) =>\n // Timeout in 150ms if `getInitialState` doesn't resolve\n // Workaround for https://github.com/facebook/react-native/issues/25675\n setTimeout(resolve, 150)\n ),\n ]),\n subscribe = (listener) => {\n const callback = ({ url }: { url: string }) => listener(url);\n\n const subscription = Linking.addEventListener('url', callback) as\n | { remove(): void }\n | undefined;\n\n return () => {\n // https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7\n if (subscription?.remove) {\n subscription.remove();\n } else {\n Linking.removeEventListener('url', callback);\n }\n };\n },\n getStateFromPath = getStateFromPathDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options\n) {\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n Platform.OS === 'android'\n ? \"- You have set 'android:launchMode=singleTask' in the '<activity />' section of the 'AndroidManifest.xml' file to avoid launching multiple instances\"\n : '',\n ]\n .join('\\n')\n .trim()\n );\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = React.useRef(enabled);\n const prefixesRef = React.useRef(prefixes);\n const filterRef = React.useRef(filter);\n const configRef = React.useRef(config);\n const getInitialURLRef = React.useRef(getInitialURL);\n const getStateFromPathRef = React.useRef(getStateFromPath);\n const getActionFromStateRef = React.useRef(getActionFromState);\n\n React.useEffect(() => {\n enabledRef.current = enabled;\n prefixesRef.current = prefixes;\n filterRef.current = filter;\n configRef.current = config;\n getInitialURLRef.current = getInitialURL;\n getStateFromPathRef.current = getStateFromPath;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const getStateFromURL = React.useCallback(\n (url: string | null | undefined) => {\n if (!url || (filterRef.current && !filterRef.current(url))) {\n return undefined;\n }\n\n const path = extractPathFromURL(prefixesRef.current, url);\n\n return path\n ? getStateFromPathRef.current(path, configRef.current)\n : undefined;\n },\n []\n );\n\n const getInitialState = React.useCallback(() => {\n let state: ResultState | undefined;\n\n if (enabledRef.current) {\n const url = getInitialURLRef.current();\n\n if (url != null && typeof url !== 'string') {\n return url.then((url) => {\n const state = getStateFromURL(url);\n\n return state;\n });\n }\n\n state = getStateFromURL(url);\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(state) : state);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike<ResultState | undefined>;\n }, [getStateFromURL]);\n\n React.useEffect(() => {\n const listener = (url: string) => {\n if (!enabled) {\n return;\n }\n\n const navigation = ref.current;\n const state = navigation ? getStateFromURL(url) : undefined;\n\n if (navigation && state) {\n // Make sure that the routes in the state exist in the root navigator\n // Otherwise there's an error in the linking configuration\n const rootState = navigation.getRootState();\n\n if (state.routes.some((r) => !rootState?.routeNames.includes(r.name))) {\n console.warn(\n \"The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration.\"\n );\n return;\n }\n\n const action = getActionFromStateRef.current(state, configRef.current);\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${url}': ${\n typeof e === 'object' && e != null && 'message' in e\n ? // @ts-expect-error: we're already checking for this\n e.message\n : e\n }`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n }\n };\n\n return subscribe(listener);\n }, [enabled, getStateFromURL, ref, subscribe]);\n\n return {\n getInitialState,\n };\n}\n"]}
|
package/lib/module/Link.js
CHANGED
|
@@ -10,11 +10,12 @@ import useLinkProps from './useLinkProps';
|
|
|
10
10
|
* @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
|
|
11
11
|
* @param props.children Child elements to render the content.
|
|
12
12
|
*/
|
|
13
|
-
export default function Link({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export default function Link(_ref) {
|
|
14
|
+
let {
|
|
15
|
+
to,
|
|
16
|
+
action,
|
|
17
|
+
...rest
|
|
18
|
+
} = _ref;
|
|
18
19
|
const props = useLinkProps({
|
|
19
20
|
to,
|
|
20
21
|
action
|
package/lib/module/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Link.tsx"],"names":["React","Platform","Text","useLinkProps","Link","to","action","rest","props","onPress","e","createElement","select","web","onClick","default"],"mappings":"AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAAgCC,QAAhC,EAA0CC,IAA1C,QAAiE,cAAjE;AAEA,OAAOC,YAAP,MAAyB,gBAAzB;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,IAAT,
|
|
1
|
+
{"version":3,"sources":["Link.tsx"],"names":["React","Platform","Text","useLinkProps","Link","to","action","rest","props","onPress","e","createElement","select","web","onClick","default"],"mappings":"AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAAgCC,QAAhC,EAA0CC,IAA1C,QAAiE,cAAjE;AAEA,OAAOC,YAAP,MAAyB,gBAAzB;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,IAAT,OAIM;AAAA,MAJyD;AAC5EC,IAAAA,EAD4E;AAE5EC,IAAAA,MAF4E;AAG5E,OAAGC;AAHyE,GAIzD;AACnB,QAAMC,KAAK,GAAGL,YAAY,CAAY;AAAEE,IAAAA,EAAF;AAAMC,IAAAA;AAAN,GAAZ,CAA1B;;AAEA,QAAMG,OAAO,GACXC,CADc,IAEX;AACH,QAAI,aAAaH,IAAjB,EAAuB;AAAA;;AACrB,uBAAAA,IAAI,CAACE,OAAL,qEAAAF,IAAI,EAAWG,CAAX,CAAJ;AACD;;AAEDF,IAAAA,KAAK,CAACC,OAAN,CAAcC,CAAd;AACD,GARD;;AAUA,sBAAOV,KAAK,CAACW,aAAN,CAAoBT,IAApB,EAA0B,EAC/B,GAAGM,KAD4B;AAE/B,OAAGD,IAF4B;AAG/B,OAAGN,QAAQ,CAACW,MAAT,CAAgB;AACjBC,MAAAA,GAAG,EAAE;AAAEC,QAAAA,OAAO,EAAEL;AAAX,OADY;AAEjBM,MAAAA,OAAO,EAAE;AAAEN,QAAAA;AAAF;AAFQ,KAAhB;AAH4B,GAA1B,CAAP;AAQD","sourcesContent":["import type { NavigationAction } from '@react-navigation/core';\nimport * as React from 'react';\nimport { GestureResponderEvent, Platform, Text, TextProps } from 'react-native';\n\nimport useLinkProps from './useLinkProps';\nimport type { To } from './useLinkTo';\n\ntype Props<ParamList extends ReactNavigation.RootParamList> = {\n to: To<ParamList>;\n action?: NavigationAction;\n target?: string;\n onPress?: (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => void;\n} & (TextProps & { children: React.ReactNode });\n\n/**\n * Component to render link to another screen using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.to Absolute path to screen (e.g. `/feeds/hot`).\n * @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.\n * @param props.children Child elements to render the content.\n */\nexport default function Link<ParamList extends ReactNavigation.RootParamList>({\n to,\n action,\n ...rest\n}: Props<ParamList>) {\n const props = useLinkProps<ParamList>({ to, action });\n\n const onPress = (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => {\n if ('onPress' in rest) {\n rest.onPress?.(e);\n }\n\n props.onPress(e);\n };\n\n return React.createElement(Text, {\n ...props,\n ...rest,\n ...Platform.select({\n web: { onClick: onPress } as any,\n default: { onPress },\n }),\n });\n}\n"]}
|
|
@@ -25,14 +25,15 @@ global.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
|
|
|
25
25
|
* @param props.children Child elements to render the content.
|
|
26
26
|
* @param props.ref Ref object which refers to the navigation object containing helper methods.
|
|
27
27
|
*/
|
|
28
|
-
function NavigationContainerInner({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
function NavigationContainerInner(_ref, ref) {
|
|
29
|
+
let {
|
|
30
|
+
theme = DefaultTheme,
|
|
31
|
+
linking,
|
|
32
|
+
fallback = null,
|
|
33
|
+
documentTitle,
|
|
34
|
+
onReady,
|
|
35
|
+
...rest
|
|
36
|
+
} = _ref;
|
|
36
37
|
const isLinkingEnabled = linking ? linking.enabled !== false : false;
|
|
37
38
|
|
|
38
39
|
if (linking !== null && linking !== void 0 && linking.config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["NavigationContainer.tsx"],"names":["BaseNavigationContainer","getActionFromState","getPathFromState","getStateFromPath","validatePathConfig","React","LinkingContext","DefaultTheme","ThemeProvider","useBackButton","useDocumentTitle","useLinking","useThenable","global","REACT_NAVIGATION_DEVTOOLS","WeakMap","NavigationContainerInner","theme","linking","fallback","documentTitle","onReady","rest","
|
|
1
|
+
{"version":3,"sources":["NavigationContainer.tsx"],"names":["BaseNavigationContainer","getActionFromState","getPathFromState","getStateFromPath","validatePathConfig","React","LinkingContext","DefaultTheme","ThemeProvider","useBackButton","useDocumentTitle","useLinking","useThenable","global","REACT_NAVIGATION_DEVTOOLS","WeakMap","NavigationContainerInner","ref","theme","linking","fallback","documentTitle","onReady","rest","isLinkingEnabled","enabled","config","refContainer","useRef","getInitialState","independent","prefixes","useEffect","current","set","isResolved","initialState","useImperativeHandle","linkingContext","useMemo","options","isReady","onReadyRef","NavigationContainer","forwardRef"],"mappings":";;AAAA,SACEA,uBADF,EAEEC,kBAFF,EAGEC,gBAHF,EAIEC,gBAJF,EAQEC,kBARF,QASO,wBATP;AAUA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,OAAOC,YAAP,MAAyB,wBAAzB;AACA,OAAOC,aAAP,MAA0B,yBAA1B;AAEA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AASAC,MAAM,CAACC,yBAAP,GAAmC,IAAIC,OAAJ,EAAnC;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,wBAAT,OASEC,GATF,EAUE;AAAA,MATA;AACEC,IAAAA,KAAK,GAAGX,YADV;AAEEY,IAAAA,OAFF;AAGEC,IAA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KE,IAAA,GAAG,EAAET;AALP,KADF,CADF,CADF;AAaD;;AAED,MAAMgB,mBAAmB,gBAAGtC,KAAK,CAACuC,UAAN,CAAiB5B,wBAAjB,CAA5B;AAQA,eAAe2B,mBAAf","sourcesContent":["import {\n BaseNavigationContainer,\n getActionFromState,\n getPathFromState,\n getStateFromPath,\n NavigationContainerProps,\n NavigationContainerRef,\n ParamListBase,\n validatePathConfig,\n} from '@react-navigation/core';\nimport * as React from 'react';\n\nimport LinkingContext from './LinkingContext';\nimport DefaultTheme from './theming/DefaultTheme';\nimport ThemeProvider from './theming/ThemeProvider';\nimport type { DocumentTitleOptions, LinkingOptions, Theme } from './types';\nimport useBackButton from './useBackButton';\nimport useDocumentTitle from './useDocumentTitle';\nimport useLinking from './useLinking';\nimport useThenable from './useThenable';\n\ndeclare global {\n var REACT_NAVIGATION_DEVTOOLS: WeakMap<\n NavigationContainerRef<any>,\n { readonly linking: LinkingOptions<any> }\n >;\n}\n\nglobal.REACT_NAVIGATION_DEVTOOLS = new WeakMap();\n\ntype Props<ParamList extends {}> = NavigationContainerProps & {\n theme?: Theme;\n linking?: LinkingOptions<ParamList>;\n fallback?: React.ReactNode;\n documentTitle?: DocumentTitleOptions;\n onReady?: () => void;\n};\n\n/**\n * Container component which holds the navigation state designed for React Native apps.\n * This should be rendered at the root wrapping the whole app.\n *\n * @param props.initialState Initial state object for the navigation tree. When deep link handling is enabled, this will override deep links when specified. Make sure that you don't specify an `initialState` when there's a deep link (`Linking.getInitialURL()`).\n * @param props.onReady Callback which is called after the navigation tree mounts.\n * @param props.onStateChange Callback which is called with the latest navigation state when it changes.\n * @param props.theme Theme object for the navigators.\n * @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.\n * @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.\n * @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which refers to the navigation object containing helper methods.\n */\nfunction NavigationContainerInner(\n {\n theme = DefaultTheme,\n linking,\n fallback = null,\n documentTitle,\n onReady,\n ...rest\n }: Props<ParamListBase>,\n ref?: React.Ref<NavigationContainerRef<ParamListBase> | null>\n) {\n const isLinkingEnabled = linking ? linking.enabled !== false : false;\n\n if (linking?.config) {\n validatePathConfig(linking.config);\n }\n\n const refContainer =\n React.useRef<NavigationContainerRef<ParamListBase>>(null);\n\n useBackButton(refContainer);\n useDocumentTitle(refContainer, documentTitle);\n\n const { getInitialState } = useLinking(refContainer, {\n independent: rest.independent,\n enabled: isLinkingEnabled,\n prefixes: [],\n ...linking,\n });\n\n // Add additional linking related info to the ref\n // This will be used by the devtools\n React.useEffect(() => {\n if (refContainer.current) {\n REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {\n get linking() {\n return {\n ...linking,\n enabled: isLinkingEnabled,\n prefixes: linking?.prefixes ?? [],\n getStateFromPath: linking?.getStateFromPath ?? getStateFromPath,\n getPathFromState: linking?.getPathFromState ?? getPathFromState,\n getActionFromState:\n linking?.getActionFromState ?? getActionFromState,\n };\n },\n });\n }\n });\n\n const [isResolved, initialState] = useThenable(getInitialState);\n\n React.useImperativeHandle(ref, () => refContainer.current);\n\n const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);\n\n const isReady = rest.initialState != null || !isLinkingEnabled || isResolved;\n\n const onReadyRef = React.useRef(onReady);\n\n React.useEffect(() => {\n onReadyRef.current = onReady;\n });\n\n React.useEffect(() => {\n if (isReady) {\n onReadyRef.current?.();\n }\n }, [isReady]);\n\n if (!isReady) {\n // This is temporary until we have Suspense for data-fetching\n // Then the fallback will be handled by a parent `Suspense` component\n return fallback as React.ReactElement;\n }\n\n return (\n <LinkingContext.Provider value={linkingContext}>\n <ThemeProvider value={theme}>\n <BaseNavigationContainer\n {...rest}\n initialState={\n rest.initialState == null ? initialState : rest.initialState\n }\n ref={refContainer}\n />\n </ThemeProvider>\n </LinkingContext.Provider>\n );\n}\n\nconst NavigationContainer = React.forwardRef(NavigationContainerInner) as <\n RootParamList extends {} = ReactNavigation.RootParamList\n>(\n props: Props<RootParamList> & {\n ref?: React.Ref<NavigationContainerRef<RootParamList>>;\n }\n) => React.ReactElement;\n\nexport default NavigationContainer;\n"]}
|
|
@@ -9,10 +9,11 @@ import ServerContext from './ServerContext';
|
|
|
9
9
|
* @param props.children Child elements to render the content.
|
|
10
10
|
* @param props.ref Ref object which contains helper methods.
|
|
11
11
|
*/
|
|
12
|
-
export default /*#__PURE__*/React.forwardRef(function ServerContainer({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export default /*#__PURE__*/React.forwardRef(function ServerContainer(_ref, ref) {
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
location
|
|
16
|
+
} = _ref;
|
|
16
17
|
React.useEffect(() => {
|
|
17
18
|
console.error("'ServerContainer' should only be used on the server with 'react-dom/server' for SSR.");
|
|
18
19
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ServerContainer.tsx"],"names":["CurrentRenderContext","React","ServerContext","forwardRef","ServerContainer","
|
|
1
|
+
{"version":3,"sources":["ServerContainer.tsx"],"names":["CurrentRenderContext","React","ServerContext","forwardRef","ServerContainer","ref","children","location","useEffect","console","error","current","value","getCurrentOptions","options"],"mappings":"AAAA,SAASA,oBAAT,QAAqC,wBAArC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,aAAP,MAAiD,iBAAjD;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAAeD,KAAK,CAACE,UAAN,CAAiB,SAASC,eAAT,OAE9BC,GAF8B,EAG9B;AAAA,MAFA;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAEA;AACAN,EAAAA,KAAK,CAACO,SAAN,CAAgB,MAAM;AACpBC,IAAAA,OAAO,CAACC,KAAR,CACE,sFADF;AAGD,GAJD,EAIG,EAJH;AAMA,QAAMC,OAA6B,GAAG,EAAtC;;AAEA,MAAIN,GAAJ,EAAS;AACP,UAAMO,KAAK,GAAG;AACZC,MAAAA,iBAAiB,GAAG;AAClB,eAAOF,OAAO,CAACG,OAAf;AACD;;AAHW,KAAd,CADO,CAOP;AACA;AACA;AACA;;AACA,QAAI,OAAOT,GAAP,KAAe,UAAnB,EAA+B;AAC7BA,MAAAA,GAAG,CAACO,KAAD,CAAH;AACD,KAFD,MAEO;AACL;AACAP,MAAAA,GAAG,CAACM,OAAJ,GAAcC,KAAd;AACD;AACF;;AAED,sBACE,oBAAC,aAAD,CAAe,QAAf;AAAwB,IAAA,KAAK,EAAE;AAAEL,MAAAA;AAAF;AAA/B,kBACE,oBAAC,oBAAD,CAAsB,QAAtB;AAA+B,IAAA,KAAK,EAAEI;AAAtC,KACGL,QADH,CADF,CADF;AAOD,CAtCc,CAAf","sourcesContent":["import { CurrentRenderContext } from '@react-navigation/core';\nimport * as React from 'react';\n\nimport ServerContext, { ServerContextType } from './ServerContext';\nimport type { ServerContainerRef } from './types';\n\ntype Props = ServerContextType & {\n children: React.ReactNode;\n};\n\n/**\n * Container component for server rendering.\n *\n * @param props.location Location object to base the initial URL for SSR.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which contains helper methods.\n */\nexport default React.forwardRef(function ServerContainer(\n { children, location }: Props,\n ref: React.Ref<ServerContainerRef>\n) {\n React.useEffect(() => {\n console.error(\n \"'ServerContainer' should only be used on the server with 'react-dom/server' for SSR.\"\n );\n }, []);\n\n const current: { options?: object } = {};\n\n if (ref) {\n const value = {\n getCurrentOptions() {\n return current.options;\n },\n };\n\n // We write to the `ref` during render instead of `React.useImperativeHandle`\n // This is because `useImperativeHandle` will update the ref after 'commit',\n // and there's no 'commit' phase during SSR.\n // Mutating ref during render is unsafe in concurrent mode, but we don't care about it for SSR.\n if (typeof ref === 'function') {\n ref(value);\n } else {\n // @ts-expect-error: the TS types are incorrect and say that ref.current is readonly\n ref.current = value;\n }\n }\n\n return (\n <ServerContext.Provider value={{ location }}>\n <CurrentRenderContext.Provider value={current}>\n {children}\n </CurrentRenderContext.Provider>\n </ServerContext.Provider>\n );\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ServerContext.tsx"],"names":["React","ServerContext","createContext","undefined"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AASA,MAAMC,aAAa,
|
|
1
|
+
{"version":3,"sources":["ServerContext.tsx"],"names":["React","ServerContext","createContext","undefined"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AASA,MAAMC,aAAa,gBAAGD,KAAK,CAACE,aAAN,CACpBC,SADoB,CAAtB;AAIA,eAAeF,aAAf","sourcesContent":["import * as React from 'react';\n\nexport type ServerContextType = {\n location?: {\n pathname: string;\n search: string;\n };\n};\n\nconst ServerContext = React.createContext<ServerContextType | undefined>(\n undefined\n);\n\nexport default ServerContext;\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import ThemeContext from './ThemeContext';
|
|
3
|
-
export default function ThemeProvider({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export default function ThemeProvider(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
value,
|
|
6
|
+
children
|
|
7
|
+
} = _ref;
|
|
7
8
|
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
|
8
9
|
value: value
|
|
9
10
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ThemeProvider.tsx"],"names":["React","ThemeContext","ThemeProvider","value","children"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAGA,OAAOC,YAAP,MAAyB,gBAAzB;AAOA,eAAe,SAASC,aAAT,
|
|
1
|
+
{"version":3,"sources":["ThemeProvider.tsx"],"names":["React","ThemeContext","ThemeProvider","value","children"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAGA,OAAOC,YAAP,MAAyB,gBAAzB;AAOA,eAAe,SAASC,aAAT,OAAmD;AAAA,MAA5B;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAA4B;AAChE,sBACE,oBAAC,YAAD,CAAc,QAAd;AAAuB,IAAA,KAAK,EAAED;AAA9B,KAAsCC,QAAtC,CADF;AAGD","sourcesContent":["import * as React from 'react';\n\nimport type { Theme } from '../types';\nimport ThemeContext from './ThemeContext';\n\ntype Props = {\n value: Theme;\n children: React.ReactNode;\n};\n\nexport default function ThemeProvider({ value, children }: Props) {\n return (\n <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>\n );\n}\n"]}
|
|
@@ -3,14 +3,15 @@ import * as React from 'react';
|
|
|
3
3
|
/**
|
|
4
4
|
* Set the document title for the active screen
|
|
5
5
|
*/
|
|
6
|
-
export default function useDocumentTitle(ref
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export default function useDocumentTitle(ref) {
|
|
7
|
+
let {
|
|
8
|
+
enabled = true,
|
|
9
|
+
formatter = (options, route) => {
|
|
10
|
+
var _options$title;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = {}
|
|
12
|
+
return (_options$title = options === null || options === void 0 ? void 0 : options.title) !== null && _options$title !== void 0 ? _options$title : route === null || route === void 0 ? void 0 : route.name;
|
|
13
|
+
}
|
|
14
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
14
15
|
React.useEffect(() => {
|
|
15
16
|
if (!enabled) {
|
|
16
17
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDocumentTitle.tsx"],"names":["React","useDocumentTitle","ref","enabled","formatter","options","route","title","name","useEffect","navigation","current","getCurrentOptions","getCurrentRoute","document","addListener","e","data"],"mappings":"AAIA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;;AAIA;AACA;AACA;AACA,eAAe,SAASC,gBAAT,CACbC,GADa,
|
|
1
|
+
{"version":3,"sources":["useDocumentTitle.tsx"],"names":["React","useDocumentTitle","ref","enabled","formatter","options","route","title","name","useEffect","navigation","current","getCurrentOptions","getCurrentRoute","document","addListener","e","data"],"mappings":"AAIA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;;AAIA;AACA;AACA;AACA,eAAe,SAASC,gBAAT,CACbC,GADa,EAMb;AAAA,MAJA;AACEC,IAAAA,OAAO,GAAG,IADZ;AAEEC,IAAAA,SAAS,GAAG,CAACC,OAAD,EAAUC,KAAV;AAAA;;AAAA,+BAAoBD,OAApB,aAAoBA,OAApB,uBAAoBA,OAAO,CAAEE,KAA7B,2DAAsCD,KAAtC,aAAsCA,KAAtC,uBAAsCA,KAAK,CAAEE,IAA7C;AAAA;AAFd,GAIA,uEAD0B,EAC1B;AACAR,EAAAA,KAAK,CAACS,SAAN,CAAgB,MAAM;AACpB,QAAI,CAACN,OAAL,EAAc;AACZ;AACD;;AAED,UAAMO,UAAU,GAAGR,GAAG,CAACS,OAAvB;;AAEA,QAAID,UAAJ,EAAgB;AACd,YAAMH,KAAK,GAAGH,SAAS,CACrBM,UAAU,CAACE,iBAAX,EADqB,EAErBF,UAAU,CAACG,eAAX,EAFqB,CAAvB;AAKAC,MAAAA,QAAQ,CAACP,KAAT,GAAiBA,KAAjB;AACD;;AAED,WAAOG,UAAP,aAAOA,UAAP,uBAAOA,UAAU,CAAEK,WAAZ,CAAwB,SAAxB,EAAoCC,CAAD,IAAO;AAC/C,YAAMT,KAAK,GAAGH,SAAS,CAACY,CAAC,CAACC,IAAF,CAAOZ,OAAR,EAAiBK,UAAjB,aAAiBA,UAAjB,uBAAiBA,UAAU,CAAEG,eAAZ,EAAjB,CAAvB;AAEAC,MAAAA,QAAQ,CAACP,KAAT,GAAiBA,KAAjB;AACD,KAJM,CAAP;AAKD,GArBD;AAsBD","sourcesContent":["import type {\n NavigationContainerRef,\n ParamListBase,\n} from '@react-navigation/core';\nimport * as React from 'react';\n\nimport type { DocumentTitleOptions } from './types';\n\n/**\n * Set the document title for the active screen\n */\nexport default function useDocumentTitle(\n ref: React.RefObject<NavigationContainerRef<ParamListBase>>,\n {\n enabled = true,\n formatter = (options, route) => options?.title ?? route?.name,\n }: DocumentTitleOptions = {}\n) {\n React.useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const navigation = ref.current;\n\n if (navigation) {\n const title = formatter(\n navigation.getCurrentOptions(),\n navigation.getCurrentRoute()\n );\n\n document.title = title;\n }\n\n return navigation?.addListener('options', (e) => {\n const title = formatter(e.data.options, navigation?.getCurrentRoute());\n\n document.title = title;\n });\n });\n}\n"]}
|
|
@@ -30,12 +30,13 @@ const getStateFromParams = params => {
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
export default function useLinkProps({
|
|
34
|
-
to,
|
|
35
|
-
action
|
|
36
|
-
}) {
|
|
33
|
+
export default function useLinkProps(_ref) {
|
|
37
34
|
var _options$getPathFromS;
|
|
38
35
|
|
|
36
|
+
let {
|
|
37
|
+
to,
|
|
38
|
+
action
|
|
39
|
+
} = _ref;
|
|
39
40
|
const root = React.useContext(NavigationContainerRefContext);
|
|
40
41
|
const navigation = React.useContext(NavigationHelpersContext);
|
|
41
42
|
const {
|
|
@@ -52,7 +53,9 @@ export default function useLinkProps({
|
|
|
52
53
|
shouldHandle = e ? !e.defaultPrevented : true;
|
|
53
54
|
} else if (!e.defaultPrevented && // onPress prevented default
|
|
54
55
|
// @ts-expect-error: these properties exist on web, but not in React Native
|
|
55
|
-
!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && (
|
|
56
|
+
!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && ( // ignore clicks with modifier keys
|
|
57
|
+
// @ts-expect-error: these properties exist on web, but not in React Native
|
|
58
|
+
e.button == null || e.button === 0) && // ignore everything but left clicks
|
|
56
59
|
// @ts-expect-error: these properties exist on web, but not in React Native
|
|
57
60
|
[undefined, null, '', 'self'].includes((_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.target) // let browser handle "target=_blank" etc.
|
|
58
61
|
) {
|