expo-router 0.0.30 → 0.0.31
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/build/getRoutes.d.ts.map +1 -1
- package/build/getRoutes.js +7 -7
- package/build/getRoutes.js.map +1 -1
- package/build/views/Directory.js +5 -4
- package/build/views/Directory.js.map +1 -1
- package/build/views/Unmatched.d.ts.map +1 -1
- package/build/views/Unmatched.js +1 -1
- package/build/views/Unmatched.js.map +1 -1
- package/package.json +1 -1
package/build/getRoutes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRoutes.d.ts","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAOpC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,oBAAY,QAAQ,GAAG,IAAI,CACzB,SAAS,EACT,YAAY,GAAG,cAAc,GAAG,WAAW,CAC5C,GAAG;IACF,yBAAyB;IACzB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,aAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,8CAA8C;IAC9C,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,CA+C5D;AAsBD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM;;;SAK3C;AA8GD,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,aAAa,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"getRoutes.d.ts","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAOpC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,oBAAY,QAAQ,GAAG,IAAI,CACzB,SAAS,EACT,YAAY,GAAG,cAAc,GAAG,WAAW,CAC5C,GAAG;IACF,yBAAyB;IACzB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,aAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,8CAA8C;IAC9C,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,CA+C5D;AAsBD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM;;;SAK3C;AA8GD,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,aAAa,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAezE;AAkDD;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,SAAS,GAChB,SAAS,GAAG,IAAI,CAgBlB"}
|
package/build/getRoutes.js
CHANGED
|
@@ -157,15 +157,15 @@ export function getRoutes(contextModule) {
|
|
|
157
157
|
if (!route) {
|
|
158
158
|
return null;
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
appendDirectoryRoute(route);
|
|
162
|
-
}
|
|
160
|
+
appendSitemapRoute(route);
|
|
163
161
|
// Auto add not found route if it doesn't exist
|
|
164
162
|
appendUnmatchedRoute(route);
|
|
165
163
|
return route;
|
|
166
164
|
}
|
|
167
|
-
function
|
|
168
|
-
if (!routes.children.length
|
|
165
|
+
function appendSitemapRoute(routes) {
|
|
166
|
+
if (!routes.children.length ||
|
|
167
|
+
// Allow overriding the sitemap route
|
|
168
|
+
routes.children.some((route) => route.route === "_sitemap")) {
|
|
169
169
|
return routes;
|
|
170
170
|
}
|
|
171
171
|
const { Directory, getNavOptions } = require("./views/Directory");
|
|
@@ -176,8 +176,8 @@ function appendDirectoryRoute(routes) {
|
|
|
176
176
|
getExtras() {
|
|
177
177
|
return { getNavOptions };
|
|
178
178
|
},
|
|
179
|
-
route: "
|
|
180
|
-
contextKey: "./
|
|
179
|
+
route: "_sitemap",
|
|
180
|
+
contextKey: "./_sitemap.tsx",
|
|
181
181
|
generated: true,
|
|
182
182
|
internal: true,
|
|
183
183
|
dynamic: null,
|
package/build/getRoutes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRoutes.js","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAkB/C,oEAAoE;AACpE,MAAM,UAAU,gBAAgB,CAAC,KAAiB;IAChD,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,wCAAwC;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,WAAW,GAAa,IAAI,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAEtB,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,KAAK,SAAS,EAAE;gBAChD,IAAI,WAAW,CAAC,IAAI,EAAE;oBACpB,MAAM,WAA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I,aAAa,EAAE;YACjB,OAAO,KAAK,CAAC;SACd;QACD,kCAAkC;QAClC,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAClC,MAAM,KAAK,GAAG,8BAA8B,CAAC,KAAK,CAAC,CAAC;YACpD,IAAI,KAAK,EAAE;gBACT,OAAO,KAAK,CAAC;aACd;SACF;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { RouteNode } from \"./Route\";\nimport {\n getNameFromFilePath,\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchFragmentName,\n} from \"./matchers\";\nimport { RequireContext } from \"./types\";\nimport { DefaultLayout } from \"./views/Layout\";\n\nexport type FileNode = Pick<\n RouteNode,\n \"contextKey\" | \"getComponent\" | \"getExtras\"\n> & {\n /** Like `(tab)/index` */\n normalizedName: string;\n};\n\ntype TreeNode = {\n name: string;\n children: TreeNode[];\n parents: string[];\n /** null when there is no file in a folder. */\n node: FileNode | null;\n};\n\n/** Convert a flat map of file nodes into a nested tree of files. */\nexport function getRecursiveTree(files: FileNode[]): TreeNode {\n const tree = {\n name: \"\",\n children: [],\n parents: [],\n node: null,\n };\n\n for (const file of files) {\n // ['(tab)', 'settings', '[...another]']\n const parts = file.normalizedName.split(\"/\");\n let currentNode: TreeNode = tree;\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n\n if (i === parts.length - 1 && part === \"_layout\") {\n if (currentNode.node) {\n const overwritten = currentNode.node.contextKey;\n throw new Error(\n `Higher priority Layout Route \"${file.contextKey}\" overriding redundant Layout Route \"${overwritten}\". Remove the Layout Route \"${overwritten}\" to fix this.`\n );\n }\n continue;\n }\n\n const existing = currentNode.children.find((item) => item.name === part);\n if (existing) {\n currentNode = existing;\n } else {\n const newNode: TreeNode = {\n name: part,\n children: [],\n parents: [...currentNode.parents, currentNode.name],\n node: null,\n };\n currentNode.children.push(newNode);\n currentNode = newNode;\n }\n }\n currentNode.node = file;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n assertDeprecatedFormat(tree);\n }\n\n return tree;\n}\n\nfunction assertDeprecatedFormat(tree: TreeNode) {\n for (const child of tree.children) {\n if (\n child.node &&\n child.children.length &&\n !child.node.normalizedName.endsWith(\"_layout\")\n ) {\n const ext = child.node.contextKey.split(\".\").pop();\n throw new Error(\n `Using deprecated Layout Route format: Move \\`./app/${child.node.normalizedName}.${ext}\\` to \\`./app/${child.node.normalizedName}/_layout.${ext}\\``\n );\n }\n assertDeprecatedFormat(child);\n }\n}\n\nfunction getTreeNodesAsRouteNodes(nodes: TreeNode[]): RouteNode[] {\n return nodes.map(treeNodeToRouteNode).flat().filter(Boolean) as RouteNode[];\n}\n\nexport function generateDynamic(name: string) {\n const deepDynamicName = matchDeepDynamicRouteName(name);\n const dynamicName = deepDynamicName ?? matchDynamicName(name);\n\n return dynamicName ? { name: dynamicName, deep: !!deepDynamicName } : null;\n}\n\nfunction treeNodeToRouteNode({\n name,\n node,\n children,\n}: TreeNode): RouteNode[] | null {\n const dynamic = generateDynamic(name);\n\n if (node) {\n return [\n {\n route: name,\n getExtras: node.getExtras,\n getComponent: node.getComponent,\n contextKey: node.contextKey,\n children: getTreeNodesAsRouteNodes(children),\n dynamic,\n },\n ];\n }\n\n // Empty folder, skip it.\n if (!children.length) {\n return null;\n }\n\n // When there's a directory, but no layout route file (with valid export), the child routes won't be grouped.\n // This pushes all children into the nearest layout route.\n return getTreeNodesAsRouteNodes(\n children.map((child) => {\n return {\n ...child,\n name: [name, child.name].filter(Boolean).join(\"/\"),\n };\n })\n );\n}\n\nfunction contextModuleToFileNodes(contextModule: RequireContext): FileNode[] {\n const nodes = contextModule.keys().map((key) => {\n // In development, check if the file exports a default component\n // this helps keep things snappy when creating files. In production we load all screens lazily.\n try {\n if (!contextModule(key)?.default) {\n return null;\n }\n } catch (error) {\n // Probably this won't stop metro from freaking out but it's worth a try.\n console.warn('Error loading route \"' + key + '\"', error);\n return null;\n }\n\n const node: FileNode = {\n normalizedName: getNameFromFilePath(key),\n getComponent() {\n return contextModule(key).default;\n },\n contextKey: key,\n getExtras() {\n const { default: mod, ...extras } = contextModule(key);\n return extras;\n },\n };\n\n return node;\n });\n\n return nodes.filter(Boolean) as FileNode[];\n}\n\nfunction hasCustomRootLayoutNode(routes: RouteNode[]) {\n if (routes.length !== 1) {\n return false;\n }\n // This could either be the root _layout or an app with a single file.\n const route = routes[0];\n\n if (\n route.route === \"\" &&\n route.contextKey.match(/^\\.\\/_layout\\.([jt]sx?)$/)\n ) {\n return true;\n }\n return false;\n}\n\nfunction treeNodesToRootRoute(treeNode: TreeNode): RouteNode | null {\n const routes = treeNodeToRouteNode(treeNode);\n\n if (!routes?.length) {\n return null;\n }\n\n if (hasCustomRootLayoutNode(routes)) {\n return routes[0];\n }\n\n return {\n // Generate a fake file name for the directory\n contextKey: \"./_layout.tsx\",\n route: \"\",\n generated: true,\n dynamic: null,\n getExtras: () => ({}),\n getComponent: () => DefaultLayout,\n children: routes,\n };\n}\n\n/** Given a Metro context module, return an array of nested routes. */\nexport function getRoutes(contextModule: RequireContext): RouteNode | null {\n const files = contextModuleToFileNodes(contextModule);\n const treeNodes = getRecursiveTree(files);\n const route = treeNodesToRootRoute(treeNodes);\n\n if (!route) {\n return null;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n appendDirectoryRoute(route);\n }\n\n // Auto add not found route if it doesn't exist\n appendUnmatchedRoute(route);\n\n return route;\n}\n\nfunction appendDirectoryRoute(routes: RouteNode) {\n if (!routes.children.length) {\n return routes;\n }\n const { Directory, getNavOptions } = require(\"./views/Directory\");\n routes.children.push({\n getComponent() {\n return Directory;\n },\n getExtras() {\n return { getNavOptions };\n },\n route: \"__index\",\n contextKey: \"./__index.tsx\",\n generated: true,\n internal: true,\n dynamic: null,\n children: [],\n });\n return routes;\n}\n\nfunction appendUnmatchedRoute(routes: RouteNode) {\n // Auto add not found route if it doesn't exist\n const userDefinedDynamicRoute = getUserDefinedDeepDynamicRoute(routes);\n if (!userDefinedDynamicRoute) {\n routes.children.push({\n getComponent() {\n return require(\"./views/Unmatched\").Unmatched;\n },\n getExtras() {\n return {};\n },\n route: \"[...404]\",\n contextKey: \"./[...404].tsx\",\n dynamic: { name: \"404\", deep: true },\n children: [],\n generated: true,\n internal: true,\n });\n }\n return routes;\n}\n\n/**\n * Exposed for testing.\n * @returns a top-level deep dynamic route if it exists, otherwise null.\n */\nexport function getUserDefinedDeepDynamicRoute(\n routes: RouteNode\n): RouteNode | null {\n // Auto add not found route if it doesn't exist\n for (const route of routes.children ?? []) {\n const isDeepDynamic = matchDeepDynamicRouteName(route.route);\n if (isDeepDynamic) {\n return route;\n }\n // Recurse through fragment routes\n if (matchFragmentName(route.route)) {\n const child = getUserDefinedDeepDynamicRoute(route);\n if (child) {\n return child;\n }\n }\n }\n return null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"getRoutes.js","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAkB/C,oEAAoE;AACpE,MAAM,UAAU,gBAAgB,CAAC,KAAiB;IAChD,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,wCAAwC;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,WAAW,GAAa,IAAI,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;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AAM,UAAU,8BAA8B,CAC5C,MAAiB;IAEjB,+CAA+C;IAC/C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,QAAQ,IAAI,EAAE,EAAE;QACzC,MAAM,aAAa,GAAG,yBAAyB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7D,IAAI,aAAa,EAAE;YACjB,OAAO,KAAK,CAAC;SACd;QACD,kCAAkC;QAClC,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAClC,MAAM,KAAK,GAAG,8BAA8B,CAAC,KAAK,CAAC,CAAC;YACpD,IAAI,KAAK,EAAE;gBACT,OAAO,KAAK,CAAC;aACd;SACF;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { RouteNode } from \"./Route\";\nimport {\n getNameFromFilePath,\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchFragmentName,\n} from \"./matchers\";\nimport { RequireContext } from \"./types\";\nimport { DefaultLayout } from \"./views/Layout\";\n\nexport type FileNode = Pick<\n RouteNode,\n \"contextKey\" | \"getComponent\" | \"getExtras\"\n> & {\n /** Like `(tab)/index` */\n normalizedName: string;\n};\n\ntype TreeNode = {\n name: string;\n children: TreeNode[];\n parents: string[];\n /** null when there is no file in a folder. */\n node: FileNode | null;\n};\n\n/** Convert a flat map of file nodes into a nested tree of files. */\nexport function getRecursiveTree(files: FileNode[]): TreeNode {\n const tree = {\n name: \"\",\n children: [],\n parents: [],\n node: null,\n };\n\n for (const file of files) {\n // ['(tab)', 'settings', '[...another]']\n const parts = file.normalizedName.split(\"/\");\n let currentNode: TreeNode = tree;\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n\n if (i === parts.length - 1 && part === \"_layout\") {\n if (currentNode.node) {\n const overwritten = currentNode.node.contextKey;\n throw new Error(\n `Higher priority Layout Route \"${file.contextKey}\" overriding redundant Layout Route \"${overwritten}\". Remove the Layout Route \"${overwritten}\" to fix this.`\n );\n }\n continue;\n }\n\n const existing = currentNode.children.find((item) => item.name === part);\n if (existing) {\n currentNode = existing;\n } else {\n const newNode: TreeNode = {\n name: part,\n children: [],\n parents: [...currentNode.parents, currentNode.name],\n node: null,\n };\n currentNode.children.push(newNode);\n currentNode = newNode;\n }\n }\n currentNode.node = file;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n assertDeprecatedFormat(tree);\n }\n\n return tree;\n}\n\nfunction assertDeprecatedFormat(tree: TreeNode) {\n for (const child of tree.children) {\n if (\n child.node &&\n child.children.length &&\n !child.node.normalizedName.endsWith(\"_layout\")\n ) {\n const ext = child.node.contextKey.split(\".\").pop();\n throw new Error(\n `Using deprecated Layout Route format: Move \\`./app/${child.node.normalizedName}.${ext}\\` to \\`./app/${child.node.normalizedName}/_layout.${ext}\\``\n );\n }\n assertDeprecatedFormat(child);\n }\n}\n\nfunction getTreeNodesAsRouteNodes(nodes: TreeNode[]): RouteNode[] {\n return nodes.map(treeNodeToRouteNode).flat().filter(Boolean) as RouteNode[];\n}\n\nexport function generateDynamic(name: string) {\n const deepDynamicName = matchDeepDynamicRouteName(name);\n const dynamicName = deepDynamicName ?? matchDynamicName(name);\n\n return dynamicName ? { name: dynamicName, deep: !!deepDynamicName } : null;\n}\n\nfunction treeNodeToRouteNode({\n name,\n node,\n children,\n}: TreeNode): RouteNode[] | null {\n const dynamic = generateDynamic(name);\n\n if (node) {\n return [\n {\n route: name,\n getExtras: node.getExtras,\n getComponent: node.getComponent,\n contextKey: node.contextKey,\n children: getTreeNodesAsRouteNodes(children),\n dynamic,\n },\n ];\n }\n\n // Empty folder, skip it.\n if (!children.length) {\n return null;\n }\n\n // When there's a directory, but no layout route file (with valid export), the child routes won't be grouped.\n // This pushes all children into the nearest layout route.\n return getTreeNodesAsRouteNodes(\n children.map((child) => {\n return {\n ...child,\n name: [name, child.name].filter(Boolean).join(\"/\"),\n };\n })\n );\n}\n\nfunction contextModuleToFileNodes(contextModule: RequireContext): FileNode[] {\n const nodes = contextModule.keys().map((key) => {\n // In development, check if the file exports a default component\n // this helps keep things snappy when creating files. In production we load all screens lazily.\n try {\n if (!contextModule(key)?.default) {\n return null;\n }\n } catch (error) {\n // Probably this won't stop metro from freaking out but it's worth a try.\n console.warn('Error loading route \"' + key + '\"', error);\n return null;\n }\n\n const node: FileNode = {\n normalizedName: getNameFromFilePath(key),\n getComponent() {\n return contextModule(key).default;\n },\n contextKey: key,\n getExtras() {\n const { default: mod, ...extras } = contextModule(key);\n return extras;\n },\n };\n\n return node;\n });\n\n return nodes.filter(Boolean) as FileNode[];\n}\n\nfunction hasCustomRootLayoutNode(routes: RouteNode[]) {\n if (routes.length !== 1) {\n return false;\n }\n // This could either be the root _layout or an app with a single file.\n const route = routes[0];\n\n if (\n route.route === \"\" &&\n route.contextKey.match(/^\\.\\/_layout\\.([jt]sx?)$/)\n ) {\n return true;\n }\n return false;\n}\n\nfunction treeNodesToRootRoute(treeNode: TreeNode): RouteNode | null {\n const routes = treeNodeToRouteNode(treeNode);\n\n if (!routes?.length) {\n return null;\n }\n\n if (hasCustomRootLayoutNode(routes)) {\n return routes[0];\n }\n\n return {\n // Generate a fake file name for the directory\n contextKey: \"./_layout.tsx\",\n route: \"\",\n generated: true,\n dynamic: null,\n getExtras: () => ({}),\n getComponent: () => DefaultLayout,\n children: routes,\n };\n}\n\n/** Given a Metro context module, return an array of nested routes. */\nexport function getRoutes(contextModule: RequireContext): RouteNode | null {\n const files = contextModuleToFileNodes(contextModule);\n const treeNodes = getRecursiveTree(files);\n const route = treeNodesToRootRoute(treeNodes);\n\n if (!route) {\n return null;\n }\n\n appendSitemapRoute(route);\n\n // Auto add not found route if it doesn't exist\n appendUnmatchedRoute(route);\n\n return route;\n}\n\nfunction appendSitemapRoute(routes: RouteNode) {\n if (\n !routes.children.length ||\n // Allow overriding the sitemap route\n routes.children.some((route) => route.route === \"_sitemap\")\n ) {\n return routes;\n }\n const { Directory, getNavOptions } = require(\"./views/Directory\");\n routes.children.push({\n getComponent() {\n return Directory;\n },\n getExtras() {\n return { getNavOptions };\n },\n route: \"_sitemap\",\n contextKey: \"./_sitemap.tsx\",\n generated: true,\n internal: true,\n dynamic: null,\n children: [],\n });\n return routes;\n}\n\nfunction appendUnmatchedRoute(routes: RouteNode) {\n // Auto add not found route if it doesn't exist\n const userDefinedDynamicRoute = getUserDefinedDeepDynamicRoute(routes);\n if (!userDefinedDynamicRoute) {\n routes.children.push({\n getComponent() {\n return require(\"./views/Unmatched\").Unmatched;\n },\n getExtras() {\n return {};\n },\n route: \"[...404]\",\n contextKey: \"./[...404].tsx\",\n dynamic: { name: \"404\", deep: true },\n children: [],\n generated: true,\n internal: true,\n });\n }\n return routes;\n}\n\n/**\n * Exposed for testing.\n * @returns a top-level deep dynamic route if it exists, otherwise null.\n */\nexport function getUserDefinedDeepDynamicRoute(\n routes: RouteNode\n): RouteNode | null {\n // Auto add not found route if it doesn't exist\n for (const route of routes.children ?? []) {\n const isDeepDynamic = matchDeepDynamicRouteName(route.route);\n if (isDeepDynamic) {\n return route;\n }\n // Recurse through fragment routes\n if (matchFragmentName(route.route)) {\n const child = getUserDefinedDeepDynamicRoute(route);\n if (child) {\n return child;\n }\n }\n }\n return null;\n}\n"]}
|
package/build/views/Directory.js
CHANGED
|
@@ -25,7 +25,7 @@ const styles = StyleSheet.create({
|
|
|
25
25
|
alignItems: "stretch",
|
|
26
26
|
},
|
|
27
27
|
scroll: {
|
|
28
|
-
|
|
28
|
+
paddingHorizontal: 12,
|
|
29
29
|
flex: 1,
|
|
30
30
|
// paddingTop: top + 12,
|
|
31
31
|
alignItems: "stretch",
|
|
@@ -51,7 +51,7 @@ const styles = StyleSheet.create({
|
|
|
51
51
|
});
|
|
52
52
|
export function getNavOptions() {
|
|
53
53
|
return {
|
|
54
|
-
title: "
|
|
54
|
+
title: "sitemap",
|
|
55
55
|
headerShown: true,
|
|
56
56
|
presentation: "modal",
|
|
57
57
|
animation: "default",
|
|
@@ -72,7 +72,7 @@ export function getNavOptions() {
|
|
|
72
72
|
}
|
|
73
73
|
export function Directory() {
|
|
74
74
|
const routes = useSortedRoutes();
|
|
75
|
-
const { bottom } = useSafeAreaInsets();
|
|
75
|
+
const { top, bottom } = useSafeAreaInsets();
|
|
76
76
|
const { width } = useWindowDimensions();
|
|
77
77
|
return (React.createElement(View, { style: styles.container },
|
|
78
78
|
React.createElement(StatusBar, { barStyle: "light-content" }),
|
|
@@ -82,9 +82,10 @@ export function Directory() {
|
|
|
82
82
|
minWidth: Math.min(960, width * 0.9),
|
|
83
83
|
},
|
|
84
84
|
] },
|
|
85
|
-
React.createElement(ScrollView, {
|
|
85
|
+
React.createElement(ScrollView, { contentContainerStyle: [
|
|
86
86
|
styles.scroll,
|
|
87
87
|
{
|
|
88
|
+
paddingTop: top + 12,
|
|
88
89
|
paddingBottom: bottom + 12,
|
|
89
90
|
},
|
|
90
91
|
], style: { flex: 1 } }, routes.map((child) => (React.createElement(View, { key: child.contextKey, style: styles.itemContainer },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Directory.js","sourceRoot":"","sources":["../../src/views/Directory.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAa,UAAU,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE3E,MAAM,MAA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AAC;AACJ,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,MAAM,EAAE,OAAO,CAAC,6BAA6B,CAAC,GAC9C,CACH,CAAC;AACJ,CAAC;AAED,SAAS,OAAO;IACd,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,MAAM,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAC7C,CACH,CAAC;AACJ,CAAC;AAED,SAAS,WAAW;IAClB,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,MAAM,EAAE,OAAO,CAAC,gCAAgC,CAAC,GACjD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { Image, Pressable, StyleSheet, Text, View } from \"@bacons/react-views\";\nimport { useNavigation } from \"@react-navigation/native\";\nimport { NativeStackNavigationOptions } from \"@react-navigation/native-stack\";\nimport React from \"react\";\nimport {\n ScrollView,\n Platform,\n StatusBar,\n useWindowDimensions,\n} from \"react-native\";\nimport { useSafeAreaInsets } from \"react-native-safe-area-context\";\n\nimport { RouteNode, sortRoutes } from \"../Route\";\nimport { useRootRouteNodeContext } from \"../context\";\nimport { Link } from \"../link/Link\";\nimport { matchDeepDynamicRouteName, matchFragmentName } from \"../matchers\";\n\nconst INDENT = 24;\n\nfunction useSortedRoutes() {\n const ctx = useRootRouteNodeContext();\n\n const routes = React.useMemo(\n () => [ctx].filter((route) => !route.internal).sort(sortRoutes),\n [ctx]\n );\n return routes;\n}\n\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: \"black\",\n flex: 1,\n alignItems: \"stretch\",\n },\n main: {\n marginHorizontal: \"auto\",\n flex: 1,\n\n alignItems: \"stretch\",\n },\n scroll: {\n padding: 12,\n flex: 1,\n // paddingTop: top + 12,\n alignItems: \"stretch\",\n },\n itemContainer: {\n borderWidth: 1,\n borderColor: \"#323232\",\n borderRadius: 19,\n marginBottom: 12,\n overflow: \"hidden\",\n },\n itemPressable: {\n paddingHorizontal: INDENT,\n paddingVertical: 16,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n transitionDuration: \"100ms\",\n },\n filename: { color: \"white\", fontSize: 20, marginLeft: 12 },\n virtual: { textAlign: \"right\", color: \"white\" },\n image: { width: 24, height: 24, resizeMode: \"contain\" },\n});\n\nexport function getNavOptions(): NativeStackNavigationOptions {\n return {\n title: \"Index\",\n headerShown: true,\n presentation: \"modal\",\n animation: \"default\",\n headerLargeTitle: true,\n headerTitleStyle: {\n color: \"white\",\n },\n\n headerTintColor: \"white\",\n headerLargeTitleStyle: {\n color: \"white\",\n },\n headerStyle: {\n backgroundColor: \"black\",\n // @ts-expect-error: mistyped\n borderBottomColor: \"#323232\",\n },\n };\n}\n\nexport function Directory() {\n const routes = useSortedRoutes();\n const { bottom } = useSafeAreaInsets();\n const { width } = useWindowDimensions();\n return (\n <View style={styles.container}>\n <StatusBar barStyle=\"light-content\" />\n <View\n style={[\n styles.main,\n {\n minWidth: Math.min(960, width * 0.9),\n },\n ]}\n >\n <ScrollView\n contentInsetAdjustmentBehavior=\"automatic\"\n contentContainerStyle={[\n styles.scroll,\n {\n paddingBottom: bottom + 12,\n },\n ]}\n style={{ flex: 1 }}\n >\n {routes.map((child) => (\n <View key={child.contextKey} style={styles.itemContainer}>\n <FileItem route={child} />\n </View>\n ))}\n </ScrollView>\n </View>\n </View>\n );\n}\n\nfunction FileItem({\n route,\n level = 0,\n parents = [],\n}: {\n route: RouteNode;\n level?: number;\n parents?: string[];\n}) {\n const disabled = route.children.length > 0;\n\n const navigation = useNavigation();\n const href = React.useMemo(() => {\n return (\n \"/\" +\n [...parents, route.route]\n .map((v) => {\n // add an extra layer of entropy to the url for deep dynamic routes\n if (matchDeepDynamicRouteName(v)) {\n return v + \"/\" + Date.now();\n }\n // groups and index must be erased\n return !!matchFragmentName(v) || v === \"index\" ? \"\" : v;\n })\n .filter(Boolean)\n .join(\"/\")\n );\n }, [parents, route.route]);\n\n return (\n <>\n {!route.internal && (\n <Link\n href={href}\n onPress={() => {\n if (Platform.OS !== \"web\") {\n // Ensure the modal pops\n navigation.goBack();\n }\n }}\n // @ts-expect-error: disabled not on type\n disabled={disabled}\n asChild\n >\n <Pressable>\n {({ pressed, hovered }) => (\n <View\n style={[\n styles.itemPressable,\n {\n paddingLeft: INDENT + level * INDENT,\n backgroundColor: hovered\n ? \"rgba(255,255,255,0.1)\"\n : \"transparent\",\n },\n pressed && { backgroundColor: \"#323232\" },\n disabled && { opacity: 0.4 },\n ]}\n >\n <View style={{ flexDirection: \"row\", alignItems: \"center\" }}>\n {route.children.length ? <PkgIcon /> : <FileIcon />}\n <Text style={styles.filename}>{route.contextKey}</Text>\n </View>\n\n {!disabled && <ForwardIcon />}\n {route.generated && <Text style={styles.virtual}>Virtual</Text>}\n </View>\n )}\n </Pressable>\n </Link>\n )}\n {route.children.map((child) => (\n <FileItem\n key={child.contextKey}\n route={child}\n parents={[...parents, route.route]}\n level={level + (route.generated ? 0 : 1)}\n />\n ))}\n </>\n );\n}\n\nfunction FileIcon() {\n return (\n <Image\n style={styles.image}\n source={require(\"expo-router/assets/file.png\")}\n />\n );\n}\n\nfunction PkgIcon() {\n return (\n <Image\n style={styles.image}\n source={require(\"expo-router/assets/pkg.png\")}\n />\n );\n}\n\nfunction ForwardIcon() {\n return (\n <Image\n style={styles.image}\n source={require(\"expo-router/assets/forward.png\")}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Directory.js","sourceRoot":"","sources":["../../src/views/Directory.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,UAAU,EACV,Q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ACP,CACR;QACA,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAC7B,oBAAC,QAAQ,IACP,GAAG,EAAE,KAAK,CAAC,UAAU,EACrB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,EAClC,KAAK,EAAE,KAAK,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACxC,CACH,CAAC,CACD,CACJ,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,MAAM,EAAE,OAAO,CAAC,6BAA6B,CAAC,GAC9C,CACH,CAAC;AACJ,CAAC;AAED,SAAS,OAAO;IACd,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,MAAM,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAC7C,CACH,CAAC;AACJ,CAAC;AAED,SAAS,WAAW;IAClB,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,MAAM,EAAE,OAAO,CAAC,gCAAgC,CAAC,GACjD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { Image, Pressable, StyleSheet, Text, View } from \"@bacons/react-views\";\nimport { useNavigation } from \"@react-navigation/native\";\nimport { NativeStackNavigationOptions } from \"@react-navigation/native-stack\";\nimport React from \"react\";\nimport {\n ScrollView,\n Platform,\n StatusBar,\n useWindowDimensions,\n} from \"react-native\";\nimport { useSafeAreaInsets } from \"react-native-safe-area-context\";\n\nimport { RouteNode, sortRoutes } from \"../Route\";\nimport { useRootRouteNodeContext } from \"../context\";\nimport { Link } from \"../link/Link\";\nimport { matchDeepDynamicRouteName, matchFragmentName } from \"../matchers\";\n\nconst INDENT = 24;\n\nfunction useSortedRoutes() {\n const ctx = useRootRouteNodeContext();\n\n const routes = React.useMemo(\n () => [ctx].filter((route) => !route.internal).sort(sortRoutes),\n [ctx]\n );\n return routes;\n}\n\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: \"black\",\n flex: 1,\n alignItems: \"stretch\",\n },\n main: {\n marginHorizontal: \"auto\",\n flex: 1,\n\n alignItems: \"stretch\",\n },\n scroll: {\n paddingHorizontal: 12,\n flex: 1,\n // paddingTop: top + 12,\n alignItems: \"stretch\",\n },\n itemContainer: {\n borderWidth: 1,\n borderColor: \"#323232\",\n borderRadius: 19,\n marginBottom: 12,\n overflow: \"hidden\",\n },\n itemPressable: {\n paddingHorizontal: INDENT,\n paddingVertical: 16,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n transitionDuration: \"100ms\",\n },\n filename: { color: \"white\", fontSize: 20, marginLeft: 12 },\n virtual: { textAlign: \"right\", color: \"white\" },\n image: { width: 24, height: 24, resizeMode: \"contain\" },\n});\n\nexport function getNavOptions(): NativeStackNavigationOptions {\n return {\n title: \"sitemap\",\n headerShown: true,\n presentation: \"modal\",\n animation: \"default\",\n headerLargeTitle: true,\n headerTitleStyle: {\n color: \"white\",\n },\n\n headerTintColor: \"white\",\n headerLargeTitleStyle: {\n color: \"white\",\n },\n headerStyle: {\n backgroundColor: \"black\",\n // @ts-expect-error: mistyped\n borderBottomColor: \"#323232\",\n },\n };\n}\n\nexport function Directory() {\n const routes = useSortedRoutes();\n const { top, bottom } = useSafeAreaInsets();\n const { width } = useWindowDimensions();\n return (\n <View style={styles.container}>\n <StatusBar barStyle=\"light-content\" />\n <View\n style={[\n styles.main,\n {\n minWidth: Math.min(960, width * 0.9),\n },\n ]}\n >\n <ScrollView\n contentContainerStyle={[\n styles.scroll,\n {\n paddingTop: top + 12,\n paddingBottom: bottom + 12,\n },\n ]}\n style={{ flex: 1 }}\n >\n {routes.map((child) => (\n <View key={child.contextKey} style={styles.itemContainer}>\n <FileItem route={child} />\n </View>\n ))}\n </ScrollView>\n </View>\n </View>\n );\n}\n\nfunction FileItem({\n route,\n level = 0,\n parents = [],\n}: {\n route: RouteNode;\n level?: number;\n parents?: string[];\n}) {\n const disabled = route.children.length > 0;\n\n const navigation = useNavigation();\n const href = React.useMemo(() => {\n return (\n \"/\" +\n [...parents, route.route]\n .map((v) => {\n // add an extra layer of entropy to the url for deep dynamic routes\n if (matchDeepDynamicRouteName(v)) {\n return v + \"/\" + Date.now();\n }\n // groups and index must be erased\n return !!matchFragmentName(v) || v === \"index\" ? \"\" : v;\n })\n .filter(Boolean)\n .join(\"/\")\n );\n }, [parents, route.route]);\n\n return (\n <>\n {!route.internal && (\n <Link\n href={href}\n onPress={() => {\n if (Platform.OS !== \"web\") {\n // Ensure the modal pops\n navigation.goBack();\n }\n }}\n // @ts-expect-error: disabled not on type\n disabled={disabled}\n asChild\n >\n <Pressable>\n {({ pressed, hovered }) => (\n <View\n style={[\n styles.itemPressable,\n {\n paddingLeft: INDENT + level * INDENT,\n backgroundColor: hovered\n ? \"rgba(255,255,255,0.1)\"\n : \"transparent\",\n },\n pressed && { backgroundColor: \"#323232\" },\n disabled && { opacity: 0.4 },\n ]}\n >\n <View style={{ flexDirection: \"row\", alignItems: \"center\" }}>\n {route.children.length ? <PkgIcon /> : <FileIcon />}\n <Text style={styles.filename}>{route.contextKey}</Text>\n </View>\n\n {!disabled && <ForwardIcon />}\n {route.generated && <Text style={styles.virtual}>Virtual</Text>}\n </View>\n )}\n </Pressable>\n </Link>\n )}\n {route.children.map((child) => (\n <FileItem\n key={child.contextKey}\n route={child}\n parents={[...parents, route.route]}\n level={level + (route.generated ? 0 : 1)}\n />\n ))}\n </>\n );\n}\n\nfunction FileIcon() {\n return (\n <Image\n style={styles.image}\n source={require(\"expo-router/assets/file.png\")}\n />\n );\n}\n\nfunction PkgIcon() {\n return (\n <Image\n style={styles.image}\n source={require(\"expo-router/assets/pkg.png\")}\n />\n );\n}\n\nfunction ForwardIcon() {\n return (\n <Image\n style={styles.image}\n source={require(\"expo-router/assets/forward.png\")}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unmatched.d.ts","sourceRoot":"","sources":["../../src/views/Unmatched.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,2CAA2C;AAC3C,eAAO,MAAM,SAAS,+
|
|
1
|
+
{"version":3,"file":"Unmatched.d.ts","sourceRoot":"","sources":["../../src/views/Unmatched.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,2CAA2C;AAC3C,eAAO,MAAM,SAAS,+DAwCpB,CAAC"}
|
package/build/views/Unmatched.js
CHANGED
|
@@ -21,7 +21,7 @@ export const Unmatched = forwardRef((props, ref) => {
|
|
|
21
21
|
" ",
|
|
22
22
|
React.createElement(Link, { href: "/", style: styles.link }, "Go back.")),
|
|
23
23
|
React.createElement(Link, { href: "/", style: styles.link }, url),
|
|
24
|
-
|
|
24
|
+
React.createElement(Link, { href: "/_sitemap", style: [styles.link, { marginTop: 8 }] }, "Sitemap")));
|
|
25
25
|
});
|
|
26
26
|
const styles = StyleSheet.create({
|
|
27
27
|
container: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unmatched.js","sourceRoot":"","sources":["../../src/views/Unmatched.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,2CAA2C;AAC3C,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,KAA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,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,aAAa,EAAE,EAAE;QACjB,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,SAAS;QAC5B,iBAAiB,EAAE,CAAC;QACpB,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,IAAI,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE;CAC9D,CAAC,CAAC","sourcesContent":["import { StyleSheet, Text, View } from \"@bacons/react-views\";\nimport { createURL } from \"expo-linking\";\nimport React, { forwardRef } from \"react\";\n\nimport { Link } from \"../link/Link\";\nimport { useNavigation } from \"../useNavigation\";\n\n/** Default screen for unmatched routes. */\nexport const Unmatched = forwardRef((props, ref) => {\n const navigation = useNavigation();\n const url = createURL(\"\");\n\n React.useLayoutEffect(() => {\n navigation.setOptions({\n title: \"Not Found\",\n });\n }, [navigation]);\n\n return (\n // @ts-ignore\n <View ref={ref} style={styles.container}>\n <Text\n accessibilityRole=\"header\"\n accessibilityLevel={1}\n style={styles.title}\n >\n Unmatched Route\n </Text>\n <Text\n accessibilityRole=\"header\"\n accessibilityLevel={2}\n style={styles.subtitle}\n >\n Page could not be found.{\" \"}\n <Link href=\"/\" style={styles.link}>\n Go back.\n </Link>\n </Text>\n\n <Link href=\"/\" style={styles.link}>\n {url}\n </Link>\n\n <Link href=\"/_sitemap\" style={[styles.link, { marginTop: 8 }]}>\n Sitemap\n </Link>\n </View>\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: \"black\",\n padding: 24,\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n title: {\n color: \"white\",\n fontSize: 36,\n paddingBottom: 12,\n marginBottom: 12,\n borderBottomColor: \"#323232\",\n borderBottomWidth: 1,\n textAlign: \"center\",\n fontWeight: \"bold\",\n },\n subtitle: {\n color: \"white\",\n fontSize: 18,\n marginBottom: 12,\n textAlign: \"center\",\n },\n link: { color: \"rgba(255,255,255,0.4)\", textAlign: \"center\" },\n});\n"]}
|