expo-router 3.1.2 → 3.3.0
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/_ctx.android.js +1 -1
- package/_ctx.ios.js +1 -1
- package/_ctx.web.js +1 -1
- package/babel.js +1 -209
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +57 -15
- package/build/ExpoRoot.js.map +1 -1
- package/build/LocationProvider.d.ts +3 -2
- package/build/LocationProvider.d.ts.map +1 -1
- package/build/LocationProvider.js +31 -7
- package/build/LocationProvider.js.map +1 -1
- package/build/Route.d.ts +3 -0
- package/build/Route.d.ts.map +1 -1
- package/build/Route.js +1 -1
- package/build/Route.js.map +1 -1
- package/build/fork/NavigationContainer.native.js +5 -3
- package/build/fork/NavigationContainer.native.js.map +1 -1
- package/build/fork/extractPathFromURL.d.ts.map +1 -1
- package/build/fork/extractPathFromURL.js +17 -16
- package/build/fork/extractPathFromURL.js.map +1 -1
- package/build/fork/getPathFromState.d.ts +1 -1
- package/build/fork/getPathFromState.d.ts.map +1 -1
- package/build/fork/getPathFromState.js +17 -38
- package/build/fork/getPathFromState.js.map +1 -1
- package/build/fork/getStateFromPath.d.ts +2 -2
- package/build/fork/getStateFromPath.d.ts.map +1 -1
- package/build/fork/getStateFromPath.js +71 -52
- package/build/fork/getStateFromPath.js.map +1 -1
- package/build/getDevServer/index.d.ts +0 -3
- package/build/getDevServer/index.d.ts.map +1 -1
- package/build/getDevServer/index.js +1 -28
- package/build/getDevServer/index.js.map +1 -1
- package/build/getReactNavigationConfig.d.ts.map +1 -1
- package/build/getReactNavigationConfig.js +3 -0
- package/build/getReactNavigationConfig.js.map +1 -1
- package/build/getRoutes.d.ts +8 -5
- package/build/getRoutes.d.ts.map +1 -1
- package/build/getRoutes.js +150 -67
- package/build/getRoutes.js.map +1 -1
- package/build/getServerManifest.d.ts +14 -33
- package/build/getServerManifest.d.ts.map +1 -1
- package/build/getServerManifest.js +6 -5
- package/build/getServerManifest.js.map +1 -1
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js +29 -3
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.d.ts +0 -4
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +76 -96
- package/build/global-state/routing.js.map +1 -1
- package/build/head/ExpoHead.ios.js +4 -4
- package/build/head/ExpoHead.ios.js.map +1 -1
- package/build/head/ExpoHead.js +1 -1
- package/build/head/ExpoHead.js.map +1 -1
- package/build/head/url.d.ts.map +1 -1
- package/build/head/url.js +5 -6
- package/build/head/url.js.map +1 -1
- package/build/hooks.d.ts.map +1 -1
- package/build/hooks.js +24 -5
- package/build/hooks.js.map +1 -1
- package/build/import-mode/index.d.ts +1 -1
- package/build/import-mode/index.d.ts.map +1 -1
- package/build/import-mode/index.js +1 -1
- package/build/import-mode/index.js.map +1 -1
- package/build/layouts/Tabs.js +2 -2
- package/build/layouts/Tabs.js.map +1 -1
- package/build/layouts/withLayoutContext.js +1 -1
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.d.ts +54 -1
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +54 -12
- package/build/link/Link.js.map +1 -1
- package/build/link/useLinkToPathProps.js +2 -2
- package/build/link/useLinkToPathProps.js.map +1 -1
- package/build/loadStaticParamsAsync.d.ts +1 -0
- package/build/loadStaticParamsAsync.d.ts.map +1 -1
- package/build/loadStaticParamsAsync.js +107 -72
- package/build/loadStaticParamsAsync.js.map +1 -1
- package/build/matchers.js +1 -1
- package/build/matchers.js.map +1 -1
- package/build/onboard/Tutorial.js +41 -34
- package/build/onboard/Tutorial.js.map +1 -1
- package/build/qualified-entry.d.ts.map +1 -1
- package/build/qualified-entry.js +10 -7
- package/build/qualified-entry.js.map +1 -1
- package/build/renderRootComponent.d.ts.map +1 -1
- package/build/renderRootComponent.js +28 -4
- package/build/renderRootComponent.js.map +1 -1
- package/build/routes-manifest.d.ts +1 -0
- package/build/routes-manifest.d.ts.map +1 -1
- package/build/routes-manifest.js +1 -0
- package/build/routes-manifest.js.map +1 -1
- package/build/sortRoutes.d.ts.map +1 -1
- package/build/sortRoutes.js +21 -2
- package/build/sortRoutes.js.map +1 -1
- package/build/static/html.d.ts.map +1 -1
- package/build/static/html.js +12 -10
- package/build/static/html.js.map +1 -1
- package/build/static/renderStaticContent.d.ts +13 -3
- package/build/static/renderStaticContent.d.ts.map +1 -1
- package/build/static/renderStaticContent.js +35 -11
- package/build/static/renderStaticContent.js.map +1 -1
- package/build/testing-library/index.js +3 -5
- package/build/testing-library/index.js.map +1 -1
- package/build/testing-library/mocks.d.ts +1 -3
- package/build/testing-library/mocks.d.ts.map +1 -1
- package/build/testing-library/mocks.js +17 -10
- package/build/testing-library/mocks.js.map +1 -1
- package/build/testing-library/require-context-ponyfill.js +3 -3
- package/build/testing-library/require-context-ponyfill.js.map +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +19 -23
- package/build/useScreens.js.map +1 -1
- package/build/utils/url.d.ts +2 -0
- package/build/utils/url.d.ts.map +1 -1
- package/build/utils/url.js +13 -1
- package/build/utils/url.js.map +1 -1
- package/build/views/EmptyRoute.js +5 -2
- package/build/views/EmptyRoute.js.map +1 -1
- package/build/views/ErrorBoundary.js +50 -31
- package/build/views/ErrorBoundary.js.map +1 -1
- package/build/views/Navigator.js +16 -10
- package/build/views/Navigator.js.map +1 -1
- package/build/views/Sitemap.js +54 -36
- package/build/views/Sitemap.js.map +1 -1
- package/build/views/Splash.d.ts +1 -27
- package/build/views/Splash.d.ts.map +1 -1
- package/build/views/Splash.js +2 -112
- package/build/views/Splash.js.map +1 -1
- package/build/views/SuspenseFallback.d.ts +1 -1
- package/build/views/SuspenseFallback.d.ts.map +1 -1
- package/build/views/SuspenseFallback.js +7 -2
- package/build/views/SuspenseFallback.js.map +1 -1
- package/build/views/Toast.js +23 -18
- package/build/views/Toast.js.map +1 -1
- package/build/views/Try.js +1 -1
- package/build/views/Try.js.map +1 -1
- package/build/views/Unmatched.js +29 -17
- package/build/views/Unmatched.js.map +1 -1
- package/html.d.ts +1 -0
- package/ios/ExpoHead.podspec +1 -1
- package/ios/ExpoHeadModule.swift +0 -2
- package/package.json +11 -19
- package/plugin/build/index.d.ts +2 -2
- package/plugin/options.json +3 -3
- package/build/fork/react-native-web-container.d.ts +0 -8
- package/build/fork/react-native-web-container.d.ts.map +0 -1
- package/build/fork/react-native-web-container.js +0 -8
- package/build/fork/react-native-web-container.js.map +0 -1
- package/build/import-mode/index.android.d.ts +0 -3
- package/build/import-mode/index.android.d.ts.map +0 -1
- package/build/import-mode/index.android.js +0 -4
- package/build/import-mode/index.android.js.map +0 -1
- package/build/import-mode/index.ios.d.ts +0 -3
- package/build/import-mode/index.ios.d.ts.map +0 -1
- package/build/import-mode/index.ios.js +0 -4
- package/build/import-mode/index.ios.js.map +0 -1
- package/build/import-mode/index.web.d.ts +0 -3
- package/build/import-mode/index.web.d.ts.map +0 -1
- package/build/import-mode/index.web.js +0 -4
- package/build/import-mode/index.web.js.map +0 -1
- package/build/link/stateOperations.d.ts +0 -81
- package/build/link/stateOperations.d.ts.map +0 -1
- package/build/link/stateOperations.js +0 -105
- package/build/link/stateOperations.js.map +0 -1
- package/types/global.d.ts +0 -38
- package/types/metro-require.d.ts +0 -52
- package/types/react-native-web.d.ts +0 -295
package/build/useScreens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":";;;;;;AAOA,kDAA0B;AAE1B,mCAOiB;AACjB,gEAAoD;AACpD,6CAAsC;AACtC,mDAAgD;AAChD,+DAA4D;AAC5D,qCAAkC;AA2BlC,SAAS,iBAAiB,CACxB,QAAqB,EACrB,KAAqB,EACrB,gBAAyB;IAEzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE;QAClB,OAAO,QAAQ;aACZ,IAAI,CAAC,IAAA,6BAAqB,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OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAChB,uCAAuC;YACvC,MAAM,aAAa,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;YAChF,MAAM,YAAY,GAChB,OAAO,aAAa,KAAK,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;YAC5E,MAAM,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAChF,MAAM,MAAM,GAAG;gBACb,GAAG,YAAY;gBACf,GAAG,aAAa;aACjB,CAAC;YAEF,4DAA4D;YAC5D,IAAI,KAAK,CAAC,SAAS,EAAE;gBACnB,MAAM,CAAC,YAAY,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;gBACjC,qFAAqF;gBACrF,MAAM,CAAC,eAAe,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;aACzD;YAED,OAAO,MAAM,CAAC;QAChB,CAAC,EACD,YAAY,EAAE,GAAG,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC,GACrD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import type {\n EventMapBase,\n NavigationState,\n ParamListBase,\n RouteProp,\n ScreenListeners,\n} from '@react-navigation/native';\nimport React from 'react';\n\nimport {\n DynamicConvention,\n LoadedRoute,\n Route,\n RouteNode,\n sortRoutesWithInitial,\n useRouteNode,\n} from './Route';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { Screen } from './primitives';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport { SuspenseFallback } from './views/SuspenseFallback';\nimport { Try } from './views/Try';\n\nexport type ScreenProps<\n TOptions extends Record<string, any> = Record<string, any>,\n State extends NavigationState = NavigationState,\n EventMap extends EventMapBase = EventMapBase,\n> = {\n /** Name is required when used inside a Layout component. */\n name?: string;\n /**\n * Redirect to the nearest sibling route.\n * If all children are redirect={true}, the layout will render `null` as there are no children to render.\n */\n redirect?: boolean;\n initialParams?: { [key: string]: any };\n options?: TOptions;\n\n listeners?:\n | ScreenListeners<State, EventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n navigation: any;\n }) => ScreenListeners<State, EventMap>);\n\n getId?: ({ params }: { params?: Record<string, any> | undefined }) => string | undefined;\n};\n\nfunction getSortedChildren(\n children: RouteNode[],\n order?: ScreenProps[],\n initialRouteName?: string\n): { route: RouteNode; props: Partial<ScreenProps> }[] {\n if (!order?.length) {\n return children\n .sort(sortRoutesWithInitial(initialRouteName))\n .map((route) => ({ route, props: {} }));\n }\n const entries = [...children];\n\n const ordered = order\n .map(({ name, redirect, initialParams, listeners, options, getId }) => {\n if (!entries.length) {\n console.warn(`[Layout children]: Too many screens defined. Route \"${name}\" is extraneous.`);\n return null;\n }\n const matchIndex = entries.findIndex((child) => child.route === name);\n if (matchIndex === -1) {\n console.warn(\n `[Layout children]: No route named \"${name}\" exists in nested children:`,\n children.map(({ route }) => route)\n );\n return null;\n } else {\n // Get match and remove from entries\n const match = entries[matchIndex];\n entries.splice(matchIndex, 1);\n\n // Ensure to return null after removing from entries.\n if (redirect) {\n if (typeof redirect === 'string') {\n throw new Error(`Redirecting to a specific route is not supported yet.`);\n }\n return null;\n }\n\n return {\n route: match,\n props: { initialParams, listeners, options, getId },\n };\n }\n })\n .filter(Boolean) as {\n route: RouteNode;\n props: Partial<ScreenProps>;\n }[];\n\n // Add any remaining children\n ordered.push(\n ...entries.sort(sortRoutesWithInitial(initialRouteName)).map((route) => ({ route, props: {} }))\n );\n\n return ordered;\n}\n\n/**\n * @returns React Navigation screens sorted by the `route` property.\n */\nexport function useSortedScreens(order: ScreenProps[]): React.ReactNode[] {\n const node = useRouteNode();\n\n const sorted = node?.children?.length\n ? getSortedChildren(node.children, order, node.initialRouteName)\n : [];\n return React.useMemo(\n () => sorted.map((value) => routeToScreen(value.route, value.props)),\n [sorted]\n );\n}\n\nfunction fromImport({ ErrorBoundary, ...component }: LoadedRoute) {\n if (ErrorBoundary) {\n return {\n default: React.forwardRef((props: any, ref: any) => {\n const children = React.createElement(component.default || EmptyRoute, {\n ...props,\n ref,\n });\n return <Try catch={ErrorBoundary}>{children}</Try>;\n }),\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof component.default === 'object' &&\n component.default &&\n Object.keys(component.default).length === 0\n ) {\n return { default: EmptyRoute };\n }\n }\n return { default: component.default || EmptyRoute };\n}\n\nfunction fromLoadedRoute(res: LoadedRoute) {\n if (!(res instanceof Promise)) {\n return fromImport(res);\n }\n\n return res.then(fromImport);\n}\n\n// TODO: Maybe there's a more React-y way to do this?\n// Without this store, the process enters a recursive loop.\nconst qualifiedStore = new WeakMap<RouteNode, React.ComponentType<any>>();\n\n/** Wrap the component with various enhancements and add access to child routes. */\nexport function getQualifiedRouteComponent(value: RouteNode) {\n if (qualifiedStore.has(value)) {\n return qualifiedStore.get(value)!;\n }\n\n let getLoadable: (props: any, ref: any) => JSX.Element;\n\n // TODO: This ensures sync doesn't use React.lazy, but it's not ideal.\n if (EXPO_ROUTER_IMPORT_MODE === 'lazy') {\n const AsyncComponent = React.lazy(async () => {\n const res = value.loadRoute();\n return fromLoadedRoute(res) as Promise<{\n default: React.ComponentType<any>;\n }>;\n });\n getLoadable = (props: any, ref: any) => (\n <React.Suspense fallback={<SuspenseFallback route={value} />}>\n <AsyncComponent\n {...{\n ...props,\n ref,\n // Expose the template segment path, e.g. `(home)`, `[foo]`, `index`\n // the intention is to make it possible to deduce shared routes.\n segment: value.route,\n }}\n />\n </React.Suspense>\n );\n } else {\n const res = value.loadRoute();\n const Component = fromImport(res).default;\n const SyncComponent = React.forwardRef((props, ref) => {\n return <Component {...props} ref={ref} />;\n });\n\n getLoadable = (props: any, ref: any) => (\n <SyncComponent\n {...{\n ...props,\n ref,\n // Expose the template segment path, e.g. `(home)`, `[foo]`, `index`\n // the intention is to make it possible to deduce shared routes.\n segment: value.route,\n }}\n />\n );\n }\n\n const QualifiedRoute = React.forwardRef(\n (\n {\n // Remove these React Navigation props to\n // enforce usage of expo-router hooks (where the query params are correct).\n route,\n navigation,\n\n // Pass all other props to the component\n ...props\n }: any,\n ref: any\n ) => {\n const loadable = getLoadable(props, ref);\n\n return <Route node={value}>{loadable}</Route>;\n }\n );\n\n QualifiedRoute.displayName = `Route(${value.route})`;\n\n qualifiedStore.set(value, QualifiedRoute);\n return QualifiedRoute;\n}\n\n/** @returns a function which provides a screen id that matches the dynamic route name in params. */\nexport function createGetIdForRoute(route: Pick<RouteNode, 'dynamic' | 'route'>) {\n if (!route.dynamic?.length) {\n return undefined;\n }\n return ({ params }: { params?: Record<string, any> }) => {\n const getPreferredId = (segment: DynamicConvention) => {\n // Params can be undefined when there are no params in the route.\n const preferredId = params?.[segment.name];\n // If the route has a dynamic segment, use the matching parameter\n // as the screen id. This enables pushing a screen like `/[user]` multiple times\n // when the user is different.\n if (preferredId) {\n if (!Array.isArray(preferredId)) {\n return preferredId;\n } else if (preferredId.length) {\n // Deep dynamic routes will return as an array, so we'll join them to create a\n // fully qualified string.\n return preferredId.join('/');\n }\n // Empty arrays...\n }\n return segment.deep ? `[...${segment.name}]` : `[${segment.name}]`;\n };\n return route.dynamic?.map((segment) => getPreferredId(segment)).join('/');\n };\n}\n\nfunction routeToScreen(route: RouteNode, { options, ...props }: Partial<ScreenProps> = {}) {\n return (\n <Screen\n // Users can override the screen getId function.\n getId={createGetIdForRoute(route)}\n {...props}\n name={route.route}\n key={route.route}\n options={(args) => {\n // Only eager load generated components\n const staticOptions = route.generated ? route.loadRoute()?.getNavOptions : null;\n const staticResult =\n typeof staticOptions === 'function' ? staticOptions(args) : staticOptions;\n const dynamicResult = typeof options === 'function' ? options?.(args) : options;\n const output = {\n ...staticResult,\n ...dynamicResult,\n };\n\n // Prevent generated screens from showing up in the tab bar.\n if (route.generated) {\n output.tabBarButton = () => null;\n // TODO: React Navigation doesn't provide a way to prevent rendering the drawer item.\n output.drawerItemStyle = { height: 0, display: 'none' };\n }\n\n return output;\n }}\n getComponent={() => getQualifiedRouteComponent(route)}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":";;;;;;AAOA,kDAA0B;AAE1B,mCAOiB;AACjB,gEAAoD;AACpD,6CAAsC;AACtC,mDAAgD;AAChD,+DAA4D;AAC5D,qCAAkC;AA2BlC,SAAS,iBAAiB,CACxB,QAAqB,EACrB,KAAqB,EACrB,gBAAyB;IAEzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE;QAClB,OAAO,QAAQ;aACZ,IAAI,CAAC,IAAA,6BAAqB,EAAC,gBAAgB,CAAC,CAAC;aAC7C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;KAC3C;IACD,MAAM,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;IAE9B,MAAM,OAAO,GAAG,KAAK;SAClB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QACpE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,OAAO,CAAC,IAAI,CAAC,uDAAuD,IAAI,kBAAkB,CAAC,CAAC;YAC5F,OAAO,IAAI,CAAC;SACb;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;QACtE,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;YACrB,OAAO,CAAC,IAAI,CACV,sCAAsC,IAAI,8BAA8B,EACxE,Q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CAAC;aACzD;YAED,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CACF,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,EACtD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import type {\n EventMapBase,\n NavigationState,\n ParamListBase,\n RouteProp,\n ScreenListeners,\n} from '@react-navigation/native';\nimport React from 'react';\n\nimport {\n DynamicConvention,\n LoadedRoute,\n Route,\n RouteNode,\n sortRoutesWithInitial,\n useRouteNode,\n} from './Route';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { Screen } from './primitives';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport { SuspenseFallback } from './views/SuspenseFallback';\nimport { Try } from './views/Try';\n\nexport type ScreenProps<\n TOptions extends Record<string, any> = Record<string, any>,\n State extends NavigationState = NavigationState,\n EventMap extends EventMapBase = EventMapBase,\n> = {\n /** Name is required when used inside a Layout component. */\n name?: string;\n /**\n * Redirect to the nearest sibling route.\n * If all children are redirect={true}, the layout will render `null` as there are no children to render.\n */\n redirect?: boolean;\n initialParams?: { [key: string]: any };\n options?: TOptions;\n\n listeners?:\n | ScreenListeners<State, EventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n navigation: any;\n }) => ScreenListeners<State, EventMap>);\n\n getId?: ({ params }: { params?: Record<string, any> | undefined }) => string | undefined;\n};\n\nfunction getSortedChildren(\n children: RouteNode[],\n order?: ScreenProps[],\n initialRouteName?: string\n): { route: RouteNode; props: Partial<ScreenProps> }[] {\n if (!order?.length) {\n return children\n .sort(sortRoutesWithInitial(initialRouteName))\n .map((route) => ({ route, props: {} }));\n }\n const entries = [...children];\n\n const ordered = order\n .map(({ name, redirect, initialParams, listeners, options, getId }) => {\n if (!entries.length) {\n console.warn(`[Layout children]: Too many screens defined. Route \"${name}\" is extraneous.`);\n return null;\n }\n const matchIndex = entries.findIndex((child) => child.route === name);\n if (matchIndex === -1) {\n console.warn(\n `[Layout children]: No route named \"${name}\" exists in nested children:`,\n children.map(({ route }) => route)\n );\n return null;\n } else {\n // Get match and remove from entries\n const match = entries[matchIndex];\n entries.splice(matchIndex, 1);\n\n // Ensure to return null after removing from entries.\n if (redirect) {\n if (typeof redirect === 'string') {\n throw new Error(`Redirecting to a specific route is not supported yet.`);\n }\n return null;\n }\n\n return {\n route: match,\n props: { initialParams, listeners, options, getId },\n };\n }\n })\n .filter(Boolean) as {\n route: RouteNode;\n props: Partial<ScreenProps>;\n }[];\n\n // Add any remaining children\n ordered.push(\n ...entries.sort(sortRoutesWithInitial(initialRouteName)).map((route) => ({ route, props: {} }))\n );\n\n return ordered;\n}\n\n/**\n * @returns React Navigation screens sorted by the `route` property.\n */\nexport function useSortedScreens(order: ScreenProps[]): React.ReactNode[] {\n const node = useRouteNode();\n\n const sorted = node?.children?.length\n ? getSortedChildren(node.children, order, node.initialRouteName)\n : [];\n return React.useMemo(\n () => sorted.map((value) => routeToScreen(value.route, value.props)),\n [sorted]\n );\n}\n\nfunction fromImport({ ErrorBoundary, ...component }: LoadedRoute) {\n if (ErrorBoundary) {\n return {\n default: React.forwardRef((props: any, ref: any) => {\n const children = React.createElement(component.default || EmptyRoute, {\n ...props,\n ref,\n });\n return <Try catch={ErrorBoundary}>{children}</Try>;\n }),\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof component.default === 'object' &&\n component.default &&\n Object.keys(component.default).length === 0\n ) {\n return { default: EmptyRoute };\n }\n }\n\n return { default: component.default };\n}\n\nfunction fromLoadedRoute(res: LoadedRoute) {\n if (!(res instanceof Promise)) {\n return fromImport(res);\n }\n\n return res.then(fromImport);\n}\n\n// TODO: Maybe there's a more React-y way to do this?\n// Without this store, the process enters a recursive loop.\nconst qualifiedStore = new WeakMap<RouteNode, React.ComponentType<any>>();\n\n/** Wrap the component with various enhancements and add access to child routes. */\nexport function getQualifiedRouteComponent(value: RouteNode) {\n if (qualifiedStore.has(value)) {\n return qualifiedStore.get(value)!;\n }\n\n let ScreenComponent: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;\n\n // TODO: This ensures sync doesn't use React.lazy, but it's not ideal.\n if (EXPO_ROUTER_IMPORT_MODE === 'lazy') {\n ScreenComponent = React.lazy(async () => {\n const res = value.loadRoute();\n return fromLoadedRoute(res) as Promise<{\n default: React.ComponentType<any>;\n }>;\n });\n } else {\n const res = value.loadRoute();\n const Component = fromImport(res).default as React.ComponentType<any>;\n ScreenComponent = React.forwardRef((props, ref) => {\n return <Component {...props} ref={ref} />;\n });\n }\n\n const getLoadable = (props: any, ref: any) => (\n <React.Suspense fallback={<SuspenseFallback route={value} />}>\n <ScreenComponent\n {...{\n ...props,\n ref,\n // Expose the template segment path, e.g. `(home)`, `[foo]`, `index`\n // the intention is to make it possible to deduce shared routes.\n segment: value.route,\n }}\n />\n </React.Suspense>\n );\n\n const QualifiedRoute = React.forwardRef(\n (\n {\n // Remove these React Navigation props to\n // enforce usage of expo-router hooks (where the query params are correct).\n route,\n navigation,\n\n // Pass all other props to the component\n ...props\n }: any,\n ref: any\n ) => {\n const loadable = getLoadable(props, ref);\n\n return <Route node={value}>{loadable}</Route>;\n }\n );\n\n QualifiedRoute.displayName = `Route(${value.route})`;\n\n qualifiedStore.set(value, QualifiedRoute);\n return QualifiedRoute;\n}\n\n/** @returns a function which provides a screen id that matches the dynamic route name in params. */\nexport function createGetIdForRoute(route: Pick<RouteNode, 'dynamic' | 'route'>) {\n if (!route.dynamic?.length) {\n return undefined;\n }\n return ({ params }: { params?: Record<string, any> }) => {\n const getPreferredId = (segment: DynamicConvention) => {\n // Params can be undefined when there are no params in the route.\n const preferredId = params?.[segment.name];\n // If the route has a dynamic segment, use the matching parameter\n // as the screen id. This enables pushing a screen like `/[user]` multiple times\n // when the user is different.\n if (preferredId) {\n if (!Array.isArray(preferredId)) {\n return preferredId;\n } else if (preferredId.length) {\n // Deep dynamic routes will return as an array, so we'll join them to create a\n // fully qualified string.\n return preferredId.join('/');\n }\n // Empty arrays...\n }\n return segment.deep ? `[...${segment.name}]` : `[${segment.name}]`;\n };\n return route.dynamic?.map((segment) => getPreferredId(segment)).join('/');\n };\n}\n\nfunction routeToScreen(route: RouteNode, { options, ...props }: Partial<ScreenProps> = {}) {\n return (\n <Screen\n // Users can override the screen getId function.\n getId={createGetIdForRoute(route)}\n {...props}\n name={route.route}\n key={route.route}\n options={(args) => {\n // Only eager load generated components\n const staticOptions = route.generated ? route.loadRoute()?.getNavOptions : null;\n const staticResult =\n typeof staticOptions === 'function' ? staticOptions(args) : staticOptions;\n const dynamicResult = typeof options === 'function' ? options?.(args) : options;\n const output = {\n ...staticResult,\n ...dynamicResult,\n };\n\n // Prevent generated screens from showing up in the tab bar.\n if (route.generated) {\n output.tabBarButton = () => null;\n // TODO: React Navigation doesn't provide a way to prevent rendering the drawer item.\n output.drawerItemStyle = { height: 0, display: 'none' };\n }\n\n return output;\n }}\n getComponent={() => getQualifiedRouteComponent(route)}\n />\n );\n}\n"]}
|
package/build/utils/url.d.ts
CHANGED
|
@@ -3,4 +3,6 @@
|
|
|
3
3
|
* NOTE: Additional strictness added to ensure URLs sent in query parameters for in-app navigation are not matched.
|
|
4
4
|
*/
|
|
5
5
|
export declare function hasUrlProtocolPrefix(href: string): boolean;
|
|
6
|
+
export declare function isWellKnownUri(href: string): boolean;
|
|
7
|
+
export declare function shouldLinkExternally(href: string): boolean;
|
|
6
8
|
//# sourceMappingURL=url.d.ts.map
|
package/build/utils/url.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D"}
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKpD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG1D"}
|
package/build/utils/url.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasUrlProtocolPrefix = void 0;
|
|
3
|
+
exports.shouldLinkExternally = exports.isWellKnownUri = exports.hasUrlProtocolPrefix = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Does the input string start with a valid URL scheme.
|
|
6
6
|
* NOTE: Additional strictness added to ensure URLs sent in query parameters for in-app navigation are not matched.
|
|
@@ -9,4 +9,16 @@ function hasUrlProtocolPrefix(href) {
|
|
|
9
9
|
return /^[\w\d_+.-]+:\/\//.test(href);
|
|
10
10
|
}
|
|
11
11
|
exports.hasUrlProtocolPrefix = hasUrlProtocolPrefix;
|
|
12
|
+
function isWellKnownUri(href) {
|
|
13
|
+
// This is a hack and we should change this to work like the web in the future where we have full confidence in the
|
|
14
|
+
// ability to match URLs and send anything unmatched to the OS. The main difference between this and `hasUrlProtocolPrefix` is
|
|
15
|
+
// that we don't require `//`, e.g. `mailto:` is valid and common, and `mailto://bacon` is invalid.
|
|
16
|
+
return /^(https?|mailto|tel|sms|geo|maps|market|itmss?|itms-apps|content|file):/.test(href);
|
|
17
|
+
}
|
|
18
|
+
exports.isWellKnownUri = isWellKnownUri;
|
|
19
|
+
function shouldLinkExternally(href) {
|
|
20
|
+
// Cheap check first to avoid regex if the href is not a path fragment.
|
|
21
|
+
return !/^[./]/.test(href) && (hasUrlProtocolPrefix(href) || isWellKnownUri(href));
|
|
22
|
+
}
|
|
23
|
+
exports.shouldLinkExternally = shouldLinkExternally;
|
|
12
24
|
//# sourceMappingURL=url.js.map
|
package/build/utils/url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAFD,oDAEC","sourcesContent":["/**\n * Does the input string start with a valid URL scheme.\n * NOTE: Additional strictness added to ensure URLs sent in query parameters for in-app navigation are not matched.\n */\nexport function hasUrlProtocolPrefix(href: string): boolean {\n return /^[\\w\\d_+.-]+:\\/\\//.test(href);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAFD,oDAEC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,mHAAmH;IACnH,8HAA8H;IAC9H,mGAAmG;IACnG,OAAO,yEAAyE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9F,CAAC;AALD,wCAKC;AAED,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,uEAAuE;IACvE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;AACrF,CAAC;AAHD,oDAGC","sourcesContent":["/**\n * Does the input string start with a valid URL scheme.\n * NOTE: Additional strictness added to ensure URLs sent in query parameters for in-app navigation are not matched.\n */\nexport function hasUrlProtocolPrefix(href: string): boolean {\n return /^[\\w\\d_+.-]+:\\/\\//.test(href);\n}\n\nexport function isWellKnownUri(href: string): boolean {\n // This is a hack and we should change this to work like the web in the future where we have full confidence in the\n // ability to match URLs and send anything unmatched to the OS. The main difference between this and `hasUrlProtocolPrefix` is\n // that we don't require `//`, e.g. `mailto:` is valid and common, and `mailto://bacon` is invalid.\n return /^(https?|mailto|tel|sms|geo|maps|market|itmss?|itms-apps|content|file):/.test(href);\n}\n\nexport function shouldLinkExternally(href: string): boolean {\n // Cheap check first to avoid regex if the href is not a path fragment.\n return !/^[./]/.test(href) && (hasUrlProtocolPrefix(href) || isWellKnownUri(href));\n}\n"]}
|
|
@@ -9,8 +9,11 @@ const Toast_1 = require("./Toast");
|
|
|
9
9
|
const Route_1 = require("../Route");
|
|
10
10
|
function EmptyRoute() {
|
|
11
11
|
const route = (0, Route_1.useRouteNode)();
|
|
12
|
-
return (
|
|
13
|
-
|
|
12
|
+
return (<Toast_1.ToastWrapper>
|
|
13
|
+
<Toast_1.Toast warning filename={route?.contextKey}>
|
|
14
|
+
Missing default export
|
|
15
|
+
</Toast_1.Toast>
|
|
16
|
+
</Toast_1.ToastWrapper>);
|
|
14
17
|
}
|
|
15
18
|
exports.EmptyRoute = EmptyRoute;
|
|
16
19
|
//# sourceMappingURL=EmptyRoute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyRoute.js","sourceRoot":"","sources":["../../src/views/EmptyRoute.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,mCAA8C;AAC9C,oCAAwC;AAExC,SAAgB,UAAU;IACxB,MAAM,KAAK,GAAG,IAAA,oBAAY,GAAE,CAAC;IAE7B,OAAO,CACL,
|
|
1
|
+
{"version":3,"file":"EmptyRoute.js","sourceRoot":"","sources":["../../src/views/EmptyRoute.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,mCAA8C;AAC9C,oCAAwC;AAExC,SAAgB,UAAU;IACxB,MAAM,KAAK,GAAG,IAAA,oBAAY,GAAE,CAAC;IAE7B,OAAO,CACL,CAAC,oBAAY,CACX;MAAA,CAAC,aAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,UAAU,CAAC,CACzC;;MACF,EAAE,aAAK,CACT;IAAA,EAAE,oBAAY,CAAC,CAChB,CAAC;AACJ,CAAC;AAVD,gCAUC","sourcesContent":["import React from 'react';\n\nimport { Toast, ToastWrapper } from './Toast';\nimport { useRouteNode } from '../Route';\n\nexport function EmptyRoute() {\n const route = useRouteNode();\n\n return (\n <ToastWrapper>\n <Toast warning filename={route?.contextKey}>\n Missing default export\n </Toast>\n </ToastWrapper>\n );\n}\n"]}
|
|
@@ -48,50 +48,65 @@ else {
|
|
|
48
48
|
}
|
|
49
49
|
let StackTrace;
|
|
50
50
|
if (process.env.NODE_ENV === 'development') {
|
|
51
|
-
const { LogContext } = require('@expo/metro-runtime/
|
|
52
|
-
const { LogBoxInspectorStackFrames, } = require('@expo/metro-runtime/
|
|
51
|
+
const { LogContext } = require('@expo/metro-runtime/build/error-overlay/Data/LogContext');
|
|
52
|
+
const { LogBoxInspectorStackFrames, } = require('@expo/metro-runtime/build/error-overlay/overlay/LogBoxInspectorStackFrames');
|
|
53
53
|
StackTrace = function ({ logData }) {
|
|
54
54
|
if (!logData?.symbolicated?.stack?.stack) {
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
57
|
-
return (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
return (<react_native_1.ScrollView style={{ flex: 1 }}>
|
|
58
|
+
<LogContext.Provider value={{
|
|
59
|
+
isDisabled: false,
|
|
60
|
+
logs: [logData],
|
|
61
|
+
selectedLogIndex: 0,
|
|
62
|
+
}}>
|
|
63
|
+
<LogBoxInspectorStackFrames onRetry={function () { }} type="stack"/>
|
|
64
|
+
</LogContext.Provider>
|
|
65
|
+
</react_native_1.ScrollView>);
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
else {
|
|
67
69
|
StackTrace = function () {
|
|
68
|
-
return
|
|
70
|
+
return <react_native_1.View style={{ flex: 1 }}/>;
|
|
69
71
|
};
|
|
70
72
|
}
|
|
71
73
|
function ErrorBoundary({ error, retry }) {
|
|
72
74
|
const logBoxLog = useMetroSymbolication(error);
|
|
73
75
|
const inTabBar = react_1.default.useContext(bottom_tabs_1.BottomTabBarHeightContext);
|
|
74
76
|
const Wrapper = inTabBar ? react_native_1.View : react_native_safe_area_context_1.SafeAreaView;
|
|
75
|
-
return (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
77
|
+
return (<react_native_1.View style={styles.container}>
|
|
78
|
+
<Wrapper style={{ flex: 1, gap: 8, maxWidth: 720, marginHorizontal: 'auto' }}>
|
|
79
|
+
<react_native_1.View style={{
|
|
80
|
+
marginBottom: 12,
|
|
81
|
+
gap: 4,
|
|
82
|
+
flexWrap: 'wrap',
|
|
83
|
+
}}>
|
|
84
|
+
<react_native_1.Text role="heading" aria-level={1} style={styles.title}>
|
|
85
|
+
Something went wrong
|
|
86
|
+
</react_native_1.Text>
|
|
87
|
+
<react_native_1.Text role="heading" aria-level={2} style={styles.errorMessage}>
|
|
88
|
+
Error: {error.message}
|
|
89
|
+
</react_native_1.Text>
|
|
90
|
+
</react_native_1.View>
|
|
91
|
+
|
|
92
|
+
<StackTrace logData={logBoxLog}/>
|
|
93
|
+
{process.env.NODE_ENV === 'development' && (<Link_1.Link href="/_sitemap" style={styles.link}>
|
|
94
|
+
Sitemap
|
|
95
|
+
</Link_1.Link>)}
|
|
96
|
+
<Pressable_1.Pressable onPress={retry}>
|
|
97
|
+
{({ hovered, pressed }) => (<react_native_1.View style={[styles.buttonInner, (hovered || pressed) && { backgroundColor: 'white' }]}>
|
|
98
|
+
<react_native_1.Text style={[
|
|
99
|
+
styles.buttonText,
|
|
100
|
+
{
|
|
101
|
+
color: hovered || pressed ? 'black' : 'white',
|
|
102
|
+
},
|
|
103
|
+
]}>
|
|
104
|
+
Retry
|
|
105
|
+
</react_native_1.Text>
|
|
106
|
+
</react_native_1.View>)}
|
|
107
|
+
</Pressable_1.Pressable>
|
|
108
|
+
</Wrapper>
|
|
109
|
+
</react_native_1.View>);
|
|
95
110
|
}
|
|
96
111
|
exports.ErrorBoundary = ErrorBoundary;
|
|
97
112
|
const styles = react_native_1.StyleSheet.create({
|
|
@@ -118,7 +133,11 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
118
133
|
}),
|
|
119
134
|
},
|
|
120
135
|
buttonInner: {
|
|
121
|
-
|
|
136
|
+
...react_native_1.Platform.select({
|
|
137
|
+
web: {
|
|
138
|
+
transitionDuration: '100ms',
|
|
139
|
+
},
|
|
140
|
+
}),
|
|
122
141
|
paddingVertical: 12,
|
|
123
142
|
paddingHorizontal: 24,
|
|
124
143
|
borderColor: 'white',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../src/views/ErrorBoundary.tsx"],"names":[],"mappings":";;;;;;AACA,+DAA0E;AAC1E,kDAA0B;AAC1B,+CAA4E;AAC5E,mFAA8D;AAE9D,2CAAwC;AAExC,uCAAoC;AAEpC,IAAI,qBAAyD,CAAC;AAE9D,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;IAC1C,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAClC,OAAO,CAAC,iCAAiC,CAAqD,CAAC;IACjG,qBAAqB,GAAG,UAAU,KAAY;QAC5C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAmB,IAAI,CAAC,CAAC;QAEzE,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACnB,IAAI,SAAS,GAAG,IAAI,CAAC;YACrB,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAE3C,MAAM,GA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AO;QACpB,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,uBAAQ,CAAC,MAAM,CAAC;YAC1B,OAAO,EAAE,SAAS;YAClB,GAAG,EAAE,aAAa;YAClB,OAAO,EAAE,WAAW;SACrB,CAAC;QACF,UAAU,EAAE,KAAK;KAClB;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;KACb;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;QAChB,uBAAuB;KACxB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,uBAAuB;QAC9B,mBAAmB,EAAE,OAAO;QAC5B,kBAAkB,EAAE,WAAW;QAC/B,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC","sourcesContent":["import type { LogBoxLog } from '@expo/metro-runtime/symbolicate';\nimport { BottomTabBarHeightContext } from '@react-navigation/bottom-tabs';\nimport React from 'react';\nimport { StyleSheet, Text, View, Platform, ScrollView } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Pressable } from './Pressable';\nimport { ErrorBoundaryProps } from './Try';\nimport { Link } from '../link/Link';\n\nlet useMetroSymbolication: (error: Error) => LogBoxLog | null;\n\nif (process.env.NODE_ENV === 'development') {\n const { LogBoxLog, parseErrorStack } =\n require('@expo/metro-runtime/symbolicate') as typeof import('@expo/metro-runtime/symbolicate');\n useMetroSymbolication = function (error: Error) {\n const [logBoxLog, setLogBoxLog] = React.useState<LogBoxLog | null>(null);\n\n React.useEffect(() => {\n let isMounted = true;\n const stack = parseErrorStack(error.stack);\n\n const log = new LogBoxLog({\n level: 'error',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: error.message,\n componentStack: [],\n });\n\n log.symbolicate('stack', (symbolicatedLog) => {\n if (isMounted) {\n setLogBoxLog(log);\n }\n });\n\n return () => {\n isMounted = false;\n };\n }, [error]);\n\n return logBoxLog;\n };\n} else {\n useMetroSymbolication = function () {\n return null;\n };\n}\n\nlet StackTrace: React.FC<{ logData: LogBoxLog | null }>;\n\nif (process.env.NODE_ENV === 'development') {\n const { LogContext } = require('@expo/metro-runtime/src/error-overlay/Data/LogContext');\n const {\n LogBoxInspectorStackFrames,\n } = require('@expo/metro-runtime/src/error-overlay/overlay/LogBoxInspectorStackFrames');\n\n StackTrace = function ({ logData }: { logData: LogBoxLog | null }) {\n if (!logData?.symbolicated?.stack?.stack) {\n return null;\n }\n return (\n <ScrollView style={{ flex: 1 }}>\n <LogContext.Provider\n value={{\n isDisabled: false,\n logs: [logData],\n selectedLogIndex: 0,\n }}>\n <LogBoxInspectorStackFrames onRetry={function () {}} type=\"stack\" />\n </LogContext.Provider>\n </ScrollView>\n );\n };\n} else {\n StackTrace = function () {\n return <View style={{ flex: 1 }} />;\n };\n}\n\nexport function ErrorBoundary({ error, retry }: ErrorBoundaryProps) {\n const logBoxLog = useMetroSymbolication(error);\n const inTabBar = React.useContext(BottomTabBarHeightContext);\n const Wrapper = inTabBar ? View : SafeAreaView;\n\n return (\n <View style={styles.container}>\n <Wrapper style={{ flex: 1, gap: 8, maxWidth: 720, marginHorizontal: 'auto' }}>\n <View\n style={{\n marginBottom: 12,\n gap: 4,\n flexWrap: 'wrap',\n }}>\n <Text role=\"heading\" aria-level={1} style={styles.title}>\n Something went wrong\n </Text>\n <Text role=\"heading\" aria-level={2} style={styles.errorMessage}>\n Error: {error.message}\n </Text>\n </View>\n\n <StackTrace logData={logBoxLog} />\n {process.env.NODE_ENV === 'development' && (\n <Link href=\"/_sitemap\" style={styles.link}>\n Sitemap\n </Link>\n )}\n <Pressable onPress={retry}>\n {({ hovered, pressed }) => (\n <View\n style={[styles.buttonInner, (hovered || pressed) && { backgroundColor: 'white' }]}>\n <Text\n style={[\n styles.buttonText,\n {\n color: hovered || pressed ? 'black' : 'white',\n },\n ]}>\n Retry\n </Text>\n </View>\n )}\n </Pressable>\n </Wrapper>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n padding: 24,\n alignItems: 'stretch',\n justifyContent: 'center',\n },\n title: {\n color: 'white',\n fontSize: Platform.select({ web: 32, default: 24 }),\n fontWeight: 'bold',\n },\n buttonText: {\n fontSize: 18,\n fontWeight: 'bold',\n color: 'black',\n ...Platform.select({\n web: {\n transitionDuration: '100ms',\n },\n }),\n },\n buttonInner: {\n transitionDuration: '100ms',\n paddingVertical: 12,\n paddingHorizontal: 24,\n borderColor: 'white',\n borderWidth: 2,\n marginLeft: 8,\n justifyContent: 'center',\n alignItems: 'center',\n },\n code: {\n fontFamily: Platform.select({\n default: 'Courier',\n ios: 'Courier New',\n android: 'monospace',\n }),\n fontWeight: '500',\n },\n errorMessage: {\n color: 'white',\n fontSize: 16,\n },\n subtitle: {\n color: 'white',\n fontSize: 14,\n marginBottom: 12,\n // textAlign: \"center\",\n },\n link: {\n color: 'rgba(255,255,255,0.4)',\n textDecorationStyle: 'solid',\n textDecorationLine: 'underline',\n fontSize: 14,\n textAlign: 'center',\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../src/views/ErrorBoundary.tsx"],"names":[],"mappings":";;;;;;AACA,+DAA0E;AAC1E,kDAA0B;AAC1B,+CAA4E;AAC5E,mFAA8D;AAE9D,2CAAwC;AAExC,uCAAoC;AAEpC,IAAI,qBAAyD,CAAC;AAE9D,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;IAC1C,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAClC,OAAO,CAAC,iCAAiC,CAAqD,CAAC;IACjG,qBAAqB,GAAG,UAAU,KAAY;QAC5C,MAAM,CAAC,SAAS,EAAE,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Y,EAAE,EAAE;QAChB,uBAAuB;KACxB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,uBAAuB;QAC9B,mBAAmB,EAAE,OAAO;QAC5B,kBAAkB,EAAE,WAAW;QAC/B,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC","sourcesContent":["import type { LogBoxLog } from '@expo/metro-runtime/symbolicate';\nimport { BottomTabBarHeightContext } from '@react-navigation/bottom-tabs';\nimport React from 'react';\nimport { StyleSheet, Text, View, Platform, ScrollView } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Pressable } from './Pressable';\nimport { ErrorBoundaryProps } from './Try';\nimport { Link } from '../link/Link';\n\nlet useMetroSymbolication: (error: Error) => LogBoxLog | null;\n\nif (process.env.NODE_ENV === 'development') {\n const { LogBoxLog, parseErrorStack } =\n require('@expo/metro-runtime/symbolicate') as typeof import('@expo/metro-runtime/symbolicate');\n useMetroSymbolication = function (error: Error) {\n const [logBoxLog, setLogBoxLog] = React.useState<LogBoxLog | null>(null);\n\n React.useEffect(() => {\n let isMounted = true;\n const stack = parseErrorStack(error.stack);\n\n const log = new LogBoxLog({\n level: 'error',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: error.message,\n componentStack: [],\n });\n\n log.symbolicate('stack', (symbolicatedLog) => {\n if (isMounted) {\n setLogBoxLog(log);\n }\n });\n\n return () => {\n isMounted = false;\n };\n }, [error]);\n\n return logBoxLog;\n };\n} else {\n useMetroSymbolication = function () {\n return null;\n };\n}\n\nlet StackTrace: React.FC<{ logData: LogBoxLog | null }>;\n\nif (process.env.NODE_ENV === 'development') {\n const { LogContext } = require('@expo/metro-runtime/build/error-overlay/Data/LogContext');\n const {\n LogBoxInspectorStackFrames,\n } = require('@expo/metro-runtime/build/error-overlay/overlay/LogBoxInspectorStackFrames');\n\n StackTrace = function ({ logData }: { logData: LogBoxLog | null }) {\n if (!logData?.symbolicated?.stack?.stack) {\n return null;\n }\n return (\n <ScrollView style={{ flex: 1 }}>\n <LogContext.Provider\n value={{\n isDisabled: false,\n logs: [logData],\n selectedLogIndex: 0,\n }}>\n <LogBoxInspectorStackFrames onRetry={function () {}} type=\"stack\" />\n </LogContext.Provider>\n </ScrollView>\n );\n };\n} else {\n StackTrace = function () {\n return <View style={{ flex: 1 }} />;\n };\n}\n\nexport function ErrorBoundary({ error, retry }: ErrorBoundaryProps) {\n const logBoxLog = useMetroSymbolication(error);\n const inTabBar = React.useContext(BottomTabBarHeightContext);\n const Wrapper = inTabBar ? View : SafeAreaView;\n\n return (\n <View style={styles.container}>\n <Wrapper style={{ flex: 1, gap: 8, maxWidth: 720, marginHorizontal: 'auto' }}>\n <View\n style={{\n marginBottom: 12,\n gap: 4,\n flexWrap: 'wrap',\n }}>\n <Text role=\"heading\" aria-level={1} style={styles.title}>\n Something went wrong\n </Text>\n <Text role=\"heading\" aria-level={2} style={styles.errorMessage}>\n Error: {error.message}\n </Text>\n </View>\n\n <StackTrace logData={logBoxLog} />\n {process.env.NODE_ENV === 'development' && (\n <Link href=\"/_sitemap\" style={styles.link}>\n Sitemap\n </Link>\n )}\n <Pressable onPress={retry}>\n {({ hovered, pressed }) => (\n <View\n style={[styles.buttonInner, (hovered || pressed) && { backgroundColor: 'white' }]}>\n <Text\n style={[\n styles.buttonText,\n {\n color: hovered || pressed ? 'black' : 'white',\n },\n ]}>\n Retry\n </Text>\n </View>\n )}\n </Pressable>\n </Wrapper>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n padding: 24,\n alignItems: 'stretch',\n justifyContent: 'center',\n },\n title: {\n color: 'white',\n fontSize: Platform.select({ web: 32, default: 24 }),\n fontWeight: 'bold',\n },\n buttonText: {\n fontSize: 18,\n fontWeight: 'bold',\n color: 'black',\n ...Platform.select({\n web: {\n transitionDuration: '100ms',\n },\n }),\n },\n buttonInner: {\n ...Platform.select({\n web: {\n transitionDuration: '100ms',\n },\n }),\n paddingVertical: 12,\n paddingHorizontal: 24,\n borderColor: 'white',\n borderWidth: 2,\n marginLeft: 8,\n justifyContent: 'center',\n alignItems: 'center',\n },\n code: {\n fontFamily: Platform.select({\n default: 'Courier',\n ios: 'Courier New',\n android: 'monospace',\n }),\n fontWeight: '500',\n },\n errorMessage: {\n color: 'white',\n fontSize: 16,\n },\n subtitle: {\n color: 'white',\n fontSize: 14,\n marginBottom: 12,\n // textAlign: \"center\",\n },\n link: {\n color: 'rgba(255,255,255,0.4)',\n textDecorationStyle: 'solid',\n textDecorationLine: 'underline',\n fontSize: 14,\n textAlign: 'center',\n },\n});\n"]}
|
package/build/views/Navigator.js
CHANGED
|
@@ -49,7 +49,9 @@ function Navigator({ initialRouteName, screenOptions, children, router }) {
|
|
|
49
49
|
console.warn(`Navigator at "${contextKey}" has no children.`);
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
|
-
return (
|
|
52
|
+
return (<QualifiedNavigator initialRouteName={initialRouteName} screenOptions={screenOptions} screens={sorted} contextKey={contextKey} router={router}>
|
|
53
|
+
{otherSlot}
|
|
54
|
+
</QualifiedNavigator>);
|
|
53
55
|
}
|
|
54
56
|
exports.Navigator = Navigator;
|
|
55
57
|
function QualifiedNavigator({ initialRouteName, screenOptions, children, screens, contextKey, router = native_1.StackRouter, }) {
|
|
@@ -60,14 +62,15 @@ function QualifiedNavigator({ initialRouteName, screenOptions, children, screens
|
|
|
60
62
|
screenOptions,
|
|
61
63
|
initialRouteName,
|
|
62
64
|
});
|
|
63
|
-
return (
|
|
65
|
+
return (<exports.NavigatorContext.Provider value={{
|
|
64
66
|
contextKey,
|
|
65
67
|
state,
|
|
66
68
|
navigation,
|
|
67
69
|
descriptors,
|
|
68
70
|
router,
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
+
}}>
|
|
72
|
+
<NavigationContent>{children}</NavigationContent>
|
|
73
|
+
</exports.NavigatorContext.Provider>);
|
|
71
74
|
}
|
|
72
75
|
function useNavigatorContext() {
|
|
73
76
|
const context = React.useContext(exports.NavigatorContext);
|
|
@@ -96,10 +99,11 @@ function Slot(props) {
|
|
|
96
99
|
// Ensure the context is for the current contextKey
|
|
97
100
|
if (context?.contextKey !== contextKey) {
|
|
98
101
|
// Qualify the content and re-export.
|
|
99
|
-
return (
|
|
100
|
-
|
|
102
|
+
return (<Navigator {...props}>
|
|
103
|
+
<QualifiedSlot />
|
|
104
|
+
</Navigator>);
|
|
101
105
|
}
|
|
102
|
-
return
|
|
106
|
+
return <QualifiedSlot />;
|
|
103
107
|
}
|
|
104
108
|
exports.Slot = Slot;
|
|
105
109
|
function QualifiedSlot() {
|
|
@@ -107,9 +111,11 @@ function QualifiedSlot() {
|
|
|
107
111
|
}
|
|
108
112
|
exports.QualifiedSlot = QualifiedSlot;
|
|
109
113
|
function DefaultNavigator() {
|
|
110
|
-
return (
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
return (<react_native_safe_area_context_1.SafeAreaView style={{ flex: 1 }}>
|
|
115
|
+
<Navigator>
|
|
116
|
+
<QualifiedSlot />
|
|
117
|
+
</Navigator>
|
|
118
|
+
</react_native_safe_area_context_1.SafeAreaView>);
|
|
113
119
|
}
|
|
114
120
|
exports.DefaultNavigator = DefaultNavigator;
|
|
115
121
|
Navigator.Slot = Slot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/views/Navigator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA4F;AAC5F,6CAA+B;AAC/B,mFAA8D;AAE9D,qCAAkC;AAClC,oCAAyC;AACzC,oEAAuE;AACvE,8CAAiD;AAIjD,qFAAqF;AACxE,QAAA,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAMzC,IAAI,CAAC,CAAC;AAEhB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,wBAAgB,CAAC,WAAW,GAAG,k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,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAC/B;MAAA,CAAC,SAAS,CACR;QAAA,CAAC,aAAa,CAAC,AAAD,EAChB;MAAA,EAAE,SAAS,CACb;IAAA,EAAE,6CAAY,CAAC,CAChB,CAAC;AACJ,CAAC;AARD,4CAQC;AAED,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;AACtB,SAAS,CAAC,UAAU,GAAG,mBAAmB,CAAC;AAE3C,wCAAwC;AACxC,SAAS,CAAC,MAAM,GAAG,eAAM,CAAC","sourcesContent":["import { RouterFactory, StackRouter, useNavigationBuilder } from '@react-navigation/native';\nimport * as React from 'react';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Screen } from './Screen';\nimport { useContextKey } from '../Route';\nimport { useFilterScreenChildren } from '../layouts/withLayoutContext';\nimport { useSortedScreens } from '../useScreens';\n\ntype NavigatorTypes = ReturnType<typeof useNavigationBuilder>;\n\n// TODO: This might already exist upstream, maybe something like `useCurrentRender` ?\nexport const NavigatorContext = React.createContext<{\n contextKey: string;\n state: NavigatorTypes['state'];\n navigation: NavigatorTypes['navigation'];\n descriptors: NavigatorTypes['descriptors'];\n router: RouterFactory<any, any, any>;\n} | null>(null);\n\nif (process.env.NODE_ENV !== 'production') {\n NavigatorContext.displayName = 'NavigatorContext';\n}\n\nexport type NavigatorProps = {\n initialRouteName?: Parameters<typeof useNavigationBuilder>[1]['initialRouteName'];\n screenOptions?: Parameters<typeof useNavigationBuilder>[1]['screenOptions'];\n children?: Parameters<typeof useNavigationBuilder>[1]['children'];\n router?: Parameters<typeof useNavigationBuilder>[0];\n};\n\n/** An unstyled custom navigator. Good for basic web layouts */\nexport function Navigator({ initialRouteName, screenOptions, children, router }: NavigatorProps) {\n const contextKey = useContextKey();\n\n // Allows adding Screen components as children to configure routes.\n const { screens, children: otherSlot } = useFilterScreenChildren(children, {\n isCustomNavigator: true,\n contextKey,\n });\n\n const sorted = useSortedScreens(screens ?? []);\n\n if (!sorted.length) {\n console.warn(`Navigator at \"${contextKey}\" has no children.`);\n return null;\n }\n\n return (\n <QualifiedNavigator\n initialRouteName={initialRouteName}\n screenOptions={screenOptions}\n screens={sorted}\n contextKey={contextKey}\n router={router}>\n {otherSlot}\n </QualifiedNavigator>\n );\n}\n\nfunction QualifiedNavigator({\n initialRouteName,\n screenOptions,\n children,\n screens,\n contextKey,\n router = StackRouter,\n}: NavigatorProps & { contextKey: string; screens: React.ReactNode[] }) {\n const { state, navigation, descriptors, NavigationContent } = useNavigationBuilder(router, {\n // Used for getting the parent with navigation.getParent('/normalized/path')\n id: contextKey,\n children: screens,\n screenOptions,\n initialRouteName,\n });\n\n return (\n <NavigatorContext.Provider\n value={{\n contextKey,\n state,\n navigation,\n descriptors,\n router,\n }}>\n <NavigationContent>{children}</NavigationContent>\n </NavigatorContext.Provider>\n );\n}\n\nexport function useNavigatorContext() {\n const context = React.useContext(NavigatorContext);\n if (!context) {\n throw new Error('useNavigatorContext must be used within a <Navigator />');\n }\n return context;\n}\n\nexport function useSlot() {\n const context = useNavigatorContext();\n\n const { state, descriptors } = context;\n\n const current = state.routes.find((route, i) => {\n return state.index === i;\n });\n\n if (!current) {\n return null;\n }\n\n return descriptors[current.key]?.render() ?? null;\n}\n\n/** Renders the currently selected content. */\nexport function Slot(props: Omit<NavigatorProps, 'children'>) {\n const contextKey = useContextKey();\n const context = React.useContext(NavigatorContext);\n // Ensure the context is for the current contextKey\n if (context?.contextKey !== contextKey) {\n // Qualify the content and re-export.\n return (\n <Navigator {...props}>\n <QualifiedSlot />\n </Navigator>\n );\n }\n\n return <QualifiedSlot />;\n}\n\nexport function QualifiedSlot() {\n return useSlot();\n}\n\nexport function DefaultNavigator() {\n return (\n <SafeAreaView style={{ flex: 1 }}>\n <Navigator>\n <QualifiedSlot />\n </Navigator>\n </SafeAreaView>\n );\n}\n\nNavigator.Slot = Slot;\nNavigator.useContext = useNavigatorContext;\n\n/** Used to configure route settings. */\nNavigator.Screen = Screen;\n"]}
|
package/build/views/Sitemap.js
CHANGED
|
@@ -38,28 +38,34 @@ exports.getNavOptions = getNavOptions;
|
|
|
38
38
|
function Sitemap() {
|
|
39
39
|
const { top, bottom } = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
40
40
|
const { width } = (0, react_native_1.useWindowDimensions)();
|
|
41
|
-
return (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
return (<react_native_1.View style={styles.container}>
|
|
42
|
+
<react_native_1.StatusBar barStyle="light-content"/>
|
|
43
|
+
<react_native_1.View style={[
|
|
44
|
+
styles.main,
|
|
45
|
+
{
|
|
46
|
+
minWidth: Math.min(960, width * 0.9),
|
|
47
|
+
},
|
|
48
|
+
]}>
|
|
49
|
+
<react_native_1.ScrollView contentContainerStyle={[
|
|
50
|
+
styles.scroll,
|
|
51
|
+
{
|
|
52
|
+
paddingTop: top + 12,
|
|
53
|
+
paddingBottom: bottom + 12,
|
|
54
|
+
},
|
|
55
|
+
]} style={{ flex: 1 }}>
|
|
56
|
+
<FileSystemView />
|
|
57
|
+
</react_native_1.ScrollView>
|
|
58
|
+
</react_native_1.View>
|
|
59
|
+
</react_native_1.View>);
|
|
57
60
|
}
|
|
58
61
|
exports.Sitemap = Sitemap;
|
|
59
62
|
function FileSystemView() {
|
|
60
63
|
const routes = (0, router_store_1.useExpoRouter)().getSortedRoutes();
|
|
61
|
-
return (
|
|
62
|
-
|
|
64
|
+
return (<>
|
|
65
|
+
{routes.map((child) => (<react_native_1.View key={child.contextKey} style={styles.itemContainer}>
|
|
66
|
+
<FileItem route={child}/>
|
|
67
|
+
</react_native_1.View>))}
|
|
68
|
+
</>);
|
|
63
69
|
}
|
|
64
70
|
function FileItem({ route, level = 0, parents = [], isInitial = false, }) {
|
|
65
71
|
const disabled = route.children.length > 0;
|
|
@@ -90,16 +96,17 @@ function FileItem({ route, level = 0, parents = [], isInitial = false, }) {
|
|
|
90
96
|
return segments.slice(-segmentCount).join('/');
|
|
91
97
|
}, [route]);
|
|
92
98
|
const info = isInitial ? 'Initial' : route.generated ? 'Virtual' : '';
|
|
93
|
-
return (
|
|
94
|
-
|
|
99
|
+
return (<>
|
|
100
|
+
{!route.internal && (<Link_1.Link accessibilityLabel={route.contextKey} href={href} onPress={() => {
|
|
95
101
|
if (react_native_1.Platform.OS !== 'web' && imperative_api_1.router.canGoBack()) {
|
|
96
102
|
// Ensure the modal pops
|
|
97
103
|
imperative_api_1.router.back();
|
|
98
104
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
}} style={{ flex: 1, display: 'flex' }} disabled={disabled} asChild
|
|
106
|
+
// Ensure we replace the history so you can't go back to this page.
|
|
107
|
+
replace>
|
|
108
|
+
<Pressable_1.Pressable style={{ flex: 1 }}>
|
|
109
|
+
{({ pressed, hovered }) => (<react_native_1.View style={[
|
|
103
110
|
styles.itemPressable,
|
|
104
111
|
{
|
|
105
112
|
paddingLeft: INDENT + level * INDENT,
|
|
@@ -107,23 +114,30 @@ function FileItem({ route, level = 0, parents = [], isInitial = false, }) {
|
|
|
107
114
|
},
|
|
108
115
|
pressed && { backgroundColor: '#323232' },
|
|
109
116
|
disabled && { opacity: 0.4 },
|
|
110
|
-
]
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
]}>
|
|
118
|
+
<react_native_1.View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
119
|
+
{route.children.length ? <PkgIcon /> : <FileIcon />}
|
|
120
|
+
<react_native_1.Text style={styles.filename}>{filename}</react_native_1.Text>
|
|
121
|
+
</react_native_1.View>
|
|
122
|
+
|
|
123
|
+
<react_native_1.View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
124
|
+
{!!info && (<react_native_1.Text style={[styles.virtual, !disabled && { marginRight: 8 }]}>{info}</react_native_1.Text>)}
|
|
125
|
+
{!disabled && <ForwardIcon />}
|
|
126
|
+
</react_native_1.View>
|
|
127
|
+
</react_native_1.View>)}
|
|
128
|
+
</Pressable_1.Pressable>
|
|
129
|
+
</Link_1.Link>)}
|
|
130
|
+
{route.children.map((child) => (<FileItem key={child.contextKey} route={child} isInitial={route.initialRouteName === child.route} parents={segments} level={level + (route.generated ? 0 : 1)}/>))}
|
|
131
|
+
</>);
|
|
118
132
|
}
|
|
119
133
|
function FileIcon() {
|
|
120
|
-
return
|
|
134
|
+
return <react_native_1.Image style={styles.image} source={require('expo-router/assets/file.png')}/>;
|
|
121
135
|
}
|
|
122
136
|
function PkgIcon() {
|
|
123
|
-
return
|
|
137
|
+
return <react_native_1.Image style={styles.image} source={require('expo-router/assets/pkg.png')}/>;
|
|
124
138
|
}
|
|
125
139
|
function ForwardIcon() {
|
|
126
|
-
return
|
|
140
|
+
return <react_native_1.Image style={styles.image} source={require('expo-router/assets/forward.png')}/>;
|
|
127
141
|
}
|
|
128
142
|
const styles = react_native_1.StyleSheet.create({
|
|
129
143
|
container: {
|
|
@@ -155,7 +169,11 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
155
169
|
flexDirection: 'row',
|
|
156
170
|
justifyContent: 'space-between',
|
|
157
171
|
alignItems: 'center',
|
|
158
|
-
|
|
172
|
+
...react_native_1.Platform.select({
|
|
173
|
+
web: {
|
|
174
|
+
transitionDuration: '100ms',
|
|
175
|
+
},
|
|
176
|
+
}),
|
|
159
177
|
},
|
|
160
178
|
filename: { color: 'white', fontSize: 20, marginLeft: 12 },
|
|
161
179
|
virtual: { textAlign: 'right', color: 'white' },
|