expo-router 0.0.13 → 0.0.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutes.d.ts","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,GACpD,SAAS,CAMX;AAqDD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM;;;SAK3C;AAoED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,aAAa,EAAE,cAAc,GAAG,SAAS,EAAE,CAapE;AA+CD;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,SAAS,EAAE,GAClB,SAAS,GAAG,IAAI,CAgBlB"}
1
+ {"version":3,"file":"getRoutes.d.ts","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,GACpD,SAAS,CAMX;AAqDD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM;;;SAK3C;AAwED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,aAAa,EAAE,cAAc,GAAG,SAAS,EAAE,CAapE;AA+CD;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,SAAS,EAAE,GAClB,SAAS,GAAG,IAAI,CAgBlB"}
@@ -78,13 +78,18 @@ function treeNodeToRouteNode({ name, node, parents, children, }) {
78
78
  }
79
79
  function contextModuleToFileNodes(contextModule) {
80
80
  const nodes = contextModule.keys().map((key) => {
81
- // if (process.env.NODE_ENV === "development") {
82
81
  // In development, check if the file exports a default component
83
82
  // this helps keep things snappy when creating files. In production we load all screens lazily.
84
- if (!contextModule(key)?.default) {
83
+ try {
84
+ if (!contextModule(key)?.default) {
85
+ return null;
86
+ }
87
+ }
88
+ catch (error) {
89
+ // Probably this won't stop metro from freaking out but it's worth a try.
90
+ console.warn('Error loading route "' + key + '"', error);
85
91
  return null;
86
92
  }
87
- // }
88
93
  const node = {
89
94
  normalizedName: getNameFromFilePath(key),
90
95
  getComponent() {
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutes.js","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,UAAU,eAAe,CAC7B,KAAqD;IAErD,OAAO;QACL,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,IAAI;QACb,GAAG,KAAK;KACT,CAAC;AACJ,CAAC;AAeD,oEAAoE;AACpE,SAAS,gBAAgB,CAAC,KAAiB;IACzC,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,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI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,OAAO,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC;YAChD,CAAC;YACD,SAAS;gBACP,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,KAAK,EAAE,UAAU;YACjB,UAAU,EAAE,gBAAgB;YAC5B,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;YACpC,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;KACH;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC5C,MAAmB;IAEnB,+CAA+C;IAC/C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,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,QAAQ,CAAC,CAAC;YAC7D,IAAI,KAAK,EAAE;gBACT,OAAO,KAAK,CAAC;aACd;SACF;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import {\n getNameFromFilePath,\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchFragmentName,\n} from \"./matchers\";\nimport { PickPartial, RouteNode } from \"./Route\";\nimport { RequireContext } from \"./types\";\nimport { DefaultLayout } from \"./views/Layout\";\n\nexport function createRouteNode(\n route: PickPartial<RouteNode, \"dynamic\" | \"children\">\n): RouteNode {\n return {\n children: [],\n dynamic: null,\n ...route,\n };\n}\n\ntype FileNode = Pick<RouteNode, \"contextKey\" | \"getComponent\" | \"getExtras\"> & {\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. */\nfunction 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 (const part of parts) {\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 return tree;\n}\n\nfunction getTreeNodesAsRouteNodes(nodes: TreeNode[]): RouteNode[] {\n return nodes.map(treeNodeToRouteNode).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 parents,\n children,\n}: TreeNode): RouteNode | null {\n const dynamic = generateDynamic(name);\n\n if (node) {\n return createRouteNode({\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 // Empty folder, skip it.\n if (!children.length) {\n return null;\n }\n\n // When there's a directory, but no sibling file with the same name, the directory won't work.\n // This ensures that we have a file for every directory (containing valid children).\n return createRouteNode({\n route: name,\n generated: true,\n getExtras: () => ({}),\n getComponent: () => DefaultLayout,\n // Generate a fake file name for the directory\n contextKey: [\".\", ...parents, name + \".tsx\"].filter(Boolean).join(\"/\"),\n children: getTreeNodesAsRouteNodes(children),\n dynamic,\n });\n}\n\nfunction contextModuleToFileNodes(contextModule: RequireContext): FileNode[] {\n const nodes = contextModule.keys().map((key) => {\n // if (process.env.NODE_ENV === \"development\") {\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 if (!contextModule(key)?.default) {\n return null;\n }\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\n/** Given a Metro context module, return an array of nested routes. */\nexport function getRoutes(contextModule: RequireContext): RouteNode[] {\n const files = contextModuleToFileNodes(contextModule);\n const treeNodes = getRecursiveTree(files).children;\n const routes = getTreeNodesAsRouteNodes(treeNodes);\n\n if (process.env.NODE_ENV !== \"production\") {\n appendDirectoryRoute(routes);\n }\n\n // Auto add not found route if it doesn't exist\n appendUnmatchedRoute(routes);\n\n return routes;\n}\n\nfunction appendDirectoryRoute(routes: RouteNode[]) {\n if (!routes.length) {\n return routes;\n }\n const { Directory, getNavOptions } = require(\"./views/Directory\");\n routes.push(\n createRouteNode({\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 })\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.push(\n createRouteNode({\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 generated: true,\n internal: true,\n })\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) {\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.children);\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":"AAAA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,UAAU,eAAe,CAC7B,KAAqD;IAErD,OAAO;QACL,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,IAAI;QACb,GAAG,KAAK;KACT,CAAC;AACJ,CAAC;AAeD,oEAAoE;AACpE,SAAS,gBAAgB,CAAC,KAAiB;IACzC,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,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YACzE,IAAI,QAAQ,EAAE;gBACZ,WAAW,GAAG,QAAQ,CAAC;aACxB;iBAAM;gBACL,MAAM,OAAO,GAAa;oBACxB,IAAI,EAAE,IAAI;oBACV,QAAQ,EAAE,EAAE;oBACZ,OAAO,EAAE,CAAC,GAAG,WAAW,CAA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ACD,KAAK,EAAE,UAAU;YACjB,UAAU,EAAE,gBAAgB;YAC5B,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;YACpC,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;KACH;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC5C,MAAmB;IAEnB,+CAA+C;IAC/C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,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,QAAQ,CAAC,CAAC;YAC7D,IAAI,KAAK,EAAE;gBACT,OAAO,KAAK,CAAC;aACd;SACF;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import {\n getNameFromFilePath,\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchFragmentName,\n} from \"./matchers\";\nimport { PickPartial, RouteNode } from \"./Route\";\nimport { RequireContext } from \"./types\";\nimport { DefaultLayout } from \"./views/Layout\";\n\nexport function createRouteNode(\n route: PickPartial<RouteNode, \"dynamic\" | \"children\">\n): RouteNode {\n return {\n children: [],\n dynamic: null,\n ...route,\n };\n}\n\ntype FileNode = Pick<RouteNode, \"contextKey\" | \"getComponent\" | \"getExtras\"> & {\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. */\nfunction 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 (const part of parts) {\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 return tree;\n}\n\nfunction getTreeNodesAsRouteNodes(nodes: TreeNode[]): RouteNode[] {\n return nodes.map(treeNodeToRouteNode).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 parents,\n children,\n}: TreeNode): RouteNode | null {\n const dynamic = generateDynamic(name);\n\n if (node) {\n return createRouteNode({\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 // Empty folder, skip it.\n if (!children.length) {\n return null;\n }\n\n // When there's a directory, but no sibling file with the same name, the directory won't work.\n // This ensures that we have a file for every directory (containing valid children).\n return createRouteNode({\n route: name,\n generated: true,\n getExtras: () => ({}),\n getComponent: () => DefaultLayout,\n // Generate a fake file name for the directory\n contextKey: [\".\", ...parents, name + \".tsx\"].filter(Boolean).join(\"/\"),\n children: getTreeNodesAsRouteNodes(children),\n dynamic,\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\n/** Given a Metro context module, return an array of nested routes. */\nexport function getRoutes(contextModule: RequireContext): RouteNode[] {\n const files = contextModuleToFileNodes(contextModule);\n const treeNodes = getRecursiveTree(files).children;\n const routes = getTreeNodesAsRouteNodes(treeNodes);\n\n if (process.env.NODE_ENV !== \"production\") {\n appendDirectoryRoute(routes);\n }\n\n // Auto add not found route if it doesn't exist\n appendUnmatchedRoute(routes);\n\n return routes;\n}\n\nfunction appendDirectoryRoute(routes: RouteNode[]) {\n if (!routes.length) {\n return routes;\n }\n const { Directory, getNavOptions } = require(\"./views/Directory\");\n routes.push(\n createRouteNode({\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 })\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.push(\n createRouteNode({\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 generated: true,\n internal: true,\n })\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) {\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.children);\n if (child) {\n return child;\n }\n }\n }\n return null;\n}\n"]}
package/build/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- export { useRoutes } from "./Route";
2
- export { useScreens } from "./useScreens";
3
1
  export { ErrorBoundaryProps } from "./views/Try";
4
2
  export { Stack } from "./layouts/Stack";
5
3
  export { NativeStack } from "./layouts/NativeStack";
@@ -11,7 +9,7 @@ export { Unmatched } from "./views/Unmatched";
11
9
  export { ErrorBoundary } from "./views/ErrorBoundary";
12
10
  export { Layout, Children } from "./views/Layout";
13
11
  export { Link } from "./views/Link";
14
- export { RootContainer, useNavigationContainerContext } from "./ContextNavigationContainer";
15
- export { useCurrentRoute } from "./useCurrentRoute";
16
- export * as Linking from './linking';
12
+ export { useLink } from "./useLink";
13
+ export { RootContainer } from "./ContextNavigationContainer";
14
+ export * as Linking from "./linking";
17
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC"}
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { useRoutes } from "./Route";
2
- export { useScreens } from "./useScreens";
1
+ // export { useRoutes } from "./Route";
2
+ // export { useScreens } from "./useScreens";
3
3
  export { Stack } from "./layouts/Stack";
4
4
  export { NativeStack } from "./layouts/NativeStack";
5
5
  export { Tabs } from "./layouts/Tabs";
@@ -10,8 +10,8 @@ export { Unmatched } from "./views/Unmatched";
10
10
  export { ErrorBoundary } from "./views/ErrorBoundary";
11
11
  export { Layout, Children } from "./views/Layout";
12
12
  export { Link } from "./views/Link";
13
- export { RootContainer, useNavigationContainerContext } from "./ContextNavigationContainer";
14
- export { useCurrentRoute } from "./useCurrentRoute";
15
- import * as Linking_1 from './linking';
13
+ export { useLink } from "./useLink";
14
+ export { RootContainer } from "./ContextNavigationContainer";
15
+ import * as Linking_1 from "./linking";
16
16
  export { Linking_1 as Linking };
17
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;2BAE3B,WAAW;sBAAxB,OAAO","sourcesContent":["export { useRoutes } from \"./Route\";\nexport { useScreens } from \"./useScreens\";\n\nexport { ErrorBoundaryProps } from \"./views/Try\";\n\nexport { Stack } from \"./layouts/Stack\";\nexport { NativeStack } from \"./layouts/NativeStack\";\nexport { Tabs } from \"./layouts/Tabs\";\nexport { Drawer } from \"./layouts/Drawer\";\nexport { withLayoutContext } from \"./layouts/withLayoutContext\";\n\nexport { ExpoRoot } from \"./views/Root\";\nexport { Unmatched } from \"./views/Unmatched\";\nexport { ErrorBoundary } from \"./views/ErrorBoundary\";\n\nexport { Layout, Children } from \"./views/Layout\";\nexport { Link } from \"./views/Link\";\nexport { RootContainer, useNavigationContainerContext } from \"./ContextNavigationContainer\";\nexport { useCurrentRoute } from \"./useCurrentRoute\";\n\nexport * as Linking from './linking'"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,6CAA6C;AAI7C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;2BAGpC,WAAW;sBAAxB,OAAO","sourcesContent":["// export { useRoutes } from \"./Route\";\n// export { useScreens } from \"./useScreens\";\n\nexport { ErrorBoundaryProps } from \"./views/Try\";\n\nexport { Stack } from \"./layouts/Stack\";\nexport { NativeStack } from \"./layouts/NativeStack\";\nexport { Tabs } from \"./layouts/Tabs\";\nexport { Drawer } from \"./layouts/Drawer\";\nexport { withLayoutContext } from \"./layouts/withLayoutContext\";\n\nexport { ExpoRoot } from \"./views/Root\";\nexport { Unmatched } from \"./views/Unmatched\";\nexport { ErrorBoundary } from \"./views/ErrorBoundary\";\n\nexport { Layout, Children } from \"./views/Layout\";\nexport { Link } from \"./views/Link\";\nexport { useLink } from \"./useLink\";\nexport { RootContainer } from \"./ContextNavigationContainer\";\n// export { useCurrentRoute } from \"./useCurrentRoute\";\n\nexport * as Linking from \"./linking\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Tutorial.d.ts","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";AAmCA,wBAAgB,QAAQ,gBAsDvB"}
1
+ {"version":3,"file":"Tutorial.d.ts","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";AAmCA,wBAAgB,QAAQ,gBAyDvB"}
@@ -26,7 +26,8 @@ export function Tutorial() {
26
26
  if (typeof location !== "undefined" && location.pathname !== "/") {
27
27
  location.replace("/");
28
28
  }
29
- if (typeof window !== "undefined" && typeof window.document !== "undefined") {
29
+ if (typeof window !== "undefined" &&
30
+ typeof window.document !== "undefined") {
30
31
  window.document.title = "npx expo start";
31
32
  }
32
33
  }
@@ -45,7 +46,7 @@ export function Tutorial() {
45
46
  marginHorizontal: "auto",
46
47
  alignItems: "stretch",
47
48
  } },
48
- React.createElement(View, { accessibilityRole: "main", style: styles.container },
49
+ React.createElement(View, { style: styles.container },
49
50
  React.createElement(Header, null),
50
51
  React.createElement(Text, { accessibilityRole: "header", accessibilityLevel: 2, style: styles.subtitle },
51
52
  "Get started by creating a file",
@@ -65,15 +66,19 @@ function Button() {
65
66
  ...Platform.select({
66
67
  native: {
67
68
  position: "absolute",
68
- bottom: 8,
69
+ bottom: 24,
69
70
  left: 24,
70
71
  right: 24,
72
+ overflow: "hidden",
71
73
  },
72
74
  }),
73
75
  } }, ({ pressed, hovered }) => (React.createElement(View, { style: [
74
76
  {
75
77
  transitionDuration: "200ms",
76
- backgroundColor: "transparent",
78
+ backgroundColor: Platform.select({
79
+ web: "transparent",
80
+ default: "white",
81
+ }),
77
82
  borderColor: "white",
78
83
  borderWidth: 2,
79
84
  paddingVertical: 12,
@@ -91,7 +96,10 @@ function Button() {
91
96
  fontSize: 18,
92
97
  transitionDuration: "200ms",
93
98
  fontWeight: "bold",
94
- color: "white",
99
+ color: Platform.select({
100
+ web: "white",
101
+ default: "black",
102
+ }),
95
103
  },
96
104
  styles.code,
97
105
  hovered && { color: "black" },
@@ -1 +1 @@
1
- {"version":3,"file":"Tutorial.js","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,sCAAsC;AACtC,SAAS,MAAM;IACX,OAAO,CACH,oBAAC,SAAS,QACL,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACd,oBAAC,IAAI,IACD,iBAAiB,EAAC,QAAQ,EAC1B,kBAAkB,EAAE,CAAC,EACrB,KAAK,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;;QAE1D,GAAG;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ACX,OAAO,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;aAChC;YAED,oBAAC,IAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAU;kCACxC,CACJ,CACV,CACO,CACf,CAAC;AACN,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC7B,SAAS,EAAE;QACP,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,OAAO;QACnB,cAAc,EAAE,QAAQ;KAC3B;IACD,KAAK,EAAE;QACH,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,MAAM;KACrB;IACD,UAAU,EAAE;QACR,KAAK,EAAE,OAAO;KACjB;IACD,IAAI,EAAE;QACF,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC;YACxB,OAAO,EAAE,SAAS;YAClB,GAAG,EAAE,aAAa;YAClB,OAAO,EAAE,WAAW;SACvB,CAAC;KACL;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,OAAO;QACnB,aAAa,EAAE,EAAE;QACjB,QAAQ,EAAE,GAAG;KAChB;CACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { SafeAreaView, StatusBar, Platform } from \"react-native\";\nimport { View, Text, Pressable, StyleSheet } from \"@bacons/react-views\";\nimport { createEntryFileAsync } from \"./createEntryFile\";\n\n// TODO: Use openLinkFromBrowser thing\nfunction Header() {\n return (\n <Pressable>\n {({ hovered }) => (\n <Text\n accessibilityRole=\"header\"\n accessibilityLevel={1}\n style={[styles.title, Platform.OS !== \"web\" && { textAlign: \"left\" }]}\n >\n Welcome to{\" \"}\n <Text\n href=\"https://github.com/expo/expo-router/\"\n style={[\n hovered && {\n textDecorationColor: \"white\",\n textDecorationLine: \"underline\",\n },\n ]}\n >\n Expo\n </Text>\n </Text>\n )}\n </Pressable>\n );\n}\n\nconst canAutoTouchFile = process.env.EXPO_ROUTER_APP_ROOT != null;\n\nexport function Tutorial() {\n React.useEffect(() => {\n if (Platform.OS === \"web\") {\n // Reset the route on web so the initial route isn't a 404 after\n // the user has created the entry file.\n // This is useful for cases where you are testing the tutorial.\n // To test: touch the new file, then navigate to a missing route `/foobar`, then delete the app folder.\n // you should see the tutorial again and be able to create the entry file once more.\n if (typeof location !== \"undefined\" && location.pathname !== \"/\") {\n location.replace(\"/\");\n }\n if (typeof window !== \"undefined\" && typeof window.document !== \"undefined\") {\n window.document.title = \"npx expo start\";\n }\n }\n }, []);\n\n return (\n <View\n style={{\n backgroundColor: \"black\",\n flex: 1,\n backgroundImage:\n \"radial-gradient(circle at 1px 1px, rgba(255,255,255,0.15) 1px, transparent 0)\",\n backgroundPosition: \"-3px -3px\",\n backgroundSize: \"40px 40px\",\n }}\n >\n <StatusBar barStyle=\"light-content\" />\n\n <SafeAreaView\n style={{\n flex: 1,\n maxWidth: 960,\n marginHorizontal: \"auto\",\n alignItems: \"stretch\",\n }}\n >\n <View accessibilityRole=\"main\" style={styles.container}>\n <Header />\n <Text\n accessibilityRole=\"header\"\n accessibilityLevel={2}\n style={styles.subtitle}\n >\n Get started by creating a file{\"\\n\"}in the{\" \"}\n <Text style={{ fontWeight: \"bold\" }}>app</Text> directory{\"\\n\"}that\n exports a React component.\n </Text>\n {canAutoTouchFile && <Button />}\n </View>\n </SafeAreaView>\n </View>\n );\n}\n\nfunction Button() {\n return (\n <Pressable\n onPress={() => {\n createEntryFileAsync();\n }}\n style={{\n ...Platform.select({\n native: {\n position: \"absolute\",\n bottom: 8,\n left: 24,\n right: 24,\n },\n }),\n }}\n >\n {({ pressed, hovered }) => (\n <View\n style={[\n {\n transitionDuration: \"200ms\",\n backgroundColor: \"transparent\",\n borderColor: \"white\",\n borderWidth: 2,\n paddingVertical: 12,\n paddingHorizontal: 24,\n },\n hovered && {\n backgroundColor: \"white\",\n },\n pressed && {\n backgroundColor: \"rgba(255,255,255,0.7)\",\n },\n ]}\n >\n <Text\n selectable={false}\n style={[\n {\n fontSize: 18,\n transitionDuration: \"200ms\",\n fontWeight: \"bold\",\n color: \"white\",\n },\n styles.code,\n hovered && { color: \"black\" },\n ]}\n >\n <Text style={{ color: \"#BCC3CD\" }}>$</Text> touch app/index.js\n </Text>\n </View>\n )}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n padding: 24,\n alignItems: \"start\",\n justifyContent: \"center\",\n },\n title: {\n color: \"white\",\n fontSize: 64,\n paddingBottom: 24,\n fontWeight: \"bold\",\n },\n buttonText: {\n color: \"black\",\n },\n code: {\n fontFamily: Platform.select({\n default: \"Courier\",\n ios: \"Courier New\",\n android: \"monospace\",\n }),\n },\n subtitle: {\n color: \"#BCC3CD\",\n fontSize: 36,\n fontWeight: \"light\",\n paddingBottom: 36,\n maxWidth: 960,\n },\n});\n"]}
1
+ {"version":3,"file":"Tutorial.js","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,sCAAsC;AACtC,SAAS,MAAM;IACb,OAAO,CACL,oBAAC,SAAS,QACP,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAChB,oBAAC,IAAI,IACH,iBAAiB,EAAC,QAAQ,EAC1B,kBAAkB,EAAE,CAAC,EACrB,KAAK,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;;QAE1D,GAA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,UAAU,EAAE,MAAM;oBAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;wBACrB,GAAG,EAAE,OAAO;wBACZ,OAAO,EAAE,OAAO;qBACjB,CAAC;iBACH;gBACD,MAAM,CAAC,IAAI;gBACX,OAAO,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;aAC9B;YAED,oBAAC,IAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAU;kCACtC,CACF,CACR,CACS,CACb,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,OAAO;QACnB,cAAc,EAAE,QAAQ;KACzB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,MAAM;KACnB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,OAAO;KACf;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC;YAC1B,OAAO,EAAE,SAAS;YAClB,GAAG,EAAE,aAAa;YAClB,OAAO,EAAE,WAAW;SACrB,CAAC;KACH;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,OAAO;QACnB,aAAa,EAAE,EAAE;QACjB,QAAQ,EAAE,GAAG;KACd;CACF,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { SafeAreaView, StatusBar, Platform } from \"react-native\";\nimport { View, Text, Pressable, StyleSheet } from \"@bacons/react-views\";\nimport { createEntryFileAsync } from \"./createEntryFile\";\n\n// TODO: Use openLinkFromBrowser thing\nfunction Header() {\n return (\n <Pressable>\n {({ hovered }) => (\n <Text\n accessibilityRole=\"header\"\n accessibilityLevel={1}\n style={[styles.title, Platform.OS !== \"web\" && { textAlign: \"left\" }]}\n >\n Welcome to{\" \"}\n <Text\n href=\"https://github.com/expo/expo-router/\"\n style={[\n hovered && {\n textDecorationColor: \"white\",\n textDecorationLine: \"underline\",\n },\n ]}\n >\n Expo\n </Text>\n </Text>\n )}\n </Pressable>\n );\n}\n\nconst canAutoTouchFile = process.env.EXPO_ROUTER_APP_ROOT != null;\n\nexport function Tutorial() {\n React.useEffect(() => {\n if (Platform.OS === \"web\") {\n // Reset the route on web so the initial route isn't a 404 after\n // the user has created the entry file.\n // This is useful for cases where you are testing the tutorial.\n // To test: touch the new file, then navigate to a missing route `/foobar`, then delete the app folder.\n // you should see the tutorial again and be able to create the entry file once more.\n if (typeof location !== \"undefined\" && location.pathname !== \"/\") {\n location.replace(\"/\");\n }\n if (\n typeof window !== \"undefined\" &&\n typeof window.document !== \"undefined\"\n ) {\n window.document.title = \"npx expo start\";\n }\n }\n }, []);\n\n return (\n <View\n style={{\n backgroundColor: \"black\",\n flex: 1,\n backgroundImage:\n \"radial-gradient(circle at 1px 1px, rgba(255,255,255,0.15) 1px, transparent 0)\",\n backgroundPosition: \"-3px -3px\",\n backgroundSize: \"40px 40px\",\n }}\n >\n <StatusBar barStyle=\"light-content\" />\n\n <SafeAreaView\n style={{\n flex: 1,\n maxWidth: 960,\n marginHorizontal: \"auto\",\n alignItems: \"stretch\",\n }}\n >\n <View style={styles.container}>\n <Header />\n <Text\n accessibilityRole=\"header\"\n accessibilityLevel={2}\n style={styles.subtitle}\n >\n Get started by creating a file{\"\\n\"}in the{\" \"}\n <Text style={{ fontWeight: \"bold\" }}>app</Text> directory{\"\\n\"}that\n exports a React component.\n </Text>\n {canAutoTouchFile && <Button />}\n </View>\n </SafeAreaView>\n </View>\n );\n}\n\nfunction Button() {\n return (\n <Pressable\n onPress={() => {\n createEntryFileAsync();\n }}\n style={{\n ...Platform.select({\n native: {\n position: \"absolute\",\n bottom: 24,\n left: 24,\n right: 24,\n overflow: \"hidden\",\n },\n }),\n }}\n >\n {({ pressed, hovered }) => (\n <View\n style={[\n {\n transitionDuration: \"200ms\",\n backgroundColor: Platform.select({\n web: \"transparent\",\n default: \"white\",\n }),\n\n borderColor: \"white\",\n borderWidth: 2,\n paddingVertical: 12,\n paddingHorizontal: 24,\n },\n hovered && {\n backgroundColor: \"white\",\n },\n pressed && {\n backgroundColor: \"rgba(255,255,255,0.7)\",\n },\n ]}\n >\n <Text\n selectable={false}\n style={[\n {\n fontSize: 18,\n transitionDuration: \"200ms\",\n fontWeight: \"bold\",\n color: Platform.select({\n web: \"white\",\n default: \"black\",\n }),\n },\n styles.code,\n hovered && { color: \"black\" },\n ]}\n >\n <Text style={{ color: \"#BCC3CD\" }}>$</Text> touch app/index.js\n </Text>\n </View>\n )}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n padding: 24,\n alignItems: \"start\",\n justifyContent: \"center\",\n },\n title: {\n color: \"white\",\n fontSize: 64,\n paddingBottom: 24,\n fontWeight: \"bold\",\n },\n buttonText: {\n color: \"black\",\n },\n code: {\n fontFamily: Platform.select({\n default: \"Courier\",\n ios: \"Courier New\",\n android: \"monospace\",\n }),\n },\n subtitle: {\n color: \"#BCC3CD\",\n fontSize: 36,\n fontWeight: \"light\",\n paddingBottom: 36,\n maxWidth: 960,\n },\n});\n"]}
@@ -22,9 +22,7 @@ export default function Page() {
22
22
  <View style={styles.container}>
23
23
  <View style={styles.main}>
24
24
  <Text style={styles.title}>Hello World</Text>
25
- <Text style={styles.subtitle}>
26
- This is the first page of your{"\\n"}native app, and website.
27
- </Text>
25
+ <Text style={styles.subtitle}>This is the first page of your app.</Text>
28
26
  </View>
29
27
  </View>
30
28
  );
@@ -34,6 +32,7 @@ const styles = StyleSheet.create({
34
32
  container: {
35
33
  flex: 1,
36
34
  alignItems: "center",
35
+ padding: 24,
37
36
  },
38
37
  main: {
39
38
  flex: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"createEntryFile.js","sourceRoot":"","sources":["../../src/onboard/createEntryFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,4DAA4D;AAC5D,MAAM,UAAU,oBAAoB;IAClC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,gBAAgB;QAChB,OAAO,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO;KACR;IAED,+CAA+C;IAC/C,OAAO,KAAK,CAAC,YAAY,EAAE,CAAC,GAAG,GAAG,aAAa,EAAE;QAC/C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,QAAQ,EAAE,QAAQ;YAClB,IAAI,EAAE,gBAAgB;SACvB,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAED,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmChB,CAAC","sourcesContent":["import { getDevServer } from \"../getDevServer\";\n\n/** Middleware for creating an entry file in the project. */\nexport function createEntryFileAsync() {\n if (process.env.NODE_ENV === \"production\") {\n // No dev server\n console.warn(\"createEntryFile() cannot be used in production\");\n return;\n }\n\n // Pings middleware in the Expo CLI dev server.\n return fetch(getDevServer().url + \"_expo/touch\", {\n method: \"POST\",\n body: JSON.stringify({\n contents: TEMPLATE,\n path: \"./app/index.js\",\n }),\n });\n}\n\nconst TEMPLATE = `import { StyleSheet, Text, View } from \"react-native\";\n\nexport default function Page() {\n return (\n <View style={styles.container}>\n <View style={styles.main}>\n <Text style={styles.title}>Hello World</Text>\n <Text style={styles.subtitle}>\n This is the first page of your{\"\\\\n\"}native app, and website.\n </Text>\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n alignItems: \"center\",\n },\n main: {\n flex: 1,\n justifyContent: \"center\",\n maxWidth: 960,\n marginHorizontal: \"auto\",\n },\n title: {\n fontSize: 64,\n fontWeight: \"bold\",\n },\n subtitle: {\n fontSize: 36,\n color: \"#38434D\",\n },\n});\n`;\n"]}
1
+ {"version":3,"file":"createEntryFile.js","sourceRoot":"","sources":["../../src/onboard/createEntryFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,4DAA4D;AAC5D,MAAM,UAAU,oBAAoB;IAClC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,gBAAgB;QAChB,OAAO,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO;KACR;IAED,+CAA+C;IAC/C,OAAO,KAAK,CAAC,YAAY,EAAE,CAAC,GAAG,GAAG,aAAa,EAAE;QAC/C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,QAAQ,EAAE,QAAQ;YAClB,IAAI,EAAE,gBAAgB;SACvB,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAED,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkChB,CAAC","sourcesContent":["import { getDevServer } from \"../getDevServer\";\n\n/** Middleware for creating an entry file in the project. */\nexport function createEntryFileAsync() {\n if (process.env.NODE_ENV === \"production\") {\n // No dev server\n console.warn(\"createEntryFile() cannot be used in production\");\n return;\n }\n\n // Pings middleware in the Expo CLI dev server.\n return fetch(getDevServer().url + \"_expo/touch\", {\n method: \"POST\",\n body: JSON.stringify({\n contents: TEMPLATE,\n path: \"./app/index.js\",\n }),\n });\n}\n\nconst TEMPLATE = `import { StyleSheet, Text, View } from \"react-native\";\n\nexport default function Page() {\n return (\n <View style={styles.container}>\n <View style={styles.main}>\n <Text style={styles.title}>Hello World</Text>\n <Text style={styles.subtitle}>This is the first page of your app.</Text>\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n alignItems: \"center\",\n padding: 24,\n },\n main: {\n flex: 1,\n justifyContent: \"center\",\n maxWidth: 960,\n marginHorizontal: \"auto\",\n },\n title: {\n fontSize: 64,\n fontWeight: \"bold\",\n },\n subtitle: {\n fontSize: 36,\n color: \"#38434D\",\n },\n});\n`;\n"]}
@@ -0,0 +1,7 @@
1
+ import { Href, resolveHref } from "./views/Link";
2
+ export declare function useLink(): {
3
+ push: (href: Href) => void;
4
+ back: () => void;
5
+ parse: typeof resolveHref;
6
+ };
7
+ //# sourceMappingURL=useLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLink.d.ts","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,OAAO,IAAI;IACzB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC3B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,OAAO,WAAW,CAAC;CAC3B,CAiBA"}
@@ -0,0 +1,19 @@
1
+ import { useLinkTo, useNavigation } from "@react-navigation/native";
2
+ import { useMemo } from "react";
3
+ import { resolveHref } from "./views/Link";
4
+ // Wraps useLinkTo to provide an API which is similar to the Link component.
5
+ export function useLink() {
6
+ const linkTo = useLinkTo();
7
+ const navigation = useNavigation();
8
+ return useMemo(() => ({
9
+ push: (url) => {
10
+ const href = resolveHref(url);
11
+ linkTo(href);
12
+ },
13
+ back: () => navigation?.goBack(),
14
+ parse: resolveHref,
15
+ // TODO(EvanBacon): add `replace`, `pathname`, `query`, maybe `reload`
16
+ // TODO(EvanBacon): add `canGoBack` but maybe more like a `hasContext`
17
+ }), [navigation, linkTo]);
18
+ }
19
+ //# sourceMappingURL=useLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLink.js","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAQ,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjD,4EAA4E;AAC5E,MAAM,UAAU,OAAO;IAKrB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,IAAI,EAAE,CAAC,GAAS,EAAE,EAAE;YAClB,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC;QACD,IAAI,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE;QAChC,KAAK,EAAE,WAAW;QAClB,sEAAsE;QACtE,sEAAsE;KACvE,CAAC,EACF,CAAC,UAAU,EAAE,MAAM,CAAC,CACrB,CAAC;AACJ,CAAC","sourcesContent":["import { useLinkTo, useNavigation } from \"@react-navigation/native\";\nimport { useMemo } from \"react\";\n\nimport { Href, resolveHref } from \"./views/Link\";\n\n// Wraps useLinkTo to provide an API which is similar to the Link component.\nexport function useLink(): {\n push: (href: Href) => void;\n back: () => void;\n parse: typeof resolveHref;\n} {\n const linkTo = useLinkTo();\n const navigation = useNavigation();\n\n return useMemo(\n () => ({\n push: (url: Href) => {\n const href = resolveHref(url);\n linkTo(href);\n },\n back: () => navigation?.goBack(),\n parse: resolveHref,\n // TODO(EvanBacon): add `replace`, `pathname`, `query`, maybe `reload`\n // TODO(EvanBacon): add `canGoBack` but maybe more like a `hasContext`\n }),\n [navigation, linkTo]\n );\n}\n"]}
@@ -1,16 +1,17 @@
1
- import { RouterFactory, useNavigationBuilder } from '@react-navigation/native';
2
- import * as React from 'react';
1
+ import { RouterFactory, useNavigationBuilder } from "@react-navigation/native";
2
+ import * as React from "react";
3
3
  export declare const LayoutContext: React.Context<{
4
4
  contextKey: string;
5
+ pathname: string;
5
6
  state: any;
6
7
  navigation: any;
7
8
  descriptors: any;
8
9
  router: RouterFactory<any, any, any>;
9
10
  } | null>;
10
11
  export declare type LayoutProps = {
11
- initialRouteName?: Parameters<typeof useNavigationBuilder>[1]['initialRouteName'];
12
- screenOptions?: Parameters<typeof useNavigationBuilder>[1]['screenOptions'];
13
- children?: Parameters<typeof useNavigationBuilder>[1]['children'];
12
+ initialRouteName?: Parameters<typeof useNavigationBuilder>[1]["initialRouteName"];
13
+ screenOptions?: Parameters<typeof useNavigationBuilder>[1]["screenOptions"];
14
+ children?: Parameters<typeof useNavigationBuilder>[1]["children"];
14
15
  router?: Parameters<typeof useNavigationBuilder>[0];
15
16
  };
16
17
  /** An unstyled custom navigator. Good for basic web layouts */
@@ -21,6 +22,7 @@ export declare namespace Layout {
21
22
  }
22
23
  export declare function useLayoutContext(): {
23
24
  contextKey: string;
25
+ pathname: string;
24
26
  state: any;
25
27
  navigation: any;
26
28
  descriptors: any;
@@ -28,7 +30,7 @@ export declare function useLayoutContext(): {
28
30
  };
29
31
  export declare function useChild(): any;
30
32
  /** Renders the currently selected content. */
31
- export declare function Children(props: Omit<LayoutProps, 'children'>): any;
33
+ export declare function Children(props: Omit<LayoutProps, "children">): any;
32
34
  export declare function TrustedChildren(): any;
33
35
  export declare function DefaultLayout(): JSX.Element;
34
36
  //# sourceMappingURL=Layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/views/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,eAAO,MAAM,aAAa;gBAAqC,MAAM;WAAS,GAAG;gBAAc,GAAG;iBAAe,GAAG;YAAU,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;SAAgB,CAAC;AAM3K,oBAAY,WAAW,GAAG;IACtB,gBAAgB,CAAC,EAAE,UAAU,CAAC,OA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C,CAAC,CAAC,eAAe,CAAC,CAAC;IAC5E,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAClE,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;CACrD,CAAC;AAEF,+DAA+D;AAC/D,wBAAgB,MAAM,CAAC,EACrB,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,MAAoB,GACrB,EAAE,WAAW,eA2Bb;yBAhCe,MAAM;;;;AAkCtB,wBAAgB,gBAAgB;;;;;;;EAM/B;AAED,wBAAgB,QAAQ,QAcvB;AAED,8CAA8C;AAC9C,wBAAgB,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,OAc5D;AAED,wBAAgB,eAAe,QAE9B;AAED,wBAAgB,aAAa,gBAM5B"}
@@ -1,7 +1,7 @@
1
- import { StackRouter, useNavigationBuilder } from '@react-navigation/native';
2
- import * as React from 'react';
3
- import { useContextKey } from '../Route';
4
- import { useScreens } from '../useScreens';
1
+ import { StackRouter, useNavigationBuilder, } from "@react-navigation/native";
2
+ import * as React from "react";
3
+ import { useContextKey } from "../Route";
4
+ import { useScreens } from "../useScreens";
5
5
  // TODO: This might already exist upstream, maybe something like `useCurrentRender` ?
6
6
  export const LayoutContext = React.createContext(null);
7
7
  if (process.env.NODE_ENV !== "production") {
@@ -16,7 +16,15 @@ export function Layout({ initialRouteName, screenOptions, children, router = Sta
16
16
  screenOptions,
17
17
  initialRouteName,
18
18
  });
19
- return (React.createElement(LayoutContext.Provider, { value: { contextKey, state, navigation, descriptors, router } },
19
+ const selected = state?.routes[state.index]?.name;
20
+ return (React.createElement(LayoutContext.Provider, { value: {
21
+ pathname: selected ?? "",
22
+ contextKey,
23
+ state,
24
+ navigation,
25
+ descriptors,
26
+ router,
27
+ } },
20
28
  React.createElement(NavigationContent, null, children)));
21
29
  }
22
30
  export function useLayoutContext() {
@@ -53,8 +61,8 @@ export function TrustedChildren() {
53
61
  return useChild();
54
62
  }
55
63
  export function DefaultLayout() {
56
- return React.createElement(Layout, null,
57
- React.createElement(TrustedChildren, null));
64
+ return (React.createElement(Layout, null,
65
+ React.createElement(TrustedChildren, null)));
58
66
  }
59
67
  Layout.Children = Children;
60
68
  Layout.useContext = useLayoutContext;
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../src/views/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,qFAAqF;AACrF,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAqH,IAAI,CAAC,CAAC;AAE3K,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACvC,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC;CAC/C;AASD,+DAA+D;AAC/D,MAAM,UAAU,MAAM,CAAC,EACnB,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,MAAM,GAAG,WAAW,GACV;IACV,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,GACvD,oBAAoB,CAAC,MAAM,EAAE;QACzB,QAAQ,EAAE,OAAO;QACjB,aAAa;QACb,gBAAgB;KACnB,CAAC,CAAC;IAEP,OAAO,CACH,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,E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,oBAAC,eAAe,OAAG,CAAS,CAAC;AAChD,CAAC;AAED,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,MAAM,CAAC,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["import { RouterFactory, StackRouter, useNavigationBuilder } from '@react-navigation/native';\nimport * as React from 'react';\n\nimport { useContextKey } from '../Route';\nimport { useScreens } from '../useScreens';\n\n// TODO: This might already exist upstream, maybe something like `useCurrentRender` ?\nexport const LayoutContext = React.createContext<{ contextKey: string; state: any; navigation: any; descriptors: any; router: RouterFactory<any, any, any> } | null>(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n LayoutContext.displayName = \"LayoutContext\";\n}\n\nexport type LayoutProps = {\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 Layout({\n initialRouteName,\n screenOptions,\n children,\n router = StackRouter,\n}: LayoutProps) {\n const contextKey = useContextKey()\n const screens = useScreens();\n\n const { state, navigation, descriptors, NavigationContent } =\n useNavigationBuilder(router, {\n children: screens,\n screenOptions,\n initialRouteName,\n });\n\n return (\n <LayoutContext.Provider value={{ contextKey, state, navigation, descriptors, router }}>\n <NavigationContent>{children}</NavigationContent>\n </LayoutContext.Provider>\n );\n}\n\nexport function useLayoutContext() {\n const context = React.useContext(LayoutContext);\n if (!context) {\n throw new Error(\n \"useLayoutContext must be used within a <Layout />\"\n );\n }\n return context;\n}\n\nexport function useChild() {\n const context = useLayoutContext();\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 Children(props: Omit<LayoutProps, 'children'>) {\n const contextKey = useContextKey()\n const context = React.useContext(LayoutContext);\n // Ensure the context is for the current contextKey\n if (context?.contextKey !== contextKey) {\n // Qualify the content and re-export.\n return (\n <Layout {...props}>\n <TrustedChildren />\n </Layout>\n );\n }\n\n return useChild();\n}\n\nexport function TrustedChildren() {\n return useChild();\n}\n\nexport function DefaultLayout() {\n return <Layout><TrustedChildren /></Layout>;\n}\n\nLayout.Children = Children;\nLayout.useContext = useLayoutContext;\n"]}
1
+ {"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../src/views/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,qFAAqF;AACrF,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAOtC,IAAI,CAAC,CAAC;AAEhB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC;CAC7C;AAWD,+DAA+D;AAC/D,MAAM,UAAU,MAAM,CAAC,EACrB,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,MAAM,GAAG,WAAW,GACR;IACZ,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,GACzD,oBAAoB,CAAC,MAAM,EAAE;QAC3B,QAAQ,EAAE,OAAO;QACjB,aAAa;QACb,gBAAgB;KACjB,CAAC,CAAC;IAEL,MAAM,QAAQ,GAAG,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;IAElD,OAAO,CACL,oBAA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CAAC;AACpB,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,QAAQ,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,CACL,oBAAC,MAAM;QACL,oBAAC,eAAe,OAAG,CACZ,CACV,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,MAAM,CAAC,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["import {\n RouterFactory,\n StackRouter,\n useNavigationBuilder,\n} from \"@react-navigation/native\";\nimport * as React from \"react\";\n\nimport { useContextKey } from \"../Route\";\nimport { useScreens } from \"../useScreens\";\n\n// TODO: This might already exist upstream, maybe something like `useCurrentRender` ?\nexport const LayoutContext = React.createContext<{\n contextKey: string;\n pathname: string;\n state: any;\n navigation: any;\n descriptors: any;\n router: RouterFactory<any, any, any>;\n} | null>(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n LayoutContext.displayName = \"LayoutContext\";\n}\n\nexport type LayoutProps = {\n initialRouteName?: Parameters<\n typeof useNavigationBuilder\n >[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 Layout({\n initialRouteName,\n screenOptions,\n children,\n router = StackRouter,\n}: LayoutProps) {\n const contextKey = useContextKey();\n const screens = useScreens();\n\n const { state, navigation, descriptors, NavigationContent } =\n useNavigationBuilder(router, {\n children: screens,\n screenOptions,\n initialRouteName,\n });\n\n const selected = state?.routes[state.index]?.name;\n\n return (\n <LayoutContext.Provider\n value={{\n pathname: selected ?? \"\",\n contextKey,\n state,\n navigation,\n descriptors,\n router,\n }}\n >\n <NavigationContent>{children}</NavigationContent>\n </LayoutContext.Provider>\n );\n}\n\nexport function useLayoutContext() {\n const context = React.useContext(LayoutContext);\n if (!context) {\n throw new Error(\"useLayoutContext must be used within a <Layout />\");\n }\n return context;\n}\n\nexport function useChild() {\n const context = useLayoutContext();\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 Children(props: Omit<LayoutProps, \"children\">) {\n const contextKey = useContextKey();\n const context = React.useContext(LayoutContext);\n // Ensure the context is for the current contextKey\n if (context?.contextKey !== contextKey) {\n // Qualify the content and re-export.\n return (\n <Layout {...props}>\n <TrustedChildren />\n </Layout>\n );\n }\n\n return useChild();\n}\n\nexport function TrustedChildren() {\n return useChild();\n}\n\nexport function DefaultLayout() {\n return (\n <Layout>\n <TrustedChildren />\n </Layout>\n );\n}\n\nLayout.Children = Children;\nLayout.useContext = useLayoutContext;\n"]}
@@ -1,11 +1,17 @@
1
- import type { NavigationAction } from '@react-navigation/core';
2
- import * as React from 'react';
3
- import { GestureResponderEvent } from 'react-native';
4
- import { TextProps } from '@bacons/react-views';
5
- import type { To } from '@react-navigation/native/src/useLinkTo';
1
+ import { TextProps } from "@bacons/react-views";
2
+ import * as React from "react";
3
+ import { GestureResponderEvent } from "react-native";
4
+ import type { NavigationAction } from "@react-navigation/core";
5
+ import type { To } from "@react-navigation/native/src/useLinkTo";
6
+ export declare type Href = string | {
7
+ pathname?: string;
8
+ query?: Record<string, any>;
9
+ };
6
10
  declare type Props<ParamList extends ReactNavigation.RootParamList> = {
11
+ /** Add a property which is familiar to */
12
+ href?: Href;
13
+ /** Forward props to child component. Useful for custom buttons. */
7
14
  asChild?: boolean;
8
- href?: string;
9
15
  to?: To<ParamList>;
10
16
  action?: NavigationAction;
11
17
  target?: string;
@@ -22,5 +28,9 @@ declare type Props<ParamList extends ReactNavigation.RootParamList> = {
22
28
  * @param props.children Child elements to render the content.
23
29
  */
24
30
  export declare const Link: React.ForwardRefExoticComponent<Pick<Props<ReactNavigation.RootParamList>, "children" | "key" | "action" | "allowFontScaling" | "ellipsizeMode" | "lineBreakMode" | "numberOfLines" | "onLayout" | "onTextLayout" | "onPress" | "onPressIn" | "onPressOut" | "onLongPress" | "testID" | "nativeID" | "maxFontSizeMultiplier" | "adjustsFontSizeToFit" | "minimumFontScale" | "suppressHighlighting" | "selectable" | "selectionColor" | "textBreakStrategy" | "dataDetectorType" | "android_hyphenationFrequency" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "asChild" | "to" | keyof import("@bacons/react-views/build/Text").WebTextProps> & React.RefAttributes<Text>>;
31
+ export declare const resolveHref: (href: {
32
+ pathname?: string;
33
+ query?: Record<string, any>;
34
+ } | string) => string;
25
35
  export {};
26
36
  //# sourceMappingURL=Link.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/views/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAY,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAQ,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAGrD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wCAAwC,CAAC;AAEjE,aAAK,KAAK,CAAC,SAAS,SAAS,eAAe,CAAC,aAAa,IAAI;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC;IACnB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EA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E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,29BAA6B,CAAC;AAE/C,eAAO,MAAM,WAAW,SAChB;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,GAAG,MAAM,KAChE,MAUF,CAAC"}
@@ -1,8 +1,9 @@
1
- import * as React from 'react';
2
- import { Platform } from 'react-native';
3
- import { Text } from '@bacons/react-views';
4
- import { useLinkProps, } from '@react-navigation/native';
5
- import { Slot } from '@radix-ui/react-slot';
1
+ // Fork of @react-navigation/native Link.tsx
2
+ import { Text } from "@bacons/react-views";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import { useLinkProps } from "@react-navigation/native";
5
+ import * as React from "react";
6
+ import { Platform } from "react-native";
6
7
  /**
7
8
  * Component to render link to another screen using a path.
8
9
  * Uses an anchor tag on the web.
@@ -12,22 +13,61 @@ import { Slot } from '@radix-ui/react-slot';
12
13
  * @param props.children Child elements to render the content.
13
14
  */
14
15
  export const Link = React.forwardRef(BaseLink);
15
- function BaseLink({ to, href, action, asChild, ...rest }, ref) {
16
+ export const resolveHref = (href) => {
17
+ if (typeof href === "string") {
18
+ return href ?? "";
19
+ }
20
+ const path = href.pathname ?? "";
21
+ if (!href?.query) {
22
+ return path;
23
+ }
24
+ const { pathname, query } = createQualifiedPathname(path, { ...href.query });
25
+ return pathname + (Object.keys(query).length ? `?${createQuery(query)}` : "");
26
+ };
27
+ function createQualifiedPathname(pathname, query) {
28
+ for (const [key, value = ""] of Object.entries(query)) {
29
+ const dynamicKey = `[${key}]`;
30
+ const deepDynamicKey = `[...${key}]`;
31
+ if (pathname.includes(dynamicKey)) {
32
+ pathname = pathname.replace(dynamicKey, Array.isArray(value) ? value.join("/") : value);
33
+ }
34
+ else if (pathname.includes(deepDynamicKey)) {
35
+ pathname = pathname.replace(deepDynamicKey, Array.isArray(value) ? value.join("/") : value);
36
+ }
37
+ else {
38
+ continue;
39
+ }
40
+ delete query[key];
41
+ }
42
+ return { pathname, query };
43
+ }
44
+ function createQuery(query) {
45
+ return Object.keys(query)
46
+ .map((key) => `${key}=${query[key]}`)
47
+ .join("&");
48
+ }
49
+ function useResolvedHref({ href, to, }) {
16
50
  // TODO: Auto use router's client-side event.
17
- const resolvedTo = React.useMemo(() => {
18
- const resolved = href ? href : to;
19
- if (resolved == null) {
51
+ return React.useMemo(() => {
52
+ if (href) {
53
+ return resolveHref(href);
54
+ }
55
+ if (to == null) {
20
56
  throw new Error(`You must specify either 'href' or 'to' prop in a <Link />.`);
21
57
  }
22
- if (typeof resolved === 'string' && !resolved.startsWith('/')) {
58
+ if (typeof to === "string" && !to.startsWith("/")) {
23
59
  // TODO: Auto delegate out external links
24
- return '/';
60
+ return "/";
25
61
  }
26
- return resolved;
62
+ return to;
27
63
  }, [href, to]);
64
+ }
65
+ function BaseLink({ to, href, action, asChild, ...rest }, ref) {
66
+ // TODO: Auto use router's client-side event.
67
+ const resolvedTo = useResolvedHref({ href, to });
28
68
  const props = useLinkProps({ to: resolvedTo, action });
29
69
  const onPress = (e) => {
30
- if ('onPress' in rest) {
70
+ if ("onPress" in rest) {
31
71
  rest.onPress?.(e);
32
72
  }
33
73
  props.onPress(e);
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/views/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAyB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAa,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,YAAY,GAAG,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAc3C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CA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AAC","sourcesContent":["// Fork of @react-navigation/native Link.tsx\nimport type { NavigationAction } from '@react-navigation/core';\nimport * as React from 'react';\nimport { GestureResponderEvent, Platform } from 'react-native';\nimport { Text, TextProps } from '@bacons/react-views'\nimport { useLinkProps, } from '@react-navigation/native';\nimport { Slot } from '@radix-ui/react-slot'\nimport type { To } from '@react-navigation/native/src/useLinkTo';\n\ntype Props<ParamList extends ReactNavigation.RootParamList> = {\n asChild?: boolean;\n href?: string;\n to?: To<ParamList>;\n action?: NavigationAction;\n target?: string;\n onPress?: (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => void;\n} & (TextProps & { children: React.ReactNode });\n\n/**\n * Component to render link to another screen using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.href Absolute path to screen (e.g. `/feeds/hot`).\n * @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.\n * @param props.children Child elements to render the content.\n */\nexport const Link = React.forwardRef(BaseLink);\n\nfunction BaseLink<ParamList extends ReactNavigation.RootParamList>({\n to,\n href,\n action,\n asChild,\n ...rest\n}: Props<ParamList>, ref: React.ForwardedRef<Text>) {\n // TODO: Auto use router's client-side event.\n const resolvedTo = React.useMemo(() => {\n const resolved = href ? href : to;\n if (resolved == null) {\n throw new Error(\n `You must specify either 'href' or 'to' prop in a <Link />.`\n );\n }\n if (typeof resolved === 'string' && !resolved.startsWith('/')) {\n // TODO: Auto delegate out external links\n return '/'\n }\n return resolved;\n }, [href, to]);\n const props = useLinkProps<ParamList>({ to: resolvedTo, action });\n\n const onPress = (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => {\n if ('onPress' in rest) {\n rest.onPress?.(e);\n }\n\n props.onPress(e);\n };\n\n return React.createElement(\n // @ts-expect-error: slot is not type-safe\n asChild ? Slot : Text,\n {\n ref,\n ...props,\n ...rest,\n ...Platform.select({\n web: { onClick: onPress } as any,\n default: { onPress },\n }),\n });\n}\n"]}
1
+ {"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AC,GAAG,CAAC,EAAE;YACjD,yCAAyC;YACzC,OAAO,GAAG,CAAC;SACZ;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,QAAQ,CACf,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAoB,EACxD,GAA6B;IAE7B,6CAA6C;IAC7C,MAAM,UAAU,GAAG,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAEjD,MAAM,KAAK,GAAG,YAAY,CAAY,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IAElE,MAAM,OAAO,GAAG,CACd,CAA0E,EAC1E,EAAE;QACF,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;SACnB;QACD,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,KAAK,CAAC,aAAa;IACxB,0CAA0C;IAC1C,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EACrB;QACE,GAAG;QACH,GAAG,KAAK;QACR,GAAG,IAAI;QACP,GAAG,QAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,EAAS;YAChC,OAAO,EAAE,EAAE,OAAO,EAAE;SACrB,CAAC;KACH,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Fork of @react-navigation/native Link.tsx\nimport { Text, TextProps } from \"@bacons/react-views\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { useLinkProps } from \"@react-navigation/native\";\nimport * as React from \"react\";\nimport { GestureResponderEvent, Platform } from \"react-native\";\n\nimport type { NavigationAction } from \"@react-navigation/core\";\nimport type { To } from \"@react-navigation/native/src/useLinkTo\";\n\nexport type Href = string | { pathname?: string; query?: Record<string, any> };\n\ntype Props<ParamList extends ReactNavigation.RootParamList> = {\n /** Add a property which is familiar to */\n href?: Href;\n\n /** Forward props to child component. Useful for custom buttons. */\n asChild?: boolean;\n\n to?: To<ParamList>;\n action?: NavigationAction;\n target?: string;\n onPress?: (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => void;\n} & (TextProps & { children: React.ReactNode });\n\n/**\n * Component to render link to another screen using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.href Absolute path to screen (e.g. `/feeds/hot`).\n * @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.\n * @param props.children Child elements to render the content.\n */\nexport const Link = React.forwardRef(BaseLink);\n\nexport const resolveHref = (\n href: { pathname?: string; query?: Record<string, any> } | string\n): string => {\n if (typeof href === \"string\") {\n return href ?? \"\";\n }\n const path = href.pathname ?? \"\";\n if (!href?.query) {\n return path;\n }\n const { pathname, query } = createQualifiedPathname(path, { ...href.query });\n return pathname + (Object.keys(query).length ? `?${createQuery(query)}` : \"\");\n};\n\nfunction createQualifiedPathname(pathname: string, query: Record<string, any>) {\n for (const [key, value = \"\"] of Object.entries(query)) {\n const dynamicKey = `[${key}]`;\n const deepDynamicKey = `[...${key}]`;\n if (pathname.includes(dynamicKey)) {\n pathname = pathname.replace(\n dynamicKey,\n Array.isArray(value) ? value.join(\"/\") : value\n );\n } else if (pathname.includes(deepDynamicKey)) {\n pathname = pathname.replace(\n deepDynamicKey,\n Array.isArray(value) ? value.join(\"/\") : value\n );\n } else {\n continue;\n }\n\n delete query[key];\n }\n return { pathname, query };\n}\n\nfunction createQuery(query: Record<string, any>) {\n return Object.keys(query)\n .map((key) => `${key}=${query[key]}`)\n .join(\"&\");\n}\n\nfunction useResolvedHref<ParamList extends ReactNavigation.RootParamList>({\n href,\n to,\n}: Pick<Props<ParamList>, \"href\" | \"to\">) {\n // TODO: Auto use router's client-side event.\n return React.useMemo(() => {\n if (href) {\n return resolveHref(href);\n }\n\n if (to == null) {\n throw new Error(\n `You must specify either 'href' or 'to' prop in a <Link />.`\n );\n }\n if (typeof to === \"string\" && !to.startsWith(\"/\")) {\n // TODO: Auto delegate out external links\n return \"/\";\n }\n return to;\n }, [href, to]);\n}\n\nfunction BaseLink<ParamList extends ReactNavigation.RootParamList>(\n { to, href, action, asChild, ...rest }: Props<ParamList>,\n ref: React.ForwardedRef<Text>\n) {\n // TODO: Auto use router's client-side event.\n const resolvedTo = useResolvedHref({ href, to });\n\n const props = useLinkProps<ParamList>({ to: resolvedTo, action });\n\n const onPress = (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => {\n if (\"onPress\" in rest) {\n rest.onPress?.(e);\n }\n props.onPress(e);\n };\n\n return React.createElement(\n // @ts-expect-error: slot is not type-safe\n asChild ? Slot : Text,\n {\n ref,\n ...props,\n ...rest,\n ...Platform.select({\n web: { onClick: onPress } as any,\n default: { onPress },\n }),\n }\n );\n}\n"]}
@@ -8,7 +8,7 @@ export const Unmatched = forwardRef((props, ref) => {
8
8
  const url = createURL("");
9
9
  return (
10
10
  // @ts-ignore
11
- React.createElement(View, { ref: ref, accessibilityRole: "main", style: styles.container },
11
+ React.createElement(View, { ref: ref, style: styles.container },
12
12
  React.createElement(Text, { accessibilityRole: "header", accessibilityLevel: 1, style: styles.title }, "Unmatched Route"),
13
13
  React.createElement(Text, { accessibilityRole: "header", accessibilityLevel: 2, style: styles.subtitle },
14
14
  "Page could not be found.",
@@ -1 +1 @@
1
- {"version":3,"file":"Unmatched.js","sourceRoot":"","sources":["../../src/views/Unmatched.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;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AAa,EAAE,EAAE;QACjB,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,SAAS;QAC5B,iBAAiB,EAAE,CAAC;QACpB,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;KACrB;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,QAAQ;KACtB;IACD,IAAI,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE;CAChE,CAAC,CAAC","sourcesContent":["import React, { forwardRef } from \"react\";\nimport { createURL } from \"expo-linking\";\nimport { StyleSheet } from \"@bacons/react-views\";\nimport { Link } from \"./Link\";\nimport { Text, View } from \"@bacons/react-views\";\n\n/** Default screen for unmatched routes. */\nexport const Unmatched = forwardRef((props, ref) => {\n const url = createURL(\"\");\n return (\n // @ts-ignore\n <View ref={ref} accessibilityRole=\"main\" 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 {process.env.NODE_ENV === \"development\" && (\n <Link href={\"/__index\"} style={styles.link}>\n Sitemap\n </Link>\n )}\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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CACV,CACE,CACV,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC7B,SAAS,EAAE;QACP,IAAI,EAAE,CAAC;QACP,eAAe,EAAE,OAAO;QACxB,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KAC3B;IACD,KAAK,EAAE;QACH,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;KACrB;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,QAAQ;KACtB;IACD,IAAI,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE;CAChE,CAAC,CAAC","sourcesContent":["import React, { forwardRef } from \"react\";\nimport { createURL } from \"expo-linking\";\nimport { StyleSheet } from \"@bacons/react-views\";\nimport { Link } from \"./Link\";\nimport { Text, View } from \"@bacons/react-views\";\n\n/** Default screen for unmatched routes. */\nexport const Unmatched = forwardRef((props, ref) => {\n const url = createURL(\"\");\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 {process.env.NODE_ENV === \"development\" && (\n <Link href={\"/__index\"} style={styles.link}>\n Sitemap\n </Link>\n )}\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "main": "build/index.js",
5
5
  "files": [
6
6
  "entry.js",