expo-router 5.0.2 → 5.0.4
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":"useNavigation.d.ts","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,cAAc,EACd,eAAe,EAEhB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,aAAa,CAC3B,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,GAAG;IACpE,QAAQ,IAAI,eAAe,GAAG,SAAS,CAAC;CACzC,EACD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"useNavigation.d.ts","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,cAAc,EACd,eAAe,EAEhB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,aAAa,CAC3B,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,GAAG;IACpE,QAAQ,IAAI,eAAe,GAAG,SAAS,CAAC;CACzC,EACD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,CAkF3B"}
|
package/build/useNavigation.js
CHANGED
|
@@ -60,6 +60,10 @@ const href_1 = require("./link/href");
|
|
|
60
60
|
function useNavigation(parent) {
|
|
61
61
|
let navigation = (0, native_1.useNavigation)();
|
|
62
62
|
let state = (0, native_1.useStateForPath)();
|
|
63
|
+
if (parent === undefined) {
|
|
64
|
+
// If no parent is provided, return the current navigation object
|
|
65
|
+
return navigation;
|
|
66
|
+
}
|
|
63
67
|
// Check for the top-level navigator - we cannot fetch anything higher!
|
|
64
68
|
const currentId = navigation.getId();
|
|
65
69
|
if (currentId === '' || currentId === `/expo-router/build/views/Navigator`) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigation.js","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAgEb,
|
|
1
|
+
{"version":3,"file":"useNavigation.js","sourceRoot":"","sources":["../src/useNavigation.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAgEb,sCAsFC;AArJD,qDAKkC;AAElC,2CAAiD;AACjD,sCAA0C;AAG1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,SAAgB,aAAa,CAI3B,MAAsB;IACtB,IAAI,UAAU,GAAG,IAAA,sBAAqB,GAAO,CAAC;IAC9C,IAAI,KAAK,GAAG,IAAA,wBAAe,GAAE,CAAC;IAE9B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,iEAAiE;QACjE,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,uEAAuE;IACvE,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IACrC,IAAI,SAAS,KAAK,EAAE,IAAI,SAAS,KAAK,oCAAoC,EAAE,CAAC;QAC3E,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,GAAG,IAAA,kBAAW,EAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,6BAA6B;QAC7B,OAAO,UAAU,CAAC,SAAS,CAAC,oCAAoC,CAAC,IAAI,UA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AAK,8BAAkB,EAAE,CAAC;YAC5C,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IAED,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAE1C,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC1C,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,GAAG,GAA2B,EAAE,CAAC;YACvC,OAAO,UAAU,EAAE,CAAC;gBAClB,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC;gBACpC,UAAU,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;YACtC,CAAC;YAED,MAAM,IAAI,KAAK,CACb,gDAAgD,MAAM,6BAA6B,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CACvG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["'use client';\nimport {\n useNavigation as useUpstreamNavigation,\n NavigationProp,\n NavigationState,\n useStateForPath,\n} from '@react-navigation/native';\n\nimport { INTERNAL_SLOT_NAME } from './constants';\nimport { resolveHref } from './link/href';\nimport { Href } from './types';\n\n/**\n * Returns the underlying React Navigation [`navigation` object](https://reactnavigation.org/docs/navigation-object)\n * to imperatively access layout-specific functionality like `navigation.openDrawer()` in a\n * [Drawer](/router/advanced/drawer/) layout.\n *\n * @example\n * ```tsx app/index.tsx\n * import { useNavigation } from 'expo-router';\n *\n * export default function Route() {\n * // Access the current navigation object for the current route.\n * const navigation = useNavigation();\n *\n * return (\n * <View>\n * <Text onPress={() => {\n * // Open the drawer view.\n * navigation.openDrawer();\n * }}>\n * Open Drawer\n * </Text>\n * </View>\n * );\n * }\n * ```\n *\n * When using nested layouts, you can access higher-order layouts by passing a secondary argument denoting the layout route.\n * For example, `/menu/_layout.tsx` is nested inside `/app/orders/`, you can use `useNavigation('/orders/menu/')`.\n *\n * @example\n * ```tsx app/orders/menu/index.tsx\n * import { useNavigation } from 'expo-router';\n *\n * export default function MenuRoute() {\n * const rootLayout = useNavigation('/');\n * const ordersLayout = useNavigation('/orders');\n *\n * // Same as the default results of `useNavigation()` when invoked in this route.\n * const parentLayout = useNavigation('/orders/menu');\n * }\n * ```\n *\n * If you attempt to access a layout that doesn't exist, an error such as\n * `Could not find parent navigation with route \"/non-existent\"` is thrown.\n *\n *\n * @param parent Provide an absolute path such as `/(root)` to the parent route or a relative path like `../../` to the parent route.\n * @returns The navigation object for the current route.\n *\n * @see React Navigation documentation on [navigation dependent functions](https://reactnavigation.org/docs/navigation-object/#navigator-dependent-functions)\n * for more information.\n */\nexport function useNavigation<\n T = Omit<NavigationProp<ReactNavigation.RootParamList>, 'getState'> & {\n getState(): NavigationState | undefined;\n },\n>(parent?: string | Href): T {\n let navigation = useUpstreamNavigation<any>();\n let state = useStateForPath();\n\n if (parent === undefined) {\n // If no parent is provided, return the current navigation object\n return navigation;\n }\n\n // Check for the top-level navigator - we cannot fetch anything higher!\n const currentId = navigation.getId();\n if (currentId === '' || currentId === `/expo-router/build/views/Navigator`) {\n return navigation;\n }\n\n if (typeof parent === 'object') {\n parent = resolveHref(parent);\n }\n\n if (parent === '/') {\n // This is the root navigator\n return navigation.getParent(`/expo-router/build/views/Navigator`) ?? navigation.getParent(``);\n } else if (parent?.startsWith('../')) {\n const names: string[] = [];\n\n while (state) {\n const route = state.routes[0];\n state = route.state;\n // Don't include the last router, as thats the current route\n if (state) {\n names.push(route.name);\n }\n }\n\n // Removing the trailing slash to make splitting easier\n const originalParent = parent;\n if (parent.endsWith('/')) {\n parent = parent.slice(0, -1);\n }\n\n const segments = parent.split('/');\n if (!segments.every((segment) => segment === '..')) {\n throw new Error(\n `Invalid parent path \"${originalParent}\". Only \"../\" segments are allowed when using relative paths.`\n );\n }\n\n const levels = segments.length;\n const index = names.length - 1 - levels;\n\n if (index < 0) {\n throw new Error(\n `Invalid parent path \"${originalParent}\". Cannot go up ${levels} levels from the current route.`\n );\n }\n\n parent = names[index];\n\n // Expo Router navigators use the context key as the name which has a leading `/`\n // The exception to this is the INTERNAL_SLOT_NAME, and the root navigator which uses ''\n if (parent && parent !== INTERNAL_SLOT_NAME) {\n parent = `/${parent}`;\n }\n }\n\n navigation = navigation.getParent(parent);\n\n if (process.env.NODE_ENV !== 'production') {\n if (!navigation) {\n const ids: (string | undefined)[] = [];\n while (navigation) {\n ids.push(navigation.getId() || '/');\n navigation = navigation.getParent();\n }\n\n throw new Error(\n `Could not find parent navigation with route \"${parent}\". Available routes are: '${ids.join(\"', '\")}'`\n );\n }\n }\n\n return navigation;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/views/ErrorBoundary.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/views/ErrorBoundary.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAsB3C,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,kBAAkB,+BAuCjE"}
|
|
@@ -9,66 +9,6 @@ const react_native_safe_area_context_1 = require("react-native-safe-area-context
|
|
|
9
9
|
const Pressable_1 = require("./Pressable");
|
|
10
10
|
const Link_1 = require("../link/Link");
|
|
11
11
|
const errors_1 = require("../rsc/router/errors");
|
|
12
|
-
let useMetroSymbolication;
|
|
13
|
-
if (process.env.NODE_ENV === 'development') {
|
|
14
|
-
const { LogBoxLog, parseErrorStack } = require('@expo/metro-runtime/symbolicate');
|
|
15
|
-
useMetroSymbolication = function (error) {
|
|
16
|
-
const [logBoxLog, setLogBoxLog] = (0, react_1.useState)(null);
|
|
17
|
-
(0, react_1.useEffect)(() => {
|
|
18
|
-
let isMounted = true;
|
|
19
|
-
const stack = parseErrorStack(error.stack);
|
|
20
|
-
const log = new LogBoxLog({
|
|
21
|
-
level: 'error',
|
|
22
|
-
message: {
|
|
23
|
-
content: error.message,
|
|
24
|
-
substitutions: [],
|
|
25
|
-
},
|
|
26
|
-
isComponentError: false,
|
|
27
|
-
stack,
|
|
28
|
-
category: error.message,
|
|
29
|
-
componentStack: [],
|
|
30
|
-
});
|
|
31
|
-
log.symbolicate('stack', () => {
|
|
32
|
-
if (isMounted) {
|
|
33
|
-
setLogBoxLog(log);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return () => {
|
|
37
|
-
isMounted = false;
|
|
38
|
-
};
|
|
39
|
-
}, [error]);
|
|
40
|
-
return logBoxLog;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
useMetroSymbolication = function () {
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
let StackTrace;
|
|
49
|
-
if (process.env.NODE_ENV === 'development') {
|
|
50
|
-
const { LogContext } = require('@expo/metro-runtime/src/error-overlay/Data/LogContext');
|
|
51
|
-
const { LogBoxInspectorStackFrames, } = require('@expo/metro-runtime/src/error-overlay/overlay/LogBoxInspectorStackFrames');
|
|
52
|
-
StackTrace = function ({ logData }) {
|
|
53
|
-
if (!logData?.symbolicated?.stack?.stack) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return (<react_native_1.ScrollView style={{ flex: 1 }}>
|
|
57
|
-
<LogContext.Provider value={{
|
|
58
|
-
isDisabled: false,
|
|
59
|
-
logs: [logData],
|
|
60
|
-
selectedLogIndex: 0,
|
|
61
|
-
}}>
|
|
62
|
-
<LogBoxInspectorStackFrames onRetry={function () { }} type="stack"/>
|
|
63
|
-
</LogContext.Provider>
|
|
64
|
-
</react_native_1.ScrollView>);
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
StackTrace = function () {
|
|
69
|
-
return <react_native_1.View style={{ flex: 1 }}/>;
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
12
|
function StandardErrorView({ error }) {
|
|
73
13
|
return (<react_native_1.View style={{
|
|
74
14
|
marginBottom: 12,
|
|
@@ -84,19 +24,13 @@ function StandardErrorView({ error }) {
|
|
|
84
24
|
</react_native_1.View>);
|
|
85
25
|
}
|
|
86
26
|
function ErrorBoundary({ error, retry }) {
|
|
87
|
-
const logBoxLog = useMetroSymbolication(error);
|
|
88
27
|
const inTabBar = (0, react_1.useContext)(bottom_tabs_1.BottomTabBarHeightContext);
|
|
89
28
|
const Wrapper = inTabBar ? react_native_1.View : react_native_safe_area_context_1.SafeAreaView;
|
|
90
29
|
const isServerError = error instanceof errors_1.ReactServerError;
|
|
91
30
|
return (<react_native_1.View style={styles.container}>
|
|
92
31
|
<Wrapper style={{ flex: 1, gap: 8, maxWidth: 720, marginHorizontal: 'auto' }}>
|
|
93
|
-
{isServerError ? (
|
|
94
|
-
|
|
95
|
-
<react_native_1.View style={{ flex: 1 }}/>
|
|
96
|
-
</>) : (<>
|
|
97
|
-
<StandardErrorView error={error}/>
|
|
98
|
-
<StackTrace logData={logBoxLog}/>
|
|
99
|
-
</>)}
|
|
32
|
+
{isServerError ? (<ReactServerErrorView error={error}/>) : (<StandardErrorView error={error}/>)}
|
|
33
|
+
<react_native_1.View style={{ flex: 1 }}/>
|
|
100
34
|
|
|
101
35
|
{process.env.NODE_ENV === 'development' && (<Link_1.Link testID="router_error_sitemap" href="/_sitemap" style={styles.link}>
|
|
102
36
|
Sitemap
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../src/views/ErrorBoundary.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAwGb,sCA6CC;AAnJD,+DAA0E;AAC1E,iCAAuE;AACvE,+CAAuF;AACvF,mFAA8D;AAE9D,2CAAwC;AAExC,uCAAoC;AACpC,iDAAwD;AA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AAU,EAAE,CAAC;QACb,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,uBAAQ,CAAC,MAAM,CAAC;YAC1B,OAAO,EAAE,SAAS;YAClB,GAAG,EAAE,aAAa;YAClB,OAAO,EAAE,WAAW;SACrB,CAAC;QACF,UAAU,EAAE,KAAK;KAClB;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;KACb;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;KACjB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,uBAAuB;QAC9B,mBAAmB,EAAE,OAAO;QAC5B,kBAAkB,EAAE,WAAW;QAC/B,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport type { LogBoxLog } from '@expo/metro-runtime/symbolicate';\nimport { BottomTabBarHeightContext } from '@react-navigation/bottom-tabs';\nimport { ComponentType, useContext, useEffect, useState } from 'react';\nimport { StyleSheet, Text, View, Platform, ScrollView, TextInput } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Pressable } from './Pressable';\nimport { ErrorBoundaryProps } from './Try';\nimport { Link } from '../link/Link';\nimport { ReactServerError } from '../rsc/router/errors';\n\nlet useMetroSymbolication: (error: Error) => LogBoxLog | null;\n\nif (process.env.NODE_ENV === 'development') {\n const { LogBoxLog, parseErrorStack } =\n require('@expo/metro-runtime/symbolicate') as typeof import('@expo/metro-runtime/symbolicate');\n useMetroSymbolication = function (error: Error) {\n const [logBoxLog, setLogBoxLog] = useState<LogBoxLog | null>(null);\n\n useEffect(() => {\n let isMounted = true;\n const stack = parseErrorStack(error.stack);\n\n const log = new LogBoxLog({\n level: 'error',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: error.message,\n componentStack: [],\n });\n\n log.symbolicate('stack', () => {\n if (isMounted) {\n setLogBoxLog(log);\n }\n });\n\n return () => {\n isMounted = false;\n };\n }, [error]);\n\n return logBoxLog;\n };\n} else {\n useMetroSymbolication = function () {\n return null;\n };\n}\n\nlet StackTrace: ComponentType<{ logData: LogBoxLog | null }>;\n\nif (process.env.NODE_ENV === 'development') {\n const { LogContext } = require('@expo/metro-runtime/src/error-overlay/Data/LogContext');\n const {\n LogBoxInspectorStackFrames,\n } = require('@expo/metro-runtime/src/error-overlay/overlay/LogBoxInspectorStackFrames');\n\n StackTrace = function ({ logData }: { logData: LogBoxLog | null }) {\n if (!logData?.symbolicated?.stack?.stack) {\n return null;\n }\n return (\n <ScrollView style={{ flex: 1 }}>\n <LogContext.Provider\n value={{\n isDisabled: false,\n logs: [logData],\n selectedLogIndex: 0,\n }}>\n <LogBoxInspectorStackFrames onRetry={function () {}} type=\"stack\" />\n </LogContext.Provider>\n </ScrollView>\n );\n };\n} else {\n StackTrace = function () {\n return <View style={{ flex: 1 }} />;\n };\n}\n\nfunction StandardErrorView({ error }: { error: Error }) {\n return (\n <View\n style={{\n marginBottom: 12,\n gap: 4,\n flexWrap: process.env.EXPO_OS === 'web' ? 'wrap' : 'nowrap',\n }}>\n <Text role=\"heading\" aria-level={1} style={styles.title}>\n Something went wrong\n </Text>\n <Text testID=\"router_error_message\" role=\"heading\" aria-level={2} style={styles.errorMessage}>\n Error: {error.message}\n </Text>\n </View>\n );\n}\n\nexport function ErrorBoundary({ error, retry }: ErrorBoundaryProps) {\n const logBoxLog = useMetroSymbolication(error);\n const inTabBar = useContext(BottomTabBarHeightContext);\n const Wrapper = inTabBar ? View : SafeAreaView;\n\n const isServerError = error instanceof ReactServerError;\n return (\n <View style={styles.container}>\n <Wrapper style={{ flex: 1, gap: 8, maxWidth: 720, marginHorizontal: 'auto' }}>\n {isServerError ? (\n <>\n <ReactServerErrorView error={error} />\n <View style={{ flex: 1 }} />\n </>\n ) : (\n <>\n <StandardErrorView error={error} />\n <StackTrace logData={logBoxLog} />\n </>\n )}\n\n {process.env.NODE_ENV === 'development' && (\n <Link testID=\"router_error_sitemap\" href=\"/_sitemap\" style={styles.link}>\n Sitemap\n </Link>\n )}\n <Pressable testID=\"router_error_retry\" onPress={retry}>\n {({ hovered, pressed }) => (\n <View\n style={[styles.buttonInner, (hovered || pressed) && { backgroundColor: 'white' }]}>\n <Text\n style={[\n styles.buttonText,\n {\n color: hovered || pressed ? 'black' : 'white',\n },\n ]}>\n Retry\n </Text>\n </View>\n )}\n </Pressable>\n </Wrapper>\n </View>\n );\n}\n\nconst COMMON_ERROR_STATUS: Record<number, string | undefined> = {\n 404: 'NOT_FOUND',\n 500: 'INTERNAL_SERVER_ERROR',\n 503: 'SERVICE_UNAVAILABLE',\n 504: 'GATEWAY_TIMEOUT',\n};\n\n// TODO: This should probably be replaced by a DOM component that loads server errors in the future.\nfunction ReactServerErrorView({ error }: { error: ReactServerError }) {\n let title = String(error.statusCode);\n title += ': ' + (COMMON_ERROR_STATUS[error.statusCode] ?? 'Server Error');\n\n const errorId = error.headers.get('cf-ray');\n\n const date = error.headers.get('Date');\n\n return (\n <View\n style={{\n padding: 12,\n gap: 8,\n }}>\n <Text\n selectable\n allowFontScaling\n style={{\n fontSize: Platform.select({ web: 24, default: 16 }),\n fontWeight: 'bold',\n marginBottom: 4,\n color: 'white',\n }}>\n {title}\n </Text>\n\n {process.env.EXPO_OS === 'web' ? (\n <ScrollView\n style={{\n borderColor: 'rgba(255,255,255,0.5)',\n borderTopWidth: StyleSheet.hairlineWidth,\n borderBottomWidth: StyleSheet.hairlineWidth,\n maxHeight: 150,\n }}\n contentContainerStyle={{ paddingVertical: 4 }}>\n <Text\n testID=\"router_error_message\"\n selectable\n allowFontScaling\n style={{\n color: 'white',\n }}>\n {error.message}\n </Text>\n </ScrollView>\n ) : (\n <TextInput\n testID=\"router_error_message\"\n scrollEnabled\n multiline\n editable={false}\n allowFontScaling\n value={error.message}\n style={{\n borderColor: 'rgba(255,255,255,0.5)',\n borderTopWidth: StyleSheet.hairlineWidth,\n borderBottomWidth: StyleSheet.hairlineWidth,\n paddingVertical: 4,\n maxHeight: 150,\n color: 'white',\n }}\n />\n )}\n\n <InfoRow title=\"Code\" right={error.statusCode} />\n {errorId && <InfoRow title=\"ID\" right={errorId} />}\n {date && <InfoRow title=\"Date\" right={date} />}\n\n {error.url && (\n <Text selectable allowFontScaling style={{ fontSize: 14, opacity: 0.5, color: 'white' }}>\n {error.url}\n </Text>\n )}\n </View>\n );\n}\n\nfunction InfoRow({ title, right }: { title: string; right?: any }) {\n const style = {\n fontSize: 16,\n color: 'white',\n };\n\n return (\n <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text selectable allowFontScaling style={style}>\n {title}\n </Text>\n {right && (\n <Text selectable allowFontScaling style={[style, styles.code]}>\n {right}\n </Text>\n )}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n padding: 24,\n alignItems: 'stretch',\n justifyContent: 'center',\n },\n title: {\n color: 'white',\n fontSize: Platform.select({ web: 32, default: 24 }),\n fontWeight: 'bold',\n },\n buttonText: {\n fontSize: 18,\n fontWeight: 'bold',\n color: 'black',\n ...Platform.select({\n web: {\n transitionDuration: '100ms',\n },\n }),\n },\n buttonInner: {\n ...Platform.select({\n web: {\n transitionDuration: '100ms',\n },\n }),\n paddingVertical: 12,\n paddingHorizontal: 24,\n borderColor: 'white',\n borderWidth: 2,\n marginLeft: 8,\n justifyContent: 'center',\n alignItems: 'center',\n },\n code: {\n fontFamily: Platform.select({\n default: 'Courier',\n ios: 'Courier New',\n android: 'monospace',\n }),\n fontWeight: '500',\n },\n errorMessage: {\n color: 'white',\n fontSize: 16,\n },\n subtitle: {\n color: 'white',\n fontSize: 14,\n marginBottom: 12,\n },\n link: {\n color: 'rgba(255,255,255,0.4)',\n textDecorationStyle: 'solid',\n textDecorationLine: 'underline',\n fontSize: 14,\n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EAAE,MAAM;KACnB;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,OAAO;QACd,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,kBAAkB,EAAE,OAAO;aAC5B;SACF,CAAC;KACH;IACD,WAAW,EAAE;QACX,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,kBAAkB,EAAE,OAAO;aAC5B;SACF,CAAC;QACF,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,EAAE;QACrB,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,uBAAQ,CAAC,MAAM,CAAC;YAC1B,OAAO,EAAE,SAAS;YAClB,GAAG,EAAE,aAAa;YAClB,OAAO,EAAE,WAAW;SACrB,CAAC;QACF,UAAU,EAAE,KAAK;KAClB;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;KACb;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;KACjB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,uBAAuB;QAC9B,mBAAmB,EAAE,OAAO;QAC5B,kBAAkB,EAAE,WAAW;QAC/B,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC","sourcesContent":["'use client';\n\nimport { BottomTabBarHeightContext } from '@react-navigation/bottom-tabs';\nimport { useContext } from 'react';\nimport { StyleSheet, Text, View, Platform, ScrollView, TextInput } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Pressable } from './Pressable';\nimport { ErrorBoundaryProps } from './Try';\nimport { Link } from '../link/Link';\nimport { ReactServerError } from '../rsc/router/errors';\n\nfunction StandardErrorView({ error }: { error: Error }) {\n return (\n <View\n style={{\n marginBottom: 12,\n gap: 4,\n flexWrap: process.env.EXPO_OS === 'web' ? 'wrap' : 'nowrap',\n }}>\n <Text role=\"heading\" aria-level={1} style={styles.title}>\n Something went wrong\n </Text>\n <Text testID=\"router_error_message\" role=\"heading\" aria-level={2} style={styles.errorMessage}>\n Error: {error.message}\n </Text>\n </View>\n );\n}\n\nexport function ErrorBoundary({ error, retry }: ErrorBoundaryProps) {\n const inTabBar = useContext(BottomTabBarHeightContext);\n const Wrapper = inTabBar ? View : SafeAreaView;\n\n const isServerError = error instanceof ReactServerError;\n return (\n <View style={styles.container}>\n <Wrapper style={{ flex: 1, gap: 8, maxWidth: 720, marginHorizontal: 'auto' }}>\n {isServerError ? (\n <ReactServerErrorView error={error} />\n ) : (\n <StandardErrorView error={error} />\n )}\n <View style={{ flex: 1 }} />\n\n {process.env.NODE_ENV === 'development' && (\n <Link testID=\"router_error_sitemap\" href=\"/_sitemap\" style={styles.link}>\n Sitemap\n </Link>\n )}\n <Pressable testID=\"router_error_retry\" onPress={retry}>\n {({ hovered, pressed }) => (\n <View\n style={[styles.buttonInner, (hovered || pressed) && { backgroundColor: 'white' }]}>\n <Text\n style={[\n styles.buttonText,\n {\n color: hovered || pressed ? 'black' : 'white',\n },\n ]}>\n Retry\n </Text>\n </View>\n )}\n </Pressable>\n </Wrapper>\n </View>\n );\n}\n\nconst COMMON_ERROR_STATUS: Record<number, string | undefined> = {\n 404: 'NOT_FOUND',\n 500: 'INTERNAL_SERVER_ERROR',\n 503: 'SERVICE_UNAVAILABLE',\n 504: 'GATEWAY_TIMEOUT',\n};\n\n// TODO: This should probably be replaced by a DOM component that loads server errors in the future.\nfunction ReactServerErrorView({ error }: { error: ReactServerError }) {\n let title = String(error.statusCode);\n title += ': ' + (COMMON_ERROR_STATUS[error.statusCode] ?? 'Server Error');\n\n const errorId = error.headers.get('cf-ray');\n\n const date = error.headers.get('Date');\n\n return (\n <View\n style={{\n padding: 12,\n gap: 8,\n }}>\n <Text\n selectable\n allowFontScaling\n style={{\n fontSize: Platform.select({ web: 24, default: 16 }),\n fontWeight: 'bold',\n marginBottom: 4,\n color: 'white',\n }}>\n {title}\n </Text>\n\n {process.env.EXPO_OS === 'web' ? (\n <ScrollView\n style={{\n borderColor: 'rgba(255,255,255,0.5)',\n borderTopWidth: StyleSheet.hairlineWidth,\n borderBottomWidth: StyleSheet.hairlineWidth,\n maxHeight: 150,\n }}\n contentContainerStyle={{ paddingVertical: 4 }}>\n <Text\n testID=\"router_error_message\"\n selectable\n allowFontScaling\n style={{\n color: 'white',\n }}>\n {error.message}\n </Text>\n </ScrollView>\n ) : (\n <TextInput\n testID=\"router_error_message\"\n scrollEnabled\n multiline\n editable={false}\n allowFontScaling\n value={error.message}\n style={{\n borderColor: 'rgba(255,255,255,0.5)',\n borderTopWidth: StyleSheet.hairlineWidth,\n borderBottomWidth: StyleSheet.hairlineWidth,\n paddingVertical: 4,\n maxHeight: 150,\n color: 'white',\n }}\n />\n )}\n\n <InfoRow title=\"Code\" right={error.statusCode} />\n {errorId && <InfoRow title=\"ID\" right={errorId} />}\n {date && <InfoRow title=\"Date\" right={date} />}\n\n {error.url && (\n <Text selectable allowFontScaling style={{ fontSize: 14, opacity: 0.5, color: 'white' }}>\n {error.url}\n </Text>\n )}\n </View>\n );\n}\n\nfunction InfoRow({ title, right }: { title: string; right?: any }) {\n const style = {\n fontSize: 16,\n color: 'white',\n };\n\n return (\n <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text selectable allowFontScaling style={style}>\n {title}\n </Text>\n {right && (\n <Text selectable allowFontScaling style={[style, styles.code]}>\n {right}\n </Text>\n )}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n padding: 24,\n alignItems: 'stretch',\n justifyContent: 'center',\n },\n title: {\n color: 'white',\n fontSize: Platform.select({ web: 32, default: 24 }),\n fontWeight: 'bold',\n },\n buttonText: {\n fontSize: 18,\n fontWeight: 'bold',\n color: 'black',\n ...Platform.select({\n web: {\n transitionDuration: '100ms',\n },\n }),\n },\n buttonInner: {\n ...Platform.select({\n web: {\n transitionDuration: '100ms',\n },\n }),\n paddingVertical: 12,\n paddingHorizontal: 24,\n borderColor: 'white',\n borderWidth: 2,\n marginLeft: 8,\n justifyContent: 'center',\n alignItems: 'center',\n },\n code: {\n fontFamily: Platform.select({\n default: 'Courier',\n ios: 'Courier New',\n android: 'monospace',\n }),\n fontWeight: '500',\n },\n errorMessage: {\n color: 'white',\n fontSize: 16,\n },\n subtitle: {\n color: 'white',\n fontSize: 14,\n marginBottom: 12,\n },\n link: {\n color: 'rgba(255,255,255,0.4)',\n textDecorationStyle: 'solid',\n textDecorationLine: 'underline',\n fontSize: 14,\n textAlign: 'center',\n },\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "Expo Router is a file-based router for React Native and web applications.",
|
|
5
5
|
"author": "650 Industries, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"tsd": "^0.28.1"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@expo/metro-runtime": "5.0.
|
|
108
|
+
"@expo/metro-runtime": "5.0.4",
|
|
109
109
|
"@expo/server": "^0.6.2",
|
|
110
110
|
"@radix-ui/react-slot": "1.2.0",
|
|
111
111
|
"@react-navigation/bottom-tabs": "^7.3.10",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"server-only": "^0.0.1",
|
|
121
121
|
"shallowequal": "^1.1.0"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "7cd543b5d7b836fed6dca00859e35883c490b9ef"
|
|
124
124
|
}
|