expo-router 4.0.8 → 4.0.10

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":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAiD,MAAM,OAAO,CAAC;AAOzF,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAqC,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE9F,MAAM,WAAW,aAAa;IAC5B,CAAC,KAAK,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;IACnD,4DAA4D;IAC5D,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;CACrC;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,UAAU,EAAE,EAAE,aAAa,QAUhF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,IAAI,eAAyD,CAAC;AAyE3E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAiD,MAAM,OAAO,CAAC;AAMzF,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAqC,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG9F,MAAM,WAAW,aAAa;IAC5B,CAAC,KAAK,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;IACnD,4DAA4D;IAC5D,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;CACrC;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,UAAU,EAAE,EAAE,aAAa,QAUhF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,IAAI,eAAyD,CAAC;AAyE3E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC"}
@@ -9,12 +9,12 @@ exports.Link = exports.Redirect = void 0;
9
9
  // `to` / `action` support removed.
10
10
  const react_1 = require("react");
11
11
  const react_native_1 = require("react-native");
12
- const LinkSlot_1 = require("./LinkSlot");
13
12
  const href_1 = require("./href");
14
13
  const useLinkToPathProps_1 = __importDefault(require("./useLinkToPathProps"));
15
14
  const hooks_1 = require("../hooks");
16
15
  const useFocusEffect_1 = require("../useFocusEffect");
17
16
  const useLinkHooks_1 = require("./useLinkHooks");
17
+ const Slot_1 = require("../ui/Slot");
18
18
  /**
19
19
  * Redirects to the `href` as soon as the component is mounted.
20
20
  *
@@ -111,7 +111,7 @@ relativeToDirectory, asChild, rel, target, download, withAnchor, ...rest }, ref)
111
111
  }
112
112
  props.onPress(e);
113
113
  };
114
- const Element = asChild ? LinkSlot_1.Slot : react_native_1.Text;
114
+ const Element = asChild ? Slot_1.Slot : react_native_1.Text;
115
115
  // Avoid using createElement directly, favoring JSX, to allow tools like NativeWind to perform custom JSX handling on native.
116
116
  return (<Element ref={ref} {...props} {...hrefAttrs} {...rest} style={style} {...react_native_1.Platform.select({
117
117
  web: {
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AACb,wFAAwF;AACxF,mCAAmC;AACnC,iCAAyF;AACzF,+CAAqE;AAErE,yCAAkC;AAClC,iCAAqC;AACrC,8EAAsD;AACtD,oCAAqC;AAErC,sDAAmD;AACnD,iDAA8F;AA2C9F;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,UAAU,EAAiB;IAC/E,MAAM,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC3B,IAAA,+BAAc,EAAC,GAAG,EAAE;QAClB,IAAI;YACF,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,mBAAmB,EAAE,UAAU,EAAE,CAAC,CAAC;SAC3D;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACtB;IACH,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC;AAVD,4BAUC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACU,QAAA,IAAI,GAAG,IAAA,kBAAU,EAAC,cAAc,CAA6B,CAAC;AAE3E,YAAI,CAAC,WAAW,GAAG,kBAAW,CAAC;AAE/B,SAAS,cAAc,CACrB,EACE,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,SAAS;AACT,yDAAyD;AACzD,mBAAmB,EACnB,OAAO,EACP,GAAG,EACH,MAAM,EACN,QAAQ,EACR,UAAU,EACV,GAAG,IAAI,EACG,EACZ,GAAuB;IAEvB,qDAAqD;IACrD,MAAM,KAAK,GAAG,IAAA,kCAAmB,EAAC,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,EAAE,OAAO;SACV;QACR,OAAO,EAAE,EAAE,OAAO,EAAE;KACrB,CAAC,CAAC,EACH,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n// Fork of @react-navigation/native Link.tsx with `href` and `replace` support added and\n// `to` / `action` support removed.\nimport { PropsWithChildren, forwardRef, useMemo, MouseEvent, ForwardedRef } from 'react';\nimport { Text, GestureResponderEvent, Platform } from 'react-native';\n\nimport { Slot } from './LinkSlot';\nimport { resolveHref } from './href';\nimport useLinkToPathProps from './useLinkToPathProps';\nimport { useRouter } from '../hooks';\nimport { Href } from '../types';\nimport { useFocusEffect } from '../useFocusEffect';\nimport { useInteropClassName, useHrefAttrs, LinkProps, WebAnchorProps } from './useLinkHooks';\n\nexport interface LinkComponent {\n (props: PropsWithChildren<LinkProps>): JSX.Element;\n /** Helper method to resolve a Href object into a string. */\n resolveHref: (href: Href) => string;\n}\n\nexport type RedirectProps = {\n /**\n * The path of the route to navigate to. It can either be:\n * - **string**: A full path like `/profile/settings` or a relative path like `../settings`.\n * - **object**: An object with a `pathname` and optional `params`. The `pathname` can be\n * a full path like `/profile/settings` or a relative path like `../settings`. The\n * params can be an object of key-value pairs.\n *\n * @example\n * ```tsx Dynamic\n * import { Redirect } from 'expo-router';\n *\n * export default function RedirectToAbout() {\n * return (\n * <Redirect href=\"/about\">About</Link>\n * );\n *}\n * ```\n */\n href: Href;\n\n /**\n * Relative URL references are either relative to the directory or the document.\n * By default, relative paths are relative to the document.\n *\n * @see [Resolving relative references in Mozilla's documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n * Replaces the initial screen with the current route.\n */\n withAnchor?: boolean;\n};\n\n/**\n * Redirects to the `href` as soon as the component is mounted.\n *\n * @example\n * ```tsx\n * import { View, Text } from 'react-native';\n * import { Redirect } from 'expo-router';\n *\n * export default function Page() {\n * const { user } = useAuth();\n *\n * if (!user) {\n * return <Redirect href=\"/login\" />;\n * }\n *\n * return (\n * <View>\n * <Text>Welcome Back!</Text>\n * </View>\n * );\n * }\n * ```\n */\nexport function Redirect({ href, relativeToDirectory, withAnchor }: RedirectProps) {\n const router = useRouter();\n useFocusEffect(() => {\n try {\n router.replace(href, { relativeToDirectory, withAnchor });\n } catch (error) {\n console.error(error);\n }\n });\n return null;\n}\n\n/**\n * Component that renders a link using [`href`](#href) to another route.\n * By default, it accepts children and wraps them in a `<Text>` component.\n *\n * Uses an anchor tag (`<a>`) on web and performs a client-side navigation to preserve\n * the state of the website and navigate faster. The web-only attributes such as `target`,\n * `rel`, and `download` are supported and passed to the anchor tag on web. See\n * [`WebAnchorProps`](#webanchorprops) for more details.\n *\n * > **Note**: Client-side navigation works with both single-page apps,\n * and [static-rendering](/router/reference/static-rendering/).\n *\n * @example\n * ```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link href=\"/about\">About</Link>\n * </View>\n * );\n *}\n * ```\n */\nexport const Link = forwardRef(ExpoRouterLink) as unknown as LinkComponent;\n\nLink.resolveHref = resolveHref;\n\nfunction ExpoRouterLink(\n {\n href,\n replace,\n push,\n dismissTo,\n // TODO: This does not prevent default on the anchor tag.\n relativeToDirectory,\n asChild,\n rel,\n target,\n download,\n withAnchor,\n ...rest\n }: LinkProps,\n ref: ForwardedRef<Text>\n) {\n // Mutate the style prop to add the className on web.\n const style = useInteropClassName(rest);\n\n // If not passing asChild, we need to forward the props to the anchor tag using React Native Web's `hrefAttrs`.\n const hrefAttrs = useHrefAttrs({ asChild, rel, target, download });\n\n const resolvedHref = useMemo(() => {\n if (href == null) {\n throw new Error('Link: href is required');\n }\n return resolveHref(href);\n }, [href]);\n\n let event;\n if (push) event = 'PUSH';\n if (replace) event = 'REPLACE';\n if (dismissTo) event = 'POP_TO';\n\n const props = useLinkToPathProps({\n href: resolvedHref,\n event,\n relativeToDirectory,\n withAnchor,\n });\n\n const onPress = (e: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => {\n if ('onPress' in rest) {\n rest.onPress?.(e);\n }\n props.onPress(e);\n };\n\n const Element = asChild ? Slot : Text;\n\n // Avoid using createElement directly, favoring JSX, to allow tools like NativeWind to perform custom JSX handling on native.\n return (\n <Element\n ref={ref}\n {...props}\n {...hrefAttrs}\n {...rest}\n style={style}\n {...Platform.select({\n web: {\n onClick: onPress,\n } as any,\n default: { onPress },\n })}\n />\n );\n}\n\nexport { LinkProps, WebAnchorProps };\n"]}
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AACb,wFAAwF;AACxF,mCAAmC;AACnC,iCAAyF;AACzF,+CAAqE;AAErE,iCAAqC;AACrC,8EAAsD;AACtD,oCAAqC;AAErC,sDAAmD;AACnD,iDAA8F;AAC9F,qCAAkC;AA2ClC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,UAAU,EAAiB;IAC/E,MAAM,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC3B,IAAA,+BAAc,EAAC,GAAG,EAAE;QAClB,IAAI;YACF,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,mBAAmB,EAAE,UAAU,EAAE,CAAC,CAAC;SAC3D;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACtB;IACH,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC;AAVD,4BAUC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACU,QAAA,IAAI,GAAG,IAAA,kBAAU,EAAC,cAAc,CAA6B,CAAC;AAE3E,YAAI,CAAC,WAAW,GAAG,kBAAW,CAAC;AAE/B,SAAS,cAAc,CACrB,EACE,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,SAAS;AACT,yDAAyD;AACzD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AI,KAAK,CAAC,CACV,IAAI,SAAS,CAAC,CACd,IAAI,IAAI,CAAC,CACT,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,IAAI,uBAAQ,CAAC,MAAM,CAAC;QAClB,GAAG,EAAE;YACH,OAAO,EAAE,OAAO;SACV;QACR,OAAO,EAAE,EAAE,OAAO,EAAE;KACrB,CAAC,CAAC,EACH,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n// Fork of @react-navigation/native Link.tsx with `href` and `replace` support added and\n// `to` / `action` support removed.\nimport { PropsWithChildren, forwardRef, useMemo, MouseEvent, ForwardedRef } from 'react';\nimport { Text, GestureResponderEvent, Platform } from 'react-native';\n\nimport { resolveHref } from './href';\nimport useLinkToPathProps from './useLinkToPathProps';\nimport { useRouter } from '../hooks';\nimport { Href } from '../types';\nimport { useFocusEffect } from '../useFocusEffect';\nimport { useInteropClassName, useHrefAttrs, LinkProps, WebAnchorProps } from './useLinkHooks';\nimport { Slot } from '../ui/Slot';\n\nexport interface LinkComponent {\n (props: PropsWithChildren<LinkProps>): JSX.Element;\n /** Helper method to resolve a Href object into a string. */\n resolveHref: (href: Href) => string;\n}\n\nexport type RedirectProps = {\n /**\n * The path of the route to navigate to. It can either be:\n * - **string**: A full path like `/profile/settings` or a relative path like `../settings`.\n * - **object**: An object with a `pathname` and optional `params`. The `pathname` can be\n * a full path like `/profile/settings` or a relative path like `../settings`. The\n * params can be an object of key-value pairs.\n *\n * @example\n * ```tsx Dynamic\n * import { Redirect } from 'expo-router';\n *\n * export default function RedirectToAbout() {\n * return (\n * <Redirect href=\"/about\">About</Link>\n * );\n *}\n * ```\n */\n href: Href;\n\n /**\n * Relative URL references are either relative to the directory or the document.\n * By default, relative paths are relative to the document.\n *\n * @see [Resolving relative references in Mozilla's documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n * Replaces the initial screen with the current route.\n */\n withAnchor?: boolean;\n};\n\n/**\n * Redirects to the `href` as soon as the component is mounted.\n *\n * @example\n * ```tsx\n * import { View, Text } from 'react-native';\n * import { Redirect } from 'expo-router';\n *\n * export default function Page() {\n * const { user } = useAuth();\n *\n * if (!user) {\n * return <Redirect href=\"/login\" />;\n * }\n *\n * return (\n * <View>\n * <Text>Welcome Back!</Text>\n * </View>\n * );\n * }\n * ```\n */\nexport function Redirect({ href, relativeToDirectory, withAnchor }: RedirectProps) {\n const router = useRouter();\n useFocusEffect(() => {\n try {\n router.replace(href, { relativeToDirectory, withAnchor });\n } catch (error) {\n console.error(error);\n }\n });\n return null;\n}\n\n/**\n * Component that renders a link using [`href`](#href) to another route.\n * By default, it accepts children and wraps them in a `<Text>` component.\n *\n * Uses an anchor tag (`<a>`) on web and performs a client-side navigation to preserve\n * the state of the website and navigate faster. The web-only attributes such as `target`,\n * `rel`, and `download` are supported and passed to the anchor tag on web. See\n * [`WebAnchorProps`](#webanchorprops) for more details.\n *\n * > **Note**: Client-side navigation works with both single-page apps,\n * and [static-rendering](/router/reference/static-rendering/).\n *\n * @example\n * ```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link href=\"/about\">About</Link>\n * </View>\n * );\n *}\n * ```\n */\nexport const Link = forwardRef(ExpoRouterLink) as unknown as LinkComponent;\n\nLink.resolveHref = resolveHref;\n\nfunction ExpoRouterLink(\n {\n href,\n replace,\n push,\n dismissTo,\n // TODO: This does not prevent default on the anchor tag.\n relativeToDirectory,\n asChild,\n rel,\n target,\n download,\n withAnchor,\n ...rest\n }: LinkProps,\n ref: ForwardedRef<Text>\n) {\n // Mutate the style prop to add the className on web.\n const style = useInteropClassName(rest);\n\n // If not passing asChild, we need to forward the props to the anchor tag using React Native Web's `hrefAttrs`.\n const hrefAttrs = useHrefAttrs({ asChild, rel, target, download });\n\n const resolvedHref = useMemo(() => {\n if (href == null) {\n throw new Error('Link: href is required');\n }\n return resolveHref(href);\n }, [href]);\n\n let event;\n if (push) event = 'PUSH';\n if (replace) event = 'REPLACE';\n if (dismissTo) event = 'POP_TO';\n\n const props = useLinkToPathProps({\n href: resolvedHref,\n event,\n relativeToDirectory,\n withAnchor,\n });\n\n const onPress = (e: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => {\n if ('onPress' in rest) {\n rest.onPress?.(e);\n }\n props.onPress(e);\n };\n\n const Element = asChild ? Slot : Text;\n\n // Avoid using createElement directly, favoring JSX, to allow tools like NativeWind to perform custom JSX handling on native.\n return (\n <Element\n ref={ref}\n {...props}\n {...hrefAttrs}\n {...rest}\n style={style}\n {...Platform.select({\n web: {\n onClick: onPress,\n } as any,\n default: { onPress },\n })}\n />\n );\n}\n\nexport { LinkProps, WebAnchorProps };\n"]}
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Slot: import("react").ForwardRefExoticComponent<import("@radix-ui/react-slot").SlotProps & import("react").RefAttributes<HTMLElement>>;
3
- //# sourceMappingURL=LinkSlot.d.ts.map
3
+ //# sourceMappingURL=Slot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Slot.d.ts","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":";AAwBA,eAAO,MAAM,IAAI,kIAAkC,CAAC"}
@@ -24,4 +24,4 @@ function ShimSlotForReactNative(Component) {
24
24
  });
25
25
  }
26
26
  exports.Slot = ShimSlotForReactNative(react_slot_1.Slot);
27
- //# sourceMappingURL=LinkSlot.js.map
27
+ //# sourceMappingURL=Slot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Slot.js","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":";;;AAAA,qDAAuD;AACvD,iCAA4C;AAC5C,+CAA0C;AAE1C;;;;;;;;;;;;GAYG;AACH,SAAS,sBAAsB,CAAC,SAAyB;IACvD,OAAO,IAAA,kBAAU,EAAC,SAAS,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;QAC3D,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,yBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,IAAI,GAAG,sBAAsB,CAAC,iBAAO,CAAC,CAAC","sourcesContent":["import { Slot as RUISlot } from '@radix-ui/react-slot';\nimport { forwardRef, useMemo } from 'react';\nimport { StyleSheet } from 'react-native';\n\n/**\n * RadixUI has special logic to handle the merging of `style` and `className` props.\n * On the web styles are not allowed so Radix does not handle this scenario.\n * This could be fixed upstream (PR open), but it may not as RN is not their target\n * platform.\n *\n * This shim calls `StyleSheet.flatten` on the styles before we render the <Slot />\n *\n * @see https://github.com/expo/expo/issues/31352\n * @see https://github.com/radix-ui/primitives/issues/3107\n * @param Component\n * @returns\n */\nfunction ShimSlotForReactNative(Component: typeof RUISlot): typeof RUISlot {\n return forwardRef(function RNSlotHOC({ style, ...props }, ref) {\n style = useMemo(() => StyleSheet.flatten(style), [style]);\n return <Component ref={ref} {...props} style={style} />;\n });\n}\n\nexport const Slot = ShimSlotForReactNative(RUISlot);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/ui/common.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,C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AAErD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3E,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,aAAa,EAAE,EACzB,eAAe,EAAE,SAAS,EAC1B,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,EACtC,gBAAgB,EAAE,SAAS,GAAG,MAAM,EACpC,gBAAgB,EAAE,UAAU,EAC5B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,MAAM;;;EAyInB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,EAClE,YAAY,CAAC,EAAE,MAAM,GACpB,sBAAsB,CAoCxB"}
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stateToAction = exports.triggersToScreens = exports.SafeAreaViewSlot = exports.ViewSlot = void 0;
4
- const react_slot_1 = require("@radix-ui/react-slot");
5
4
  const href_1 = require("../link/href");
6
5
  const sortRoutes_1 = require("../sortRoutes");
7
6
  const useScreens_1 = require("../useScreens");
7
+ const Slot_1 = require("./Slot");
8
8
  // Fix the TypeScript types for <Slot />. It complains about the ViewProps["style"]
9
- exports.ViewSlot = react_slot_1.Slot;
10
- exports.SafeAreaViewSlot = react_slot_1.Slot;
9
+ exports.ViewSlot = Slot_1.Slot;
10
+ exports.SafeAreaViewSlot = Slot_1.Slot;
11
11
  function triggersToScreens(triggers, layoutRouteNode, linking, initialRouteName, parentTriggerMap, routeInfo, contextKey) {
12
12
  const configs = [];
13
13
  for (const trigger of triggers) {
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/ui/common.tsx"],"names":[],"mappings":";;;AAAA,qDAA4C;AAO5C,uCAA0E;AAC1E,8CAAsD;AAEtD,8CA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KAAK,EAAE;QACZ,IAAI,kBAAkB,EAAE;YACtB,IAAI,OAAO,KAAK,WAAW,EAAE;gBAC3B,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;aAC3B;iBAAM;gBACL,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;aAC7B;YACD,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAEzD,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAE5D,IAAI,KAAK,EAAE;gBACT,OAAO,CAAC,MAAM,KAAK,EAAE,CAAC;gBACtB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;aAC1B;SACF;aAAM;YACL,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE;gBAC/B,kBAAkB,GAAG,IAAI,CAAC;aAC3B;YACD,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACtE,IAAI,SAAS,EAAE;gBACb,KAAK,GAAG,SAAS,CAAC;aACnB;SACF;KACF;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,WAAW;KACrB,CAAC;AACJ,CAAC;AAvCD,sCAuCC","sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport { LinkingOptions, ParamListBase, PartialRoute, Route } from '@react-navigation/native';\nimport { ViewProps, View, SafeAreaView } from 'react-native';\n\nimport type { ExpoTabActionType } from './TabRouter';\nimport { UrlObject } from '../LocationProvider';\nimport { RouteNode } from '../Route';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport { sortRoutesWithInitial } from '../sortRoutes';\nimport { Href } from '../types';\nimport { routeToScreen } from '../useScreens';\n\n// Fix the TypeScript types for <Slot />. It complains about the ViewProps[\"style\"]\nexport const ViewSlot = Slot as React.ForwardRefExoticComponent<\n ViewProps & React.RefAttributes<View>\n>;\n\nexport const SafeAreaViewSlot = Slot as React.ForwardRefExoticComponent<\n ViewProps & React.RefAttributes<SafeAreaView>\n>;\n\nexport type ScreenTrigger =\n | {\n type: 'internal';\n href: Href;\n name: string;\n }\n | {\n type: 'external';\n name: string;\n href: string;\n };\n\ntype JumpToNavigationAction = Extract<ExpoTabActionType, { type: 'JUMP_TO' }>;\ntype TriggerConfig =\n | {\n type: 'internal';\n name: string;\n href: string;\n routeNode: RouteNode;\n action: JumpToNavigationAction;\n }\n | { type: 'external'; name: string; href: string };\n\nexport type TriggerMap = Record<string, TriggerConfig & { index: number }>;\n\nexport function triggersToScreens(\n triggers: ScreenTrigger[],\n layoutRouteNode: RouteNode,\n linking: LinkingOptions<ParamListBase>,\n initialRouteName: undefined | string,\n parentTriggerMap: TriggerMap,\n routeInfo: UrlObject,\n contextKey: string\n) {\n const configs: TriggerConfig[] = [];\n\n for (const trigger of triggers) {\n if (trigger.name in parentTriggerMap) {\n const parentTrigger = parentTriggerMap[trigger.name];\n throw new Error(\n `Trigger ${JSON.stringify({\n name: trigger.name,\n href: trigger.href,\n })} has the same name as parent trigger ${JSON.stringify({\n name: parentTrigger.name,\n href: parentTrigger.href,\n })}. Triggers must have unique names.`\n );\n }\n\n if (trigger.type === 'external') {\n configs.push(trigger);\n continue;\n }\n\n let resolvedHref = resolveHref(trigger.href);\n\n if (resolvedHref.startsWith('../')) {\n throw new Error('Trigger href cannot link to a parent directory');\n }\n\n const segmentsWithoutGroups = contextKey.split('/').filter((segment) => {\n return !(segment.startsWith('(') && segment.endsWith(')'));\n });\n\n resolvedHref = resolveHrefStringWithSegments(\n resolvedHref,\n {\n ...routeInfo,\n segments: segmentsWithoutGroups,\n },\n true\n );\n\n let state = linking.getStateFromPath?.(resolvedHref, linking.config)?.routes[0];\n\n if (!state) {\n // This shouldn't occur, as you should get the global +not-found\n console.warn(\n `Unable to find screen for trigger ${JSON.stringify(trigger)}. Does this point to a valid screen?`\n );\n continue;\n }\n\n let routeState = state;\n\n // The state object is the current state from the rootNavigator\n // We need to work out the state for just this trigger\n if (layoutRouteNode.route) {\n while (state?.state) {\n const previousState = state;\n if (previousState.name === layoutRouteNode.route) break;\n state = state.state.routes[state.state.index ?? state.state.routes.length - 1];\n }\n routeState = state.state?.routes[state.state.index ?? state.state.routes.length - 1] || state;\n }\n\n const routeNode = layoutRouteNode.children.find((child) => child.route === routeState?.name);\n if (!routeNode) {\n console.warn(\n `Unable to find routeNode for trigger ${JSON.stringify(trigger)}. This might be a bug with Expo Router`\n );\n continue;\n }\n\n if (routeNode.generated && routeNode.internal && routeNode.route.includes('+not-found')) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Tab trigger '${trigger.name}' has the href '${trigger.href}' which points to a +not-found route.`\n );\n }\n continue;\n }\n\n const duplicateTrigger =\n trigger.type === 'internal' &&\n configs.find((config): config is Extract<TriggerConfig, { type: 'internal' }> => {\n if (config.type === 'external') {\n return false;\n }\n\n return config.routeNode.route === routeNode.route;\n });\n\n if (duplicateTrigger) {\n const duplicateTriggerText = `${JSON.stringify({ name: duplicateTrigger.name, href: duplicateTrigger.href })} and ${JSON.stringify({ name: trigger.name, href: trigger.href })}`;\n\n throw new Error(\n `A navigator cannot contain multiple trigger components that map to the same sub-segment. Consider adding a shared group and assigning a group to each trigger. Conflicting triggers:\\n\\t${duplicateTriggerText}.\\nBoth triggers map to route ${routeNode.route}.`\n );\n }\n\n configs.push({\n ...trigger,\n href: resolvedHref,\n routeNode,\n action: stateToAction(state, layoutRouteNode.route),\n });\n }\n\n const sortFn = sortRoutesWithInitial(initialRouteName);\n\n const sortedConfigs = configs.sort((a, b) => {\n // External routes should be last. They will eventually be dropped\n if (a.type === 'external' && b.type === 'external') {\n return 0;\n } else if (a.type === 'external') {\n return 1;\n } else if (b.type === 'external') {\n return -1;\n }\n\n return sortFn(a.routeNode, b.routeNode);\n });\n\n const children: React.JSX.Element[] = [];\n const triggerMap: TriggerMap = { ...parentTriggerMap };\n\n for (const [index, config] of sortedConfigs.entries()) {\n triggerMap[config.name] = { ...config, index };\n\n if (config.type === 'internal') {\n children.push(routeToScreen(config.routeNode));\n }\n }\n return {\n children,\n triggerMap,\n };\n}\n\nexport function stateToAction(\n state: PartialRoute<Route<string, object | undefined>> | undefined,\n startAtRoute?: string\n): JumpToNavigationAction {\n const rootPayload: any = {};\n let payload = rootPayload;\n\n let foundStartingPoint = !startAtRoute || !state?.state;\n\n while (state) {\n if (foundStartingPoint) {\n if (payload === rootPayload) {\n payload.name = state.name;\n } else {\n payload.screen = state.name;\n }\n payload.params = state.params ? { ...state.params } : {};\n\n state = state.state?.routes[state.state?.routes.length - 1];\n\n if (state) {\n payload.params ??= {};\n payload = payload.params;\n }\n } else {\n if (state.name === startAtRoute) {\n foundStartingPoint = true;\n }\n const nextState = state.state?.routes[state.state?.routes.length - 1];\n if (nextState) {\n state = nextState;\n }\n }\n }\n\n return {\n type: 'JUMP_TO',\n payload: rootPayload,\n };\n}\n"]}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/ui/common.tsx"],"names":[],"mappings":";;;AAMA,uCAA0E;AAC1E,8CAAsD;AAEtD,8CAA8C;AAC9C,iCAA8B;AAE9B,mFAAmF;AACtE,QAAA,QAAQ,GAAG,WAEvB,CAAC;AAEW,QAAA,gBAAgB,GAAG,WAE/B,CAAC;AA2BF,SAAgB,iBAAiB,CAC/B,QAAyB,EACzB,eAA0B,EAC1B,OAAsC,EACtC,gBAAoC,EACpC,gBAA4B,EAC5B,SAAoB,EACpB,UAAkB;IAElB,MAAM,OAAO,GAAoB,EAAE,CAAC;IAEpC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,IAAI,OAAO,CAAC,IAAI,IAAI,gBAAgB,EAAE;YACp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AK,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAE5D,IAAI,KAAK,EAAE;gBACT,OAAO,CAAC,MAAM,KAAK,EAAE,CAAC;gBACtB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;aAC1B;SACF;aAAM;YACL,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE;gBAC/B,kBAAkB,GAAG,IAAI,CAAC;aAC3B;YACD,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACtE,IAAI,SAAS,EAAE;gBACb,KAAK,GAAG,SAAS,CAAC;aACnB;SACF;KACF;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,WAAW;KACrB,CAAC;AACJ,CAAC;AAvCD,sCAuCC","sourcesContent":["import { LinkingOptions, ParamListBase, PartialRoute, Route } from '@react-navigation/native';\nimport { ViewProps, View, SafeAreaView } from 'react-native';\n\nimport type { ExpoTabActionType } from './TabRouter';\nimport { UrlObject } from '../LocationProvider';\nimport { RouteNode } from '../Route';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport { sortRoutesWithInitial } from '../sortRoutes';\nimport { Href } from '../types';\nimport { routeToScreen } from '../useScreens';\nimport { Slot } from './Slot';\n\n// Fix the TypeScript types for <Slot />. It complains about the ViewProps[\"style\"]\nexport const ViewSlot = Slot as React.ForwardRefExoticComponent<\n ViewProps & React.RefAttributes<View>\n>;\n\nexport const SafeAreaViewSlot = Slot as React.ForwardRefExoticComponent<\n ViewProps & React.RefAttributes<SafeAreaView>\n>;\n\nexport type ScreenTrigger =\n | {\n type: 'internal';\n href: Href;\n name: string;\n }\n | {\n type: 'external';\n name: string;\n href: string;\n };\n\ntype JumpToNavigationAction = Extract<ExpoTabActionType, { type: 'JUMP_TO' }>;\ntype TriggerConfig =\n | {\n type: 'internal';\n name: string;\n href: string;\n routeNode: RouteNode;\n action: JumpToNavigationAction;\n }\n | { type: 'external'; name: string; href: string };\n\nexport type TriggerMap = Record<string, TriggerConfig & { index: number }>;\n\nexport function triggersToScreens(\n triggers: ScreenTrigger[],\n layoutRouteNode: RouteNode,\n linking: LinkingOptions<ParamListBase>,\n initialRouteName: undefined | string,\n parentTriggerMap: TriggerMap,\n routeInfo: UrlObject,\n contextKey: string\n) {\n const configs: TriggerConfig[] = [];\n\n for (const trigger of triggers) {\n if (trigger.name in parentTriggerMap) {\n const parentTrigger = parentTriggerMap[trigger.name];\n throw new Error(\n `Trigger ${JSON.stringify({\n name: trigger.name,\n href: trigger.href,\n })} has the same name as parent trigger ${JSON.stringify({\n name: parentTrigger.name,\n href: parentTrigger.href,\n })}. Triggers must have unique names.`\n );\n }\n\n if (trigger.type === 'external') {\n configs.push(trigger);\n continue;\n }\n\n let resolvedHref = resolveHref(trigger.href);\n\n if (resolvedHref.startsWith('../')) {\n throw new Error('Trigger href cannot link to a parent directory');\n }\n\n const segmentsWithoutGroups = contextKey.split('/').filter((segment) => {\n return !(segment.startsWith('(') && segment.endsWith(')'));\n });\n\n resolvedHref = resolveHrefStringWithSegments(\n resolvedHref,\n {\n ...routeInfo,\n segments: segmentsWithoutGroups,\n },\n true\n );\n\n let state = linking.getStateFromPath?.(resolvedHref, linking.config)?.routes[0];\n\n if (!state) {\n // This shouldn't occur, as you should get the global +not-found\n console.warn(\n `Unable to find screen for trigger ${JSON.stringify(trigger)}. Does this point to a valid screen?`\n );\n continue;\n }\n\n let routeState = state;\n\n // The state object is the current state from the rootNavigator\n // We need to work out the state for just this trigger\n if (layoutRouteNode.route) {\n while (state?.state) {\n const previousState = state;\n if (previousState.name === layoutRouteNode.route) break;\n state = state.state.routes[state.state.index ?? state.state.routes.length - 1];\n }\n routeState = state.state?.routes[state.state.index ?? state.state.routes.length - 1] || state;\n }\n\n const routeNode = layoutRouteNode.children.find((child) => child.route === routeState?.name);\n if (!routeNode) {\n console.warn(\n `Unable to find routeNode for trigger ${JSON.stringify(trigger)}. This might be a bug with Expo Router`\n );\n continue;\n }\n\n if (routeNode.generated && routeNode.internal && routeNode.route.includes('+not-found')) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Tab trigger '${trigger.name}' has the href '${trigger.href}' which points to a +not-found route.`\n );\n }\n continue;\n }\n\n const duplicateTrigger =\n trigger.type === 'internal' &&\n configs.find((config): config is Extract<TriggerConfig, { type: 'internal' }> => {\n if (config.type === 'external') {\n return false;\n }\n\n return config.routeNode.route === routeNode.route;\n });\n\n if (duplicateTrigger) {\n const duplicateTriggerText = `${JSON.stringify({ name: duplicateTrigger.name, href: duplicateTrigger.href })} and ${JSON.stringify({ name: trigger.name, href: trigger.href })}`;\n\n throw new Error(\n `A navigator cannot contain multiple trigger components that map to the same sub-segment. Consider adding a shared group and assigning a group to each trigger. Conflicting triggers:\\n\\t${duplicateTriggerText}.\\nBoth triggers map to route ${routeNode.route}.`\n );\n }\n\n configs.push({\n ...trigger,\n href: resolvedHref,\n routeNode,\n action: stateToAction(state, layoutRouteNode.route),\n });\n }\n\n const sortFn = sortRoutesWithInitial(initialRouteName);\n\n const sortedConfigs = configs.sort((a, b) => {\n // External routes should be last. They will eventually be dropped\n if (a.type === 'external' && b.type === 'external') {\n return 0;\n } else if (a.type === 'external') {\n return 1;\n } else if (b.type === 'external') {\n return -1;\n }\n\n return sortFn(a.routeNode, b.routeNode);\n });\n\n const children: React.JSX.Element[] = [];\n const triggerMap: TriggerMap = { ...parentTriggerMap };\n\n for (const [index, config] of sortedConfigs.entries()) {\n triggerMap[config.name] = { ...config, index };\n\n if (config.type === 'internal') {\n children.push(routeToScreen(config.routeNode));\n }\n }\n return {\n children,\n triggerMap,\n };\n}\n\nexport function stateToAction(\n state: PartialRoute<Route<string, object | undefined>> | undefined,\n startAtRoute?: string\n): JumpToNavigationAction {\n const rootPayload: any = {};\n let payload = rootPayload;\n\n let foundStartingPoint = !startAtRoute || !state?.state;\n\n while (state) {\n if (foundStartingPoint) {\n if (payload === rootPayload) {\n payload.name = state.name;\n } else {\n payload.screen = state.name;\n }\n payload.params = state.params ? { ...state.params } : {};\n\n state = state.state?.routes[state.state?.routes.length - 1];\n\n if (state) {\n payload.params ??= {};\n payload = payload.params;\n }\n } else {\n if (state.name === startAtRoute) {\n foundStartingPoint = true;\n }\n const nextState = state.state?.routes[state.state?.routes.length - 1];\n if (nextState) {\n state = nextState;\n }\n }\n }\n\n return {\n type: 'JUMP_TO',\n payload: rootPayload,\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "4.0.8",
3
+ "version": "4.0.10",
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",
@@ -117,5 +117,5 @@
117
117
  "semver": "~7.6.3",
118
118
  "server-only": "^0.0.1"
119
119
  },
120
- "gitHead": "eb0d9b5b6ba8dd5b64e016e41166e42ced543a69"
120
+ "gitHead": "728158f99d680cf64fb06f08301d3806c18c6f63"
121
121
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"LinkSlot.d.ts","sourceRoot":"","sources":["../../src/link/LinkSlot.tsx"],"names":[],"mappings":";AAwBA,eAAO,MAAM,IAAI,kIAAkC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LinkSlot.js","sourceRoot":"","sources":["../../src/link/LinkSlot.tsx"],"names":[],"mappings":";;;AAAA,qDAAuD;AACvD,iCAA4C;AAC5C,+CAA0C;AAE1C;;;;;;;;;;;;GAYG;AACH,SAAS,sBAAsB,CAAC,SAAyB;IACvD,OAAO,IAAA,kBAAU,EAAC,SAAS,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;QAC3D,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,yBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,IAAI,GAAG,sBAAsB,CAAC,iBAAO,CAAC,CAAC","sourcesContent":["import { Slot as RUISlot } from '@radix-ui/react-slot';\nimport { forwardRef, useMemo } from 'react';\nimport { StyleSheet } from 'react-native';\n\n/**\n * RadixUI has special logic to handle the merging of `style` and `className` props.\n * On the web styles are not allowed so Radix does not handle this scenario.\n * This could be fixed upstream (PR open), but it may not as RN is not their target\n * platform.\n *\n * This shim calls `StyleSheet.flatten` on the styles before we render the <Slot />\n *\n * @see https://github.com/expo/expo/issues/31352\n * @see https://github.com/radix-ui/primitives/issues/3107\n * @param Component\n * @returns\n */\nfunction ShimSlotForReactNative(Component: typeof RUISlot): typeof RUISlot {\n return forwardRef(function RNSlotHOC({ style, ...props }, ref) {\n style = useMemo(() => StyleSheet.flatten(style), [style]);\n return <Component ref={ref} {...props} style={style} />;\n });\n}\n\nexport const Slot = ShimSlotForReactNative(RUISlot);\n"]}