expo-router 4.1.0-canary-20250131-5c4e588 → 4.1.0-canary-20250207-8bc5146

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":"fast-refresh.d.ts","sourceRoot":"","sources":["../src/fast-refresh.ts"],"names":[],"mappings":"AA4EA,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"fast-refresh.d.ts","sourceRoot":"","sources":["../src/fast-refresh.ts"],"names":[],"mappings":"AAwEA,OAAO,EAAE,CAAC"}
@@ -54,10 +54,6 @@ if (process.env.NODE_ENV === 'development') {
54
54
  if ('generateStaticParams' in value) {
55
55
  expoRouterExports.add(value.generateStaticParams);
56
56
  }
57
- // When ErrorBoundary is exported, the inverse dependency will also include the _ctx file.
58
- if ('ctx' in value && value.ctx.name === 'metroContext') {
59
- expoRouterExports.add(value.ctx);
60
- }
61
57
  }
62
58
  }
63
59
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"fast-refresh.js","sourceRoot":"","sources":["../src/fast-refresh.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;IAC1C;IACE,gCAAgC;IAChC,OAAO,uBAAuB,KAAK,WAAW;QAC9C,4CAA4C;QAC5C,MAAM,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,EAClD;QACA,sGAAsG;QACtG,MAAM,OAAO,GAAG,MAAM,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,CAAC;QACnE,mCAAmC;QACnC,MAAM,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;QAC5D,0CAA0C;QAC1C,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAE,CAAC;QAExC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;YACrB;;;;eAIG;YACH,qBAAqB,CAAC,KAAK;gBACzB,IAAI;oBACF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;wBAC7B,IAAI,mBAAmB,IAAI,KAAK,EAAE;4BAChC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;yBAChD;wBACD,IAAI,eAAe,IAAI,KAAK,EAAE;4BAC5B,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;yBAC5C;wBACD,IAAI,sBAAsB,IAAI,KAAK,EAAE;4BACnC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;yBACnD;wBACD,0FAA0F;wBAC1F,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE;4BACvD,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;yBAClC;qBACF;iBACF;gBAAC,MAAM;oBACN,6EAA6E;oBAC7E,8EAA8E;oBAC9E,4EAA4E;oBAC5E,4CAA4C;iBAC7C;gBACD,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACtE,CAAC;SACF,CAAC,CAAC;KACJ;CACF","sourcesContent":["declare let __METRO_GLOBAL_PREFIX__: string;\n\n/**\n * This is a hack for Expo Router to support Fast Refresh on _layout files\n *\n * Fast Refresh only works when:\n * - Files only export React Components\n * - All inverse dependencies only export React Components\n *\n * Expo Router's _layout files support exporting both 'unstable_settings' and 'ErrorBoundary'\n *\n * 'unstable_settings':\n * - This is a plain object, so it will break Fast Refresh\n *\n * 'ErrorBoundary'\n * - While this is a React component, it is imported from 'expo-router'\n * - 'expo-router' has an inverse dependency on _ctx, which is a require.context object\n *\n * 'generateStaticParams'\n * - This is a function that is not a React Component, so it will break Fast Refresh\n *\n *\n * To resolve this issue, we extend ReactRefresh to flag these exports as React components\n *\n * @see https://reactnative.dev/docs/fast-refresh\n */\nif (process.env.NODE_ENV === 'development') {\n if (\n // Should be a string at runtime\n typeof __METRO_GLOBAL_PREFIX__ !== 'undefined' &&\n // Should be set by Metro's require polyfill\n global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh']\n ) {\n // source: https://github.com/facebook/metro/blob/main/packages/metro-runtime/src/polyfills/require.js\n const Refresh = global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh'];\n // Keep a reference to the original\n const isLikelyComponentType = Refresh.isLikelyComponentType;\n // Modules can be dereferenced at any time\n const expoRouterExports = new WeakSet();\n\n Object.assign(Refresh, {\n /*\n * isLikelyComponentType is called twice.\n * 1. Initially with a modules export object\n * 2. With each individual export of a module\n */\n isLikelyComponentType(value) {\n try {\n if (typeof value === 'object') {\n if ('unstable_settings' in value) {\n expoRouterExports.add(value.unstable_settings);\n }\n if ('ErrorBoundary' in value) {\n expoRouterExports.add(value.ErrorBoundary);\n }\n if ('generateStaticParams' in value) {\n expoRouterExports.add(value.generateStaticParams);\n }\n // When ErrorBoundary is exported, the inverse dependency will also include the _ctx file.\n if ('ctx' in value && value.ctx.name === 'metroContext') {\n expoRouterExports.add(value.ctx);\n }\n }\n } catch {\n // Ignore - we're just trying to avoid breaking Fast Refresh by using exports\n // that aren't JS objects valid as keys for the WeakSet - like we've seen with\n // some JSI::HostObject instances that are exported in a module - see #33670\n // https://github.com/expo/expo/issues/33670\n }\n return expoRouterExports.has(value) || isLikelyComponentType(value);\n },\n });\n }\n}\n\n// Export an empty object so TypeScript doesn't consider this an ambient module\nexport {};\n"]}
1
+ {"version":3,"file":"fast-refresh.js","sourceRoot":"","sources":["../src/fast-refresh.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;IAC1C;IACE,gCAAgC;IAChC,OAAO,uBAAuB,KAAK,WAAW;QAC9C,4CAA4C;QAC5C,MAAM,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,EAClD;QACA,sGAAsG;QACtG,MAAM,OAAO,GAAG,MAAM,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,CAAC;QACnE,mCAAmC;QACnC,MAAM,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;QAC5D,0CAA0C;QAC1C,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAE,CAAC;QAExC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;YACrB;;;;eAIG;YACH,qBAAqB,CAAC,KAAK;gBACzB,IAAI;oBACF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;wBAC7B,IAAI,mBAAmB,IAAI,KAAK,EAAE;4BAChC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;yBAChD;wBACD,IAAI,eAAe,IAAI,KAAK,EAAE;4BAC5B,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;yBAC5C;wBACD,IAAI,sBAAsB,IAAI,KAAK,EAAE;4BACnC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;yBACnD;qBACF;iBACF;gBAAC,MAAM;oBACN,6EAA6E;oBAC7E,8EAA8E;oBAC9E,4EAA4E;oBAC5E,4CAA4C;iBAC7C;gBACD,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACtE,CAAC;SACF,CAAC,CAAC;KACJ;CACF","sourcesContent":["declare let __METRO_GLOBAL_PREFIX__: string;\n\n/**\n * This is a hack for Expo Router to support Fast Refresh on _layout files\n *\n * Fast Refresh only works when:\n * - Files only export React Components\n * - All inverse dependencies only export React Components\n *\n * Expo Router's _layout files support exporting both 'unstable_settings' and 'ErrorBoundary'\n *\n * 'unstable_settings':\n * - This is a plain object, so it will break Fast Refresh\n *\n * 'ErrorBoundary'\n * - While this is a React component, it is imported from 'expo-router'\n * - 'expo-router' has an inverse dependency on _ctx, which is a require.context object\n *\n * 'generateStaticParams'\n * - This is a function that is not a React Component, so it will break Fast Refresh\n *\n *\n * To resolve this issue, we extend ReactRefresh to flag these exports as React components\n *\n * @see https://reactnative.dev/docs/fast-refresh\n */\nif (process.env.NODE_ENV === 'development') {\n if (\n // Should be a string at runtime\n typeof __METRO_GLOBAL_PREFIX__ !== 'undefined' &&\n // Should be set by Metro's require polyfill\n global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh']\n ) {\n // source: https://github.com/facebook/metro/blob/main/packages/metro-runtime/src/polyfills/require.js\n const Refresh = global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh'];\n // Keep a reference to the original\n const isLikelyComponentType = Refresh.isLikelyComponentType;\n // Modules can be dereferenced at any time\n const expoRouterExports = new WeakSet();\n\n Object.assign(Refresh, {\n /*\n * isLikelyComponentType is called twice.\n * 1. Initially with a modules export object\n * 2. With each individual export of a module\n */\n isLikelyComponentType(value) {\n try {\n if (typeof value === 'object') {\n if ('unstable_settings' in value) {\n expoRouterExports.add(value.unstable_settings);\n }\n if ('ErrorBoundary' in value) {\n expoRouterExports.add(value.ErrorBoundary);\n }\n if ('generateStaticParams' in value) {\n expoRouterExports.add(value.generateStaticParams);\n }\n }\n } catch {\n // Ignore - we're just trying to avoid breaking Fast Refresh by using exports\n // that aren't JS objects valid as keys for the WeakSet - like we've seen with\n // some JSI::HostObject instances that are exported in a module - see #33670\n // https://github.com/expo/expo/issues/33670\n }\n return expoRouterExports.has(value) || isLikelyComponentType(value);\n },\n });\n }\n}\n\n// Export an empty object so TypeScript doesn't consider this an ambient module\nexport {};\n"]}
@@ -0,0 +1,4 @@
1
+ import { NativeStackView as RNNativeStackView } from '@react-navigation/native-stack';
2
+ import { ComponentProps } from 'react';
3
+ export declare function NativeStackView(props: ComponentProps<typeof RNNativeStackView>): import("react").JSX.Element;
4
+ //# sourceMappingURL=NativeStackView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeStackView.d.ts","sourceRoot":"","sources":["../../../src/fork/native-stack/NativeStackView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAC;AAI5D,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,iBAAiB,CAAC,+BAM9E"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NativeStackView = void 0;
4
+ const native_stack_1 = require("@react-navigation/native-stack");
5
+ const react_1 = require("react");
6
+ const RootModal_1 = require("../../layouts/RootModal");
7
+ function NativeStackView(props) {
8
+ return (<RootModal_1.RootModalProvider>
9
+ <NativeStackViewInner {...props}/>
10
+ </RootModal_1.RootModalProvider>);
11
+ }
12
+ exports.NativeStackView = NativeStackView;
13
+ function NativeStackViewInner(props) {
14
+ const rootModals = (0, react_1.useContext)(RootModal_1.RootModalContext);
15
+ // Append the root modals to the state
16
+ const state = (0, react_1.useMemo)(() => {
17
+ if (rootModals.routes.length === 0) {
18
+ return props.state;
19
+ }
20
+ return {
21
+ ...props.state,
22
+ routes: props.state.routes.concat(rootModals.routes),
23
+ };
24
+ }, [props.state, rootModals.routes]);
25
+ return <native_stack_1.NativeStackView {...props} state={state}/>;
26
+ }
27
+ //# sourceMappingURL=NativeStackView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeStackView.js","sourceRoot":"","sources":["../../../src/fork/native-stack/NativeStackView.tsx"],"names":[],"mappings":";;;AAAA,iEAAsF;AACtF,iCAA4D;AAE5D,uDAA8E;AAE9E,SAAgB,eAAe,CAAC,KAA+C;IAC7E,OAAO,CACL,CAAC,6BAAiB,CAChB;MAAA,CAAC,oBAAoB,CAAC,IAAI,KAAK,CAAC,EAClC;IAAA,EAAE,6BAAiB,CAAC,CACrB,CAAC;AACJ,CAAC;AAND,0CAMC;AAED,SAAS,oBAAoB,CAAC,KAA+C;IAC3E,MAAM,UAAU,GAAG,IAAA,kBAAU,EAAC,4BAAgB,CAAC,CAAC;IAEhD,sCAAsC;IACtC,MAAM,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACzB,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,OAAO,KAAK,CAAC,KAAK,CAAC;SACpB;QAED,OAAO;YACL,GAAG,KAAK,CAAC,KAAK;YACd,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;SACrD,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAErC,OAAO,CAAC,8BAAiB,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;AACxD,CAAC","sourcesContent":["import { NativeStackView as RNNativeStackView } from '@react-navigation/native-stack';\nimport { ComponentProps, useContext, useMemo } from 'react';\n\nimport { RootModalContext, RootModalProvider } from '../../layouts/RootModal';\n\nexport function NativeStackView(props: ComponentProps<typeof RNNativeStackView>) {\n return (\n <RootModalProvider>\n <NativeStackViewInner {...props} />\n </RootModalProvider>\n );\n}\n\nfunction NativeStackViewInner(props: ComponentProps<typeof RNNativeStackView>) {\n const rootModals = useContext(RootModalContext);\n\n // Append the root modals to the state\n const state = useMemo(() => {\n if (rootModals.routes.length === 0) {\n return props.state;\n }\n\n return {\n ...props.state,\n routes: props.state.routes.concat(rootModals.routes),\n };\n }, [props.state, rootModals.routes]);\n\n return <RNNativeStackView {...props} state={state} />;\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { type NavigatorTypeBagBase, type ParamListBase, type StackNavigationState, type StaticConfig, type TypedNavigator } from '@react-navigation/native';
2
+ import { NativeStackNavigatorProps, NativeStackNavigationOptions, NativeStackNavigationEventMap, NativeStackNavigationProp } from '@react-navigation/native-stack';
3
+ import * as React from 'react';
4
+ declare function NativeStackNavigator({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_getStateForRouteNamesChange, ...rest }: NativeStackNavigatorProps): React.JSX.Element;
5
+ export declare function createNativeStackNavigator<const ParamList extends ParamListBase, const NavigatorID extends string | undefined = undefined, const TypeBag extends NavigatorTypeBagBase = {
6
+ ParamList: ParamList;
7
+ NavigatorID: NavigatorID;
8
+ State: StackNavigationState<ParamList>;
9
+ ScreenOptions: NativeStackNavigationOptions;
10
+ EventMap: NativeStackNavigationEventMap;
11
+ NavigationList: {
12
+ [RouteName in keyof ParamList]: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;
13
+ };
14
+ Navigator: typeof NativeStackNavigator;
15
+ }, const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>>(config?: Config): TypedNavigator<TypeBag, Config>;
16
+ export {};
17
+ //# sourceMappingURL=createNativeStackNavigator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNativeStackNavigator.d.ts","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAGzB,KAAK,YAAY,EACjB,KAAK,cAAc,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,6BAA6B,EAE7B,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,iBAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,oCAAoC,EACpC,GAAG,IAAI,EACR,EAAE,yBAAyB,qBAmD3B;AAED,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,SAAS,SAAS,aAAa,EACrC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EACxD,KAAK,CAAC,OAAO,SAAS,oBAAoB,GAAG;IAC3C,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACvC,aAAa,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,EAAE,6BAA6B,CAAC;IACxC,cAAc,EAAE;SACb,SAAS,IAAI,MAAM,SAAS,GAAG,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;KAC7F,CAAC;IACF,SAAS,EAAE,OAAO,oBAAoB,CAAC;CACxC,EACD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,EAClE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.createNativeStackNavigator = void 0;
27
+ const native_1 = require("@react-navigation/native");
28
+ const native_stack_1 = require("@react-navigation/native-stack");
29
+ const React = __importStar(require("react"));
30
+ function NativeStackNavigator({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_getStateForRouteNamesChange, ...rest }) {
31
+ const { state, describe, descriptors, navigation, NavigationContent } = (0, native_1.useNavigationBuilder)(native_1.StackRouter, {
32
+ id,
33
+ initialRouteName,
34
+ children,
35
+ layout,
36
+ screenListeners,
37
+ screenOptions,
38
+ screenLayout,
39
+ UNSTABLE_getStateForRouteNamesChange,
40
+ });
41
+ React.useEffect(() =>
42
+ // @ts-expect-error: there may not be a tab navigator in parent
43
+ navigation?.addListener?.('tabPress', (e) => {
44
+ const isFocused = navigation.isFocused();
45
+ // Run the operation in the next frame so we're sure all listeners have been run
46
+ // This is necessary to know if preventDefault() has been called
47
+ requestAnimationFrame(() => {
48
+ if (state.index > 0 && isFocused && !e.defaultPrevented) {
49
+ // When user taps on already focused tab and we're inside the tab,
50
+ // reset the stack to replicate native behaviour
51
+ navigation.dispatch({
52
+ ...native_1.StackActions.popToTop(),
53
+ target: state.key,
54
+ });
55
+ }
56
+ });
57
+ }), [navigation, state.index, state.key]);
58
+ return (<NavigationContent>
59
+ <native_stack_1.NativeStackView {...rest} state={state} navigation={navigation} descriptors={descriptors} describe={describe}/>
60
+ </NavigationContent>);
61
+ }
62
+ function createNativeStackNavigator(config) {
63
+ return (0, native_1.createNavigatorFactory)(NativeStackNavigator)(config);
64
+ }
65
+ exports.createNativeStackNavigator = createNativeStackNavigator;
66
+ //# sourceMappingURL=createNativeStackNavigator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNativeStackNavigator.js","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":";;;;;;;;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vB,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAEvB;IAAA,EAAE,iBAAiB,CAAC,CACrB,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAexC,MAAe;IACf,OAAO,IAAA,+BAAsB,EAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC;AAjBD,gEAiBC","sourcesContent":["import {\n createNavigatorFactory,\n type EventArg,\n type NavigatorTypeBagBase,\n type ParamListBase,\n type StackActionHelpers,\n StackActions,\n type StackNavigationState,\n StackRouter,\n type StackRouterOptions,\n type StaticConfig,\n type TypedNavigator,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n NativeStackNavigatorProps,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap,\n NativeStackView,\n NativeStackNavigationProp,\n} from '@react-navigation/native-stack';\nimport * as React from 'react';\n\nfunction NativeStackNavigator({\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_getStateForRouteNamesChange,\n ...rest\n}: NativeStackNavigatorProps) {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n >(StackRouter, {\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_getStateForRouteNamesChange,\n });\n\n React.useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: any) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !(e as EventArg<'tabPress', true>).defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n return (\n <NavigationContent>\n <NativeStackView\n {...rest}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />\n </NavigationContent>\n );\n}\n\nexport function createNativeStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = undefined,\n const TypeBag extends NavigatorTypeBagBase = {\n ParamList: ParamList;\n NavigatorID: NavigatorID;\n State: StackNavigationState<ParamList>;\n ScreenOptions: NativeStackNavigationOptions;\n EventMap: NativeStackNavigationEventMap;\n NavigationList: {\n [RouteName in keyof ParamList]: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n Navigator: typeof NativeStackNavigator;\n },\n const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(NativeStackNavigator)(config);\n}\n"]}
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ type RootModalContextValue = {
3
+ root: true;
4
+ routes: never[];
5
+ addModal: (name: string) => void;
6
+ removeModal: (name: string) => void;
7
+ };
8
+ export declare const RootModalContext: import("react").Context<RootModalContextValue>;
9
+ export declare function RootModalProvider({ children }: {
10
+ children: React.ReactNode;
11
+ }): import("react").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=RootModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RootModal.d.ts","sourceRoot":"","sources":["../../src/layouts/RootModal.tsx"],"names":[],"mappings":";AAEA,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,gBAAgB,gDAK3B,CAAC;AAEH,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,+BAe5E"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RootModalProvider = exports.RootModalContext = void 0;
4
+ const react_1 = require("react");
5
+ exports.RootModalContext = (0, react_1.createContext)({
6
+ root: true,
7
+ routes: [],
8
+ addModal: () => { },
9
+ removeModal: () => { },
10
+ });
11
+ function RootModalProvider({ children }) {
12
+ const parent = (0, react_1.useContext)(exports.RootModalContext);
13
+ const [state, setState] = (0, react_1.useState)(() => ({
14
+ root: false,
15
+ routes: [],
16
+ addModal: (name) => {
17
+ return parent.root ? setState((state) => ({ ...state })) : parent.addModal(name);
18
+ },
19
+ removeModal: (name) => {
20
+ return parent.root ? setState((state) => ({ ...state })) : parent.addModal(name);
21
+ },
22
+ }));
23
+ return <exports.RootModalContext.Provider value={state}>{children}</exports.RootModalContext.Provider>;
24
+ }
25
+ exports.RootModalProvider = RootModalProvider;
26
+ //# sourceMappingURL=RootModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RootModal.js","sourceRoot":"","sources":["../../src/layouts/RootModal.tsx"],"names":[],"mappings":";;;AAAA,iCAA4D;AAS/C,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAwB;IACnE,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;CACtB,CAAC,CAAC;AAEH,SAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAiC;IAC3E,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,wBAAgB,CAAC,CAAC;IAE5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAwB,GAAG,EAAE,CAAC,CAAC;QAC/D,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE;YACzB,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnF,CAAC;QACD,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE;YAC5B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnF,CAAC;KACF,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,wBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,wBAAgB,CAAC,QAAQ,CAAC,CAAC;AACzF,CAAC;AAfD,8CAeC","sourcesContent":["import { createContext, useContext, useState } from 'react';\n\ntype RootModalContextValue = {\n root: true;\n routes: never[];\n addModal: (name: string) => void;\n removeModal: (name: string) => void;\n};\n\nexport const RootModalContext = createContext<RootModalContextValue>({\n root: true,\n routes: [],\n addModal: () => {},\n removeModal: () => {},\n});\n\nexport function RootModalProvider({ children }: { children: React.ReactNode }) {\n const parent = useContext(RootModalContext);\n\n const [state, setState] = useState<RootModalContextValue>(() => ({\n root: false,\n routes: [],\n addModal: (name: string) => {\n return parent.root ? setState((state) => ({ ...state })) : parent.addModal(name);\n },\n removeModal: (name: string) => {\n return parent.root ? setState((state) => ({ ...state })) : parent.addModal(name);\n },\n }));\n\n return <RootModalContext.Provider value={state}>{children}</RootModalContext.Provider>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"StackClient.d.ts","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAEL,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AAMxC,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKK,CAAC;AAExB,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"StackClient.d.ts","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AAOxC,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKK,CAAC;AAExB,eAAe,KAAK,CAAC"}
@@ -2,9 +2,9 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Stack = void 0;
5
- const native_stack_1 = require("@react-navigation/native-stack");
6
5
  const withLayoutContext_1 = require("./withLayoutContext");
7
- const NativeStackNavigator = (0, native_stack_1.createNativeStackNavigator)().Navigator;
6
+ const createNativeStackNavigator_1 = require("../fork/native-stack/createNativeStackNavigator");
7
+ const NativeStackNavigator = (0, createNativeStackNavigator_1.createNativeStackNavigator)().Navigator;
8
8
  exports.Stack = (0, withLayoutContext_1.withLayoutContext)(NativeStackNavigator);
9
9
  exports.default = exports.Stack;
10
10
  //# sourceMappingURL=StackClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StackClient.js","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AAEb,iEAIwC;AAExC,2DAAwD;AAExD,MAAM,oBAAoB,GAAG,IAAA,yCAA0B,GAAE,CAAC,SAAS,CAAC;AAEvD,QAAA,KAAK,GAAG,IAAA,qCAAiB,EAKpC,oBAAoB,CAAC,CAAC;AAExB,kBAAe,aAAK,CAAC","sourcesContent":["'use client';\nimport { ParamListBase, StackNavigationState } from '@react-navigation/native';\nimport {\n createNativeStackNavigator,\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack';\n\nimport { withLayoutContext } from './withLayoutContext';\n\nconst NativeStackNavigator = createNativeStackNavigator().Navigator;\n\nexport const Stack = withLayoutContext<\n NativeStackNavigationOptions,\n typeof NativeStackNavigator,\n StackNavigationState<ParamListBase>,\n NativeStackNavigationEventMap\n>(NativeStackNavigator);\n\nexport default Stack;\n"]}
1
+ {"version":3,"file":"StackClient.js","sourceRoot":"","sources":["../../src/layouts/StackClient.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AAOb,2DAAwD;AACxD,gGAA6F;AAE7F,MAAM,oBAAoB,GAAG,IAAA,uDAA0B,GAAE,CAAC,SAAS,CAAC;AAEvD,QAAA,KAAK,GAAG,IAAA,qCAAiB,EAKpC,oBAAoB,CAAC,CAAC;AAExB,kBAAe,aAAK,CAAC","sourcesContent":["'use client';\nimport { ParamListBase, StackNavigationState } from '@react-navigation/native';\nimport {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack';\n\nimport { withLayoutContext } from './withLayoutContext';\nimport { createNativeStackNavigator } from '../fork/native-stack/createNativeStackNavigator';\n\nconst NativeStackNavigator = createNativeStackNavigator().Navigator;\n\nexport const Stack = withLayoutContext<\n NativeStackNavigationOptions,\n typeof NativeStackNavigator,\n StackNavigationState<ParamListBase>,\n NativeStackNavigationEventMap\n>(NativeStackNavigator);\n\nexport default Stack;\n"]}
@@ -13,6 +13,32 @@ export declare function useFilterScreenChildren(children: ReactNode, { isCustomN
13
13
  /**
14
14
  * Returns a navigator that automatically injects matched routes and renders nothing when there are no children.
15
15
  * Return type with `children` prop optional.
16
+ *
17
+ * Enables use of other built-in React Navigation navigators and other navigators built with the React Navigation custom navigator API.
18
+ *
19
+ * @example
20
+ * ```tsx app/_layout.tsx
21
+ * import { ParamListBase, TabNavigationState } from "@react-navigation/native";
22
+ * import {
23
+ * createMaterialTopTabNavigator,
24
+ * MaterialTopTabNavigationOptions,
25
+ * MaterialTopTabNavigationEventMap,
26
+ * } from "@react-navigation/material-top-tabs";
27
+ * import { withLayoutContext } from "expo-router";
28
+ *
29
+ * const MaterialTopTabs = createMaterialTopTabNavigator();
30
+ *
31
+ * const ExpoRouterMaterialTopTabs = withLayoutContext<
32
+ * MaterialTopTabNavigationOptions,
33
+ * typeof MaterialTopTabs.Navigator,
34
+ * TabNavigationState<ParamListBase>,
35
+ * MaterialTopTabNavigationEventMap
36
+ * >(MaterialTopTabs.Navigator);
37
+
38
+ * export default function TabLayout() {
39
+ * return <ExpoRouterMaterialTopTabs />;
40
+ * }
41
+ * ```
16
42
  */
17
43
  export declare function withLayoutContext<TOptions extends object, T extends ComponentType<any>, TState extends NavigationState, TEventMap extends EventMapBase>(Nav: T, processor?: (options: ScreenProps<TOptions, TState, TEventMap>[]) => ScreenProps<TOptions, TState, TEventMap>[]): React.ForwardRefExoticComponent<React.PropsWithoutRef<PickPartial<React.ComponentProps<T>, "children">> & React.RefAttributes<unknown>> & {
18
44
  Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;
@@ -1 +1 @@
1
- {"version":3,"file":"withLayoutContext.d.ts","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACzE,OA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;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;CAChB;;;EA4CP;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,SAAS,MAAM,EACvB,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,EAC5B,MAAM,SAAS,eAAe,EAC9B,SAAS,SAAS,YAAY,EAE9B,GAAG,EAAE,CAAC,EACN,SAAS,CAAC,EAAE,CACV,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAChD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE;oBA2B7B,YAAY,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI;EAEpE"}
@@ -70,6 +70,32 @@ exports.useFilterScreenChildren = useFilterScreenChildren;
70
70
  /**
71
71
  * Returns a navigator that automatically injects matched routes and renders nothing when there are no children.
72
72
  * Return type with `children` prop optional.
73
+ *
74
+ * Enables use of other built-in React Navigation navigators and other navigators built with the React Navigation custom navigator API.
75
+ *
76
+ * @example
77
+ * ```tsx app/_layout.tsx
78
+ * import { ParamListBase, TabNavigationState } from "@react-navigation/native";
79
+ * import {
80
+ * createMaterialTopTabNavigator,
81
+ * MaterialTopTabNavigationOptions,
82
+ * MaterialTopTabNavigationEventMap,
83
+ * } from "@react-navigation/material-top-tabs";
84
+ * import { withLayoutContext } from "expo-router";
85
+ *
86
+ * const MaterialTopTabs = createMaterialTopTabNavigator();
87
+ *
88
+ * const ExpoRouterMaterialTopTabs = withLayoutContext<
89
+ * MaterialTopTabNavigationOptions,
90
+ * typeof MaterialTopTabs.Navigator,
91
+ * TabNavigationState<ParamListBase>,
92
+ * MaterialTopTabNavigationEventMap
93
+ * >(MaterialTopTabs.Navigator);
94
+
95
+ * export default function TabLayout() {
96
+ * return <ExpoRouterMaterialTopTabs />;
97
+ * }
98
+ * ```
73
99
  */
74
100
  function withLayoutContext(Nav, processor) {
75
101
  return Object.assign((0, react_1.forwardRef)(({ children: userDefinedChildren, ...props }, ref) => {
@@ -1 +1 @@
1
- {"version":3,"file":"withLayoutContext.js","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAWe;AAEf,oCAAyC;AAEzC,8CAA8D;AAC9D,4CAAyC;AAEzC,SAAgB,uBAAuB,CACrC,QAAmB,EACnB,EACE,iBAAiB,EACjB,UAAU,MAKR,EAAE;IAEN,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,MAAM,cAAc,GAAU,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,gBAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAC/C,IAAI,IAAA,sBAAc,EAAC,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,eAAM,EAAE;gBAC3D,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE;oBACrB,MAAM,IAAI,KAAK,CACb,sDAAsD,UAAU,8EAA8E,CAC/I,CAAC;iBACH;gBACD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;oBACzC,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;wBAC/E,MAAM,IAAI,KAAK,CACb,sDAAsD,UAAU,yHAAyH,CAC1L,CAAC;qBACH;iBACF;gBACD,OAAO,KAAK,CAAC,KAAK,CAAC;aACpB;iBAAM;gBACL,IAAI,iBAAiB,EAAE;oBACrB,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBAC5B;qBAAM;oBACL,OAAO,CAAC,IAAI,CACV,2JAA2J,UAAU,WAAW,CACjL,CAAC;iBACH;aACF;QACH,C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AG,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAG,CAAC;IACxE,CAAC,CAAC,EACF;QACE,MAAM,EAAN,eAAM;KACP,CAKF,CAAC;AACJ,CAAC;AAtCD,8CAsCC","sourcesContent":["import { EventMapBase, NavigationState } from '@react-navigation/native';\nimport React, {\n Children,\n forwardRef,\n ComponentProps,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n ReactNode,\n RefAttributes,\n isValidElement,\n useMemo,\n} from 'react';\n\nimport { useContextKey } from '../Route';\nimport { PickPartial } from '../types';\nimport { useSortedScreens, ScreenProps } from '../useScreens';\nimport { Screen } from '../views/Screen';\n\nexport function useFilterScreenChildren(\n children: ReactNode,\n {\n isCustomNavigator,\n contextKey,\n }: {\n isCustomNavigator?: boolean;\n /** Used for sending developer hints */\n contextKey?: string;\n } = {}\n) {\n return useMemo(() => {\n const customChildren: any[] = [];\n const screens = Children.map(children, (child) => {\n if (isValidElement(child) && child && child.type === Screen) {\n if (!child.props.name) {\n throw new Error(\n `<Screen /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n if (process.env.NODE_ENV !== 'production') {\n if (['children', 'component', 'getComponent'].some((key) => key in child.props)) {\n throw new Error(\n `<Screen /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`children\\`, \\`component\\`, or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n return child.props;\n } else {\n if (isCustomNavigator) {\n customChildren.push(child);\n } else {\n console.warn(\n `Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom <Layout />. Update Layout Route at: \"app${contextKey}/_layout\"`\n );\n }\n }\n });\n\n // Add an assertion for development\n if (process.env.NODE_ENV !== 'production') {\n // Assert if names are not unique\n const names = screens?.map((screen) => screen.name);\n if (names && new Set(names).size !== names.length) {\n throw new Error('Screen names must be unique: ' + names);\n }\n }\n\n return {\n screens,\n children: customChildren,\n };\n }, [children]);\n}\n\n/**\n * Returns a navigator that automatically injects matched routes and renders nothing when there are no children.\n * Return type with `children` prop optional.\n */\nexport function withLayoutContext<\n TOptions extends object,\n T extends ComponentType<any>,\n TState extends NavigationState,\n TEventMap extends EventMapBase,\n>(\n Nav: T,\n processor?: (\n options: ScreenProps<TOptions, TState, TEventMap>[]\n ) => ScreenProps<TOptions, TState, TEventMap>[]\n) {\n return Object.assign(\n forwardRef(({ children: userDefinedChildren, ...props }: any, ref) => {\n const contextKey = useContextKey();\n\n const { screens } = useFilterScreenChildren(userDefinedChildren, {\n contextKey,\n });\n\n const processed = processor ? processor(screens ?? []) : screens;\n\n const sorted = useSortedScreens(processed ?? []);\n\n // Prevent throwing an error when there are no screens.\n if (!sorted.length) {\n return null;\n }\n\n return <Nav {...props} id={contextKey} ref={ref} children={sorted} />;\n }),\n {\n Screen,\n }\n ) as ForwardRefExoticComponent<\n PropsWithoutRef<PickPartial<ComponentProps<T>, 'children'>> & RefAttributes<unknown>\n > & {\n Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;\n };\n}\n"]}
1
+ {"version":3,"file":"withLayoutContext.js","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAWe;AAEf,oCAAyC;AAEzC,8CAA8D;AAC9D,4CAAyC;AAEzC,SAAgB,uBAAuB,CACrC,QAAmB,EACnB,EACE,iBAAiB,EACjB,UAAU,MAKR,EAAE;IAEN,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,MAAM,cAAc,GAAU,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,gBAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAC/C,IAAI,IAAA,sBAAc,EAAC,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,eAAM,EAAE;gBAC3D,IAAI,CAAC,KAAK,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,MAAM,CAAC,MAAM,CAClB,IAAA,kBAAU,EAAC,CAAC,EAAE,QAAQ,EAAE,mBAAmB,EAAE,GAAG,KAAK,EAAO,EAAE,GAAG,EAAE,EAAE;QACnE,MAAM,UAAU,GAAG,IAAA,qBAAa,GAAE,CAAC;QAEnC,MAAM,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAAC,mBAAmB,EAAE;YAC/D,UAAU;SACX,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAEjE,MAAM,MAAM,GAAG,IAAA,6BAAgB,EAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QAEjD,uDAAuD;QACvD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAG,CAAC;IACxE,CAAC,CAAC,EACF;QACE,MAAM,EAAN,eAAM;KACP,CAKF,CAAC;AACJ,CAAC;AAtCD,8CAsCC","sourcesContent":["import { EventMapBase, NavigationState } from '@react-navigation/native';\nimport React, {\n Children,\n forwardRef,\n ComponentProps,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n ReactNode,\n RefAttributes,\n isValidElement,\n useMemo,\n} from 'react';\n\nimport { useContextKey } from '../Route';\nimport { PickPartial } from '../types';\nimport { useSortedScreens, ScreenProps } from '../useScreens';\nimport { Screen } from '../views/Screen';\n\nexport function useFilterScreenChildren(\n children: ReactNode,\n {\n isCustomNavigator,\n contextKey,\n }: {\n isCustomNavigator?: boolean;\n /** Used for sending developer hints */\n contextKey?: string;\n } = {}\n) {\n return useMemo(() => {\n const customChildren: any[] = [];\n const screens = Children.map(children, (child) => {\n if (isValidElement(child) && child && child.type === Screen) {\n if (!child.props.name) {\n throw new Error(\n `<Screen /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n if (process.env.NODE_ENV !== 'production') {\n if (['children', 'component', 'getComponent'].some((key) => key in child.props)) {\n throw new Error(\n `<Screen /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`children\\`, \\`component\\`, or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n return child.props;\n } else {\n if (isCustomNavigator) {\n customChildren.push(child);\n } else {\n console.warn(\n `Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom <Layout />. Update Layout Route at: \"app${contextKey}/_layout\"`\n );\n }\n }\n });\n\n // Add an assertion for development\n if (process.env.NODE_ENV !== 'production') {\n // Assert if names are not unique\n const names = screens?.map((screen) => screen.name);\n if (names && new Set(names).size !== names.length) {\n throw new Error('Screen names must be unique: ' + names);\n }\n }\n\n return {\n screens,\n children: customChildren,\n };\n }, [children]);\n}\n\n/**\n * Returns a navigator that automatically injects matched routes and renders nothing when there are no children.\n * Return type with `children` prop optional.\n * \n * Enables use of other built-in React Navigation navigators and other navigators built with the React Navigation custom navigator API.\n *\n * @example\n * ```tsx app/_layout.tsx\n * import { ParamListBase, TabNavigationState } from \"@react-navigation/native\";\n * import {\n * createMaterialTopTabNavigator,\n * MaterialTopTabNavigationOptions,\n * MaterialTopTabNavigationEventMap,\n * } from \"@react-navigation/material-top-tabs\";\n * import { withLayoutContext } from \"expo-router\";\n * \n * const MaterialTopTabs = createMaterialTopTabNavigator();\n * \n * const ExpoRouterMaterialTopTabs = withLayoutContext<\n * MaterialTopTabNavigationOptions,\n * typeof MaterialTopTabs.Navigator,\n * TabNavigationState<ParamListBase>,\n * MaterialTopTabNavigationEventMap\n * >(MaterialTopTabs.Navigator);\n\n * export default function TabLayout() {\n * return <ExpoRouterMaterialTopTabs />;\n * }\n * ```\n */\nexport function withLayoutContext<\n TOptions extends object,\n T extends ComponentType<any>,\n TState extends NavigationState,\n TEventMap extends EventMapBase,\n>(\n Nav: T,\n processor?: (\n options: ScreenProps<TOptions, TState, TEventMap>[]\n ) => ScreenProps<TOptions, TState, TEventMap>[]\n) {\n return Object.assign(\n forwardRef(({ children: userDefinedChildren, ...props }: any, ref) => {\n const contextKey = useContextKey();\n\n const { screens } = useFilterScreenChildren(userDefinedChildren, {\n contextKey,\n });\n\n const processed = processor ? processor(screens ?? []) : screens;\n\n const sorted = useSortedScreens(processed ?? []);\n\n // Prevent throwing an error when there are no screens.\n if (!sorted.length) {\n return null;\n }\n\n return <Nav {...props} id={contextKey} ref={ref} children={sorted} />;\n }),\n {\n Screen,\n }\n ) as ForwardRefExoticComponent<\n PropsWithoutRef<PickPartial<ComponentProps<T>, 'children'>> & RefAttributes<unknown>\n > & {\n Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "4.1.0-canary-20250131-5c4e588",
3
+ "version": "4.1.0-canary-20250207-8bc5146",
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",
@@ -75,9 +75,9 @@
75
75
  ],
76
76
  "peerDependencies": {
77
77
  "@react-navigation/drawer": "^7.1.1",
78
- "expo": "53.0.0-canary-20250131-5c4e588",
79
- "expo-constants": "17.0.6-canary-20250131-5c4e588",
80
- "expo-linking": "7.1.0-canary-20250131-5c4e588",
78
+ "expo": "53.0.0-canary-20250207-8bc5146",
79
+ "expo-constants": "17.0.6-canary-20250207-8bc5146",
80
+ "expo-linking": "7.1.0-canary-20250207-8bc5146",
81
81
  "react-native-reanimated": "*",
82
82
  "react-native-safe-area-context": "*",
83
83
  "react-native-screens": "*"
@@ -103,8 +103,8 @@
103
103
  "tsd": "^0.28.1"
104
104
  },
105
105
  "dependencies": {
106
- "@expo/metro-runtime": "4.0.2-canary-20250131-5c4e588",
107
- "@expo/server": "0.5.2-canary-20250131-5c4e588",
106
+ "@expo/metro-runtime": "4.0.2-canary-20250207-8bc5146",
107
+ "@expo/server": "0.5.2-canary-20250207-8bc5146",
108
108
  "@radix-ui/react-slot": "1.0.1",
109
109
  "@react-navigation/bottom-tabs": "^7.2.0",
110
110
  "@react-navigation/native": "^7.0.14",
@@ -116,5 +116,6 @@
116
116
  "schema-utils": "^4.0.1",
117
117
  "semver": "~7.6.3",
118
118
  "server-only": "^0.0.1"
119
- }
119
+ },
120
+ "gitHead": "8bc5146852ccd7033138bac9ef8d3c41ae85a211"
120
121
  }