first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
import React from 'react';
import { LinkProps } from './useLinkHooks';
export declare function BaseExpoRouterLink({ href, replace, push, dismissTo, relativeToDirectory, asChild, rel, target, download, withAnchor, dangerouslySingular: singular, prefetch, ...rest }: LinkProps): React.JSX.Element;
//# sourceMappingURL=BaseExpoRouterLink.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BaseExpoRouterLink.d.ts","sourceRoot":"","sources":["../../src/link/BaseExpoRouterLink.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmC,MAAM,OAAO,CAAC;AAKxD,OAAO,EAAqC,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK9E,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,SAAS,EAET,mBAAmB,EACnB,OAAO,EACP,GAAG,EACH,MAAM,EACN,QAAQ,EACR,UAAU,EACV,mBAAmB,EAAE,QAAQ,EAC7B,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,SAAS,qBAuEX"}

View File

@@ -0,0 +1,104 @@
"use strict";
'use client';
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseExpoRouterLink = BaseExpoRouterLink;
// Fork of @react-navigation/native Link.tsx with `href` and `replace` support added and
// `to` / `action` support removed.
const react_1 = __importStar(require("react"));
const react_native_1 = require("react-native");
const InternalLinkPreviewContext_1 = require("./InternalLinkPreviewContext");
const href_1 = require("./href");
const useLinkHooks_1 = require("./useLinkHooks");
const useLinkToPathProps_1 = __importDefault(require("./useLinkToPathProps"));
const Prefetch_1 = require("../Prefetch");
const Slot_1 = require("../ui/Slot");
function BaseExpoRouterLink({ href, replace, push, dismissTo,
// TODO: This does not prevent default on the anchor tag.
relativeToDirectory, asChild, rel, target, download, withAnchor, dangerouslySingular: singular, prefetch, ...rest }) {
// Mutate the style prop to add the className on web.
const style = (0, useLinkHooks_1.useInteropClassName)(rest);
// If not passing asChild, we need to forward the props to the anchor tag using React Native Web's `hrefAttrs`.
const hrefAttrs = (0, useLinkHooks_1.useHrefAttrs)({ asChild, rel, target, download });
const resolvedHref = (0, react_1.useMemo)(() => {
if (href == null) {
throw new Error('Link: href is required');
}
return (0, href_1.resolveHref)(href);
}, [href]);
let event;
if (push)
event = 'PUSH';
if (replace)
event = 'REPLACE';
if (dismissTo)
event = 'POP_TO';
const previewContext = (0, react_1.use)(InternalLinkPreviewContext_1.InternalLinkPreviewContext);
const props = (0, useLinkToPathProps_1.default)({
href: resolvedHref,
event,
relativeToDirectory,
withAnchor,
dangerouslySingular: singular,
});
const onPress = (e) => {
if (previewContext?.blockPressRef.current) {
return;
}
if ('onPress' in rest) {
rest.onPress?.(e);
}
props.onPress(e);
};
const Component = asChild ? Slot_1.Slot : react_native_1.Text;
if (asChild && react_1.default.Children.count(rest.children) > 1) {
throw new Error('Link: When using `asChild`, you must pass a single child element that will emit the `onPress` event.');
}
// Avoid using createElement directly, favoring JSX, to allow tools like NativeWind to perform custom JSX handling on native.
const element = (<Component {...props} {...hrefAttrs} {...rest} style={style} {...react_native_1.Platform.select({
web: {
onClick: onPress,
},
default: { onPress },
})}/>);
return prefetch ? (<>
<Prefetch_1.Prefetch href={href}/>
{element}
</>) : (element);
}
//# sourceMappingURL=BaseExpoRouterLink.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BaseExpoRouterLink.js","sourceRoot":"","sources":["../../src/link/BaseExpoRouterLink.tsx"],"names":[],"mappings":"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","sourcesContent":["'use client';\n// Fork of @react-navigation/native Link.tsx with `href` and `replace` support added and\n// `to` / `action` support removed.\nimport React, { useMemo, MouseEvent, use } from 'react';\nimport { Text, GestureResponderEvent, Platform } from 'react-native';\n\nimport { InternalLinkPreviewContext } from './InternalLinkPreviewContext';\nimport { resolveHref } from './href';\nimport { useInteropClassName, useHrefAttrs, LinkProps } from './useLinkHooks';\nimport useLinkToPathProps from './useLinkToPathProps';\nimport { Prefetch } from '../Prefetch';\nimport { Slot } from '../ui/Slot';\n\nexport function BaseExpoRouterLink({\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 dangerouslySingular: singular,\n prefetch,\n ...rest\n}: LinkProps) {\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 previewContext = use(InternalLinkPreviewContext);\n\n const props = useLinkToPathProps({\n href: resolvedHref,\n event,\n relativeToDirectory,\n withAnchor,\n dangerouslySingular: singular,\n });\n\n const onPress = (e: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => {\n if (previewContext?.blockPressRef.current) {\n return;\n }\n if ('onPress' in rest) {\n rest.onPress?.(e);\n }\n props.onPress(e);\n };\n\n const Component = asChild ? Slot : Text;\n\n if (asChild && React.Children.count(rest.children) > 1) {\n throw new Error(\n 'Link: When using `asChild`, you must pass a single child element that will emit the `onPress` event.'\n );\n }\n\n // Avoid using createElement directly, favoring JSX, to allow tools like NativeWind to perform custom JSX handling on native.\n const element = (\n <Component\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 return prefetch ? (\n <>\n <Prefetch href={href} />\n {element}\n </>\n ) : (\n element\n );\n}\n"]}

4
node_modules/expo-router/build/link/ExpoLink.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import React from 'react';
import { LinkProps } from './useLinkHooks';
export declare function ExpoLink(props: LinkProps): React.JSX.Element;
//# sourceMappingURL=ExpoLink.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoLink.d.ts","sourceRoot":"","sources":["../../src/link/ExpoLink.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmC,MAAM,OAAO,CAAC;AAMxD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,qBAMxC"}

70
node_modules/expo-router/build/link/ExpoLink.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
"use strict";
'use client';
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpoLink = ExpoLink;
const react_1 = __importStar(require("react"));
const BaseExpoRouterLink_1 = require("./BaseExpoRouterLink");
const LinkWithPreview_1 = require("./LinkWithPreview");
const elements_1 = require("./elements");
const PreviewRouteContext_1 = require("./preview/PreviewRouteContext");
const useZoomHref_1 = require("./zoom/useZoomHref");
const url_1 = require("../utils/url");
const zoom_transition_context_providers_1 = require("./zoom/zoom-transition-context-providers");
function ExpoLink(props) {
return (<zoom_transition_context_providers_1.ZoomTransitionSourceContextProvider linkProps={props}>
<ExpoLinkImpl {...props}/>
</zoom_transition_context_providers_1.ZoomTransitionSourceContextProvider>);
}
function ExpoLinkImpl(props) {
const isPreview = (0, PreviewRouteContext_1.useIsPreview)();
const href = (0, useZoomHref_1.useZoomHref)(props);
const shouldUseLinkWithPreview = process.env.EXPO_OS === 'ios' && isLinkWithPreview(props) && !isPreview;
if (shouldUseLinkWithPreview) {
return <LinkWithPreview_1.LinkWithPreview {...props} href={href} hrefForPreviewNavigation={props.href}/>;
}
let children = props.children;
if (react_1.default.Children.count(props.children) > 1) {
const arrayChildren = react_1.default.Children.toArray(props.children).filter((child) => !(0, react_1.isValidElement)(child) || (child.type !== elements_1.LinkPreview && child.type !== elements_1.LinkMenu));
children = arrayChildren.length === 1 ? arrayChildren[0] : props.children;
}
return <BaseExpoRouterLink_1.BaseExpoRouterLink {...props} href={href} children={children}/>;
}
function isLinkWithPreview(props) {
const isExternal = (0, url_1.shouldLinkExternally)(String(props.href));
return react_1.Children.toArray(props.children).some((child) => (0, react_1.isValidElement)(child) &&
((!isExternal && child.type === elements_1.LinkPreview) || child.type === elements_1.LinkMenu));
}
//# sourceMappingURL=ExpoLink.js.map

1
node_modules/expo-router/build/link/ExpoLink.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoLink.js","sourceRoot":"","sources":["../../src/link/ExpoLink.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAab,4BAMC;AAjBD,+CAAwD;AAExD,6DAA0D;AAC1D,uDAAoD;AACpD,yCAAmD;AACnD,uEAA6D;AAE7D,oDAAiD;AACjD,sCAAoD;AACpD,gGAA+F;AAE/F,SAAgB,QAAQ,CAAC,KAAgB;IACvC,OAAO,CACL,CAAC,uEAAmC,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CACpD;MAAA,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,EAC1B;IAAA,EAAE,uEAAmC,CAAC,CACvC,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAgB;IACpC,MAAM,SAAS,GAAG,IAAA,kCAAY,GAAE,CAAC;IACjC,MAAM,IAAI,GAAG,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC;IAChC,MAAM,wBAAwB,GAC5B,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;IAC1E,IAAI,wBAAwB,EAAE,CAAC;QAC7B,OAAO,CAAC,iCAAe,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,wBAAwB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;IAC1F,CAAC;IACD,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC9B,IAAI,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,aAAa,GAAG,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CACjE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,sBAAW,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAQ,CAAC,CAC7F,CAAC;QACF,QAAQ,GAAG,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC5E,CAAC;IAED,OAAO,CAAC,uCAAkB,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAG,CAAC;AAC3E,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAgB;IACzC,MAAM,UAAU,GAAG,IAAA,0BAAoB,EAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,OAAO,gBAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAC1C,CAAC,KAAK,EAAE,EAAE,CACR,IAAA,sBAAc,EAAC,KAAK,CAAC;QACrB,CAAC,CAAC,CAAC,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,sBAAW,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAQ,CAAC,CAC3E,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport React, { Children, isValidElement } from 'react';\n\nimport { BaseExpoRouterLink } from './BaseExpoRouterLink';\nimport { LinkWithPreview } from './LinkWithPreview';\nimport { LinkMenu, LinkPreview } from './elements';\nimport { useIsPreview } from './preview/PreviewRouteContext';\nimport { LinkProps } from './useLinkHooks';\nimport { useZoomHref } from './zoom/useZoomHref';\nimport { shouldLinkExternally } from '../utils/url';\nimport { ZoomTransitionSourceContextProvider } from './zoom/zoom-transition-context-providers';\n\nexport function ExpoLink(props: LinkProps) {\n return (\n <ZoomTransitionSourceContextProvider linkProps={props}>\n <ExpoLinkImpl {...props} />\n </ZoomTransitionSourceContextProvider>\n );\n}\n\nfunction ExpoLinkImpl(props: LinkProps) {\n const isPreview = useIsPreview();\n const href = useZoomHref(props);\n const shouldUseLinkWithPreview =\n process.env.EXPO_OS === 'ios' && isLinkWithPreview(props) && !isPreview;\n if (shouldUseLinkWithPreview) {\n return <LinkWithPreview {...props} href={href} hrefForPreviewNavigation={props.href} />;\n }\n let children = props.children;\n if (React.Children.count(props.children) > 1) {\n const arrayChildren = React.Children.toArray(props.children).filter(\n (child) => !isValidElement(child) || (child.type !== LinkPreview && child.type !== LinkMenu)\n );\n children = arrayChildren.length === 1 ? arrayChildren[0] : props.children;\n }\n\n return <BaseExpoRouterLink {...props} href={href} children={children} />;\n}\n\nfunction isLinkWithPreview(props: LinkProps): boolean {\n const isExternal = shouldLinkExternally(String(props.href));\n return Children.toArray(props.children).some(\n (child) =>\n isValidElement(child) &&\n ((!isExternal && child.type === LinkPreview) || child.type === LinkMenu)\n );\n}\n"]}

View File

@@ -0,0 +1,9 @@
import { type RefObject } from 'react';
import type { LinkProps } from './useLinkHooks';
export type InternalLinkPreviewContextValue = {
isVisible: boolean;
href: LinkProps['href'];
blockPressRef: RefObject<boolean>;
};
export declare const InternalLinkPreviewContext: import("react").Context<InternalLinkPreviewContextValue | undefined>;
//# sourceMappingURL=InternalLinkPreviewContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"InternalLinkPreviewContext.d.ts","sourceRoot":"","sources":["../../src/link/InternalLinkPreviewContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACxB,aAAa,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,0BAA0B,sEAE3B,CAAC"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InternalLinkPreviewContext = void 0;
const react_1 = require("react");
exports.InternalLinkPreviewContext = (0, react_1.createContext)(undefined);
//# sourceMappingURL=InternalLinkPreviewContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"InternalLinkPreviewContext.js","sourceRoot":"","sources":["../../src/link/InternalLinkPreviewContext.ts"],"names":[],"mappings":";;;AAAA,iCAAsD;AAUzC,QAAA,0BAA0B,GAAG,IAAA,qBAAa,EAErD,SAAS,CAAC,CAAC","sourcesContent":["import { createContext, type RefObject } from 'react';\n\nimport type { LinkProps } from './useLinkHooks';\n\nexport type InternalLinkPreviewContextValue = {\n isVisible: boolean;\n href: LinkProps['href'];\n blockPressRef: RefObject<boolean>;\n};\n\nexport const InternalLinkPreviewContext = createContext<\n InternalLinkPreviewContextValue | undefined\n>(undefined);\n"]}

17
node_modules/expo-router/build/link/Link.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { LinkMenuAction, LinkPreview, LinkTrigger } from './elements';
import type { LinkProps, WebAnchorProps } from './useLinkHooks';
import { LinkAppleZoom } from './zoom/link-apple-zoom';
import { LinkAppleZoomTarget } from './zoom/link-apple-zoom-target';
export declare const Link: ((props: LinkProps) => import("react").JSX.Element) & {
resolveHref: (href: import("..").Href) => string;
Menu: (props: import("./elements").LinkMenuProps) => import("react").JSX.Element | null;
Trigger: typeof LinkTrigger;
Preview: typeof LinkPreview;
MenuAction: typeof LinkMenuAction;
AppleZoom: typeof LinkAppleZoom;
AppleZoomTarget: typeof LinkAppleZoomTarget;
};
export type LinkComponent = typeof Link;
export { LinkProps, WebAnchorProps };
export { Redirect, RedirectProps } from './Redirect';
//# sourceMappingURL=Link.d.ts.map

1
node_modules/expo-router/build/link/Link.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhF,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,eAAO,MAAM,IAAI,WA2BM,SAAS;;;;;;;;CAa/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,IAAI,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}

50
node_modules/expo-router/build/link/Link.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Redirect = exports.Link = void 0;
const ExpoLink_1 = require("./ExpoLink");
const elements_1 = require("./elements");
const href_1 = require("./href");
const link_apple_zoom_1 = require("./zoom/link-apple-zoom");
const link_apple_zoom_target_1 = require("./zoom/link-apple-zoom-target");
exports.Link = Object.assign(
/**
* Component that renders a link using [`href`](#href) to another route.
* By default, it accepts children and wraps them in a `<Text>` component.
*
* Uses an anchor tag (`<a>`) on web and performs a client-side navigation to preserve
* the state of the website and navigate faster. The web-only attributes such as `target`,
* `rel`, and `download` are supported and passed to the anchor tag on web. See
* [`WebAnchorProps`](#webanchorprops) for more details.
*
* > **Note**: Client-side navigation works with both single-page apps,
* and [static-rendering](/router/reference/static-rendering/).
*
* @example
* ```tsx
* import { Link } from 'expo-router';
* import { View } from 'react-native';
*
* export default function Route() {
* return (
* <View>
* <Link href="/about">About</Link>
* </View>
* );
*}
* ```
*/
function Link(props) {
// Re-exporting ExpoLink here so that Link.* can be used in server components.
return <ExpoLink_1.ExpoLink {...props}/>;
}, {
resolveHref: href_1.resolveHref,
Menu: elements_1.LinkMenu,
Trigger: elements_1.LinkTrigger,
Preview: elements_1.LinkPreview,
MenuAction: elements_1.LinkMenuAction,
AppleZoom: link_apple_zoom_1.LinkAppleZoom,
AppleZoomTarget: link_apple_zoom_target_1.LinkAppleZoomTarget,
});
var Redirect_1 = require("./Redirect");
Object.defineProperty(exports, "Redirect", { enumerable: true, get: function () { return Redirect_1.Redirect; } });
//# sourceMappingURL=Link.js.map

1
node_modules/expo-router/build/link/Link.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,yCAAgF;AAChF,iCAAqC;AAErC,4DAAuD;AACvD,0EAAoE;AAEvD,QAAA,IAAI,GAAG,MAAM,CAAC,MAAM;AAC/B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAS,IAAI,CAAC,KAAgB;IAC5B,8EAA8E;IAC9E,OAAO,CAAC,mBAAQ,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACjC,CAAC,EACD;IACE,WAAW,EAAX,kBAAW;IACX,IAAI,EAAE,mBAAQ;IACd,OAAO,EAAE,sBAAW;IACpB,OAAO,EAAE,sBAAW;IACpB,UAAU,EAAE,yBAAc;IAC1B,SAAS,EAAE,+BAAa;IACxB,eAAe,EAAE,4CAAmB;CACrC,CACF,CAAC;AAKF,uCAAqD;AAA5C,oGAAA,QAAQ,OAAA","sourcesContent":["import { ExpoLink } from './ExpoLink';\nimport { LinkMenu, LinkMenuAction, LinkPreview, LinkTrigger } from './elements';\nimport { resolveHref } from './href';\nimport type { LinkProps, WebAnchorProps } from './useLinkHooks';\nimport { LinkAppleZoom } from './zoom/link-apple-zoom';\nimport { LinkAppleZoomTarget } from './zoom/link-apple-zoom-target';\n\nexport const Link = Object.assign(\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 */\n function Link(props: LinkProps) {\n // Re-exporting ExpoLink here so that Link.* can be used in server components.\n return <ExpoLink {...props} />;\n },\n {\n resolveHref,\n Menu: LinkMenu,\n Trigger: LinkTrigger,\n Preview: LinkPreview,\n MenuAction: LinkMenuAction,\n AppleZoom: LinkAppleZoom,\n AppleZoomTarget: LinkAppleZoomTarget,\n }\n);\n\nexport type LinkComponent = typeof Link;\n\nexport { LinkProps, WebAnchorProps };\nexport { Redirect, RedirectProps } from './Redirect';\n"]}

View File

@@ -0,0 +1,9 @@
import React from 'react';
import type { Href } from '../types';
import { LinkProps } from './useLinkHooks';
interface LinkWithPreviewProps extends LinkProps {
hrefForPreviewNavigation: Href;
}
export declare function LinkWithPreview({ children, ...rest }: LinkWithPreviewProps): React.JSX.Element;
export {};
//# sourceMappingURL=LinkWithPreview.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LinkWithPreview.d.ts","sourceRoot":"","sources":["../../src/link/LinkWithPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+C,MAAM,OAAO,CAAC;AASpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAM3C,UAAU,oBAAqB,SAAQ,SAAS;IAC9C,wBAAwB,EAAE,IAAI,CAAC;CAChC;AAED,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,oBAAoB,qBAkI1E"}

141
node_modules/expo-router/build/link/LinkWithPreview.js generated vendored Normal file
View File

@@ -0,0 +1,141 @@
"use strict";
'use client';
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkWithPreview = LinkWithPreview;
const react_1 = __importStar(require("react"));
const react_native_1 = require("react-native");
const hooks_1 = require("../hooks");
const BaseExpoRouterLink_1 = require("./BaseExpoRouterLink");
const InternalLinkPreviewContext_1 = require("./InternalLinkPreviewContext");
const NativeMenuContext_1 = require("./NativeMenuContext");
const elements_1 = require("./elements");
const href_1 = require("./href");
const LinkPreviewContext_1 = require("./preview/LinkPreviewContext");
const native_1 = require("./preview/native");
const useNextScreenId_1 = require("./preview/useNextScreenId");
const children_1 = require("../utils/children");
const url_1 = require("../utils/url");
const isPad = react_native_1.Platform.OS === 'ios' && react_native_1.Platform.isPad;
function LinkWithPreview({ children, ...rest }) {
const router = (0, hooks_1.useRouter)();
const { setOpenPreviewKey } = (0, LinkPreviewContext_1.useLinkPreviewContext)();
const [isCurrentPreviewOpen, setIsCurrenPreviewOpen] = (0, react_1.useState)(false);
const hrefWithoutQuery = (0, href_1.resolveHref)(rest.hrefForPreviewNavigation).split('?')[0];
const prevHrefWithoutQuery = (0, react_1.useRef)(hrefWithoutQuery);
(0, react_1.useEffect)(() => {
if (isCurrentPreviewOpen) {
if (prevHrefWithoutQuery.current !== hrefWithoutQuery) {
throw new Error('Link does not support changing the href prop after the preview has been opened. Please ensure that the href prop is stable and does not change between renders.');
}
}
else {
prevHrefWithoutQuery.current = hrefWithoutQuery;
}
}, [hrefWithoutQuery]);
const [{ nextScreenId, tabPath }, prefetch] = (0, useNextScreenId_1.useNextScreenId)();
(0, react_1.useEffect)(() => {
if (rest.replace) {
if (process.env.NODE_ENV !== 'production') {
throw new Error('Using replace links with preview is not supported');
}
else {
console.warn('Using replace links with preview is not supported');
}
}
}, [rest.href, rest.replace]);
const triggerElement = react_1.default.useMemo(() => (0, children_1.getFirstChildOfType)(children, elements_1.LinkTrigger), [children]);
const menuElement = react_1.default.useMemo(() => (0, children_1.getFirstChildOfType)(children, elements_1.LinkMenu), [children]);
const previewElement = react_1.default.useMemo(() => (0, children_1.getFirstChildOfType)(children, elements_1.LinkPreview), [children]);
if ((previewElement || menuElement) && !triggerElement) {
if (process.env.NODE_ENV !== 'production') {
throw new Error('When you use Link.Preview, you must use Link.Trigger to specify the trigger element.');
}
else {
console.warn('When you use Link.Preview, you must use Link.Trigger to specify the trigger element.');
}
}
const trigger = react_1.default.useMemo(() => triggerElement ?? <elements_1.LinkTrigger>{children}</elements_1.LinkTrigger>, [triggerElement, children]);
const preview = react_1.default.useMemo(() => ((0, url_1.shouldLinkExternally)(String(rest.href)) || !previewElement ? null : previewElement), [previewElement, rest.href]);
const isPreviewTapped = (0, react_1.useRef)(false);
const blockPressRef = (0, react_1.useRef)(false);
const tabPathValue = (0, react_1.useMemo)(() => ({
path: tabPath,
}), [tabPath]);
const hasPreview = !!previewElement;
if (rest.replace) {
return <BaseExpoRouterLink_1.BaseExpoRouterLink children={children} {...rest}/>;
}
return (<native_1.NativeLinkPreview nextScreenId={isPad ? undefined : nextScreenId} tabPath={isPad ? undefined : tabPathValue} onWillPreviewOpen={() => {
if (hasPreview) {
blockPressRef.current = true;
isPreviewTapped.current = false;
prefetch(rest.href);
setIsCurrenPreviewOpen(true);
}
}} onPreviewWillClose={() => {
if (hasPreview) {
setIsCurrenPreviewOpen(false);
// When preview was not tapped, then we need to enable the screen stack animation
// Otherwise this will happen in StackNavigator, when new screen is opened
if (!isPreviewTapped.current || isPad) {
setOpenPreviewKey(undefined);
}
}
}} onPreviewDidClose={() => {
blockPressRef.current = false;
if (hasPreview && isPreviewTapped.current && isPad) {
router.navigate(rest.href, { __internal__PreviewKey: nextScreenId });
}
}} onPreviewTapped={() => {
isPreviewTapped.current = true;
if (!isPad) {
router.navigate(rest.href, { __internal__PreviewKey: nextScreenId });
}
}} style={{ display: 'contents' }} disableForceFlatten>
<NativeMenuContext_1.NativeMenuContext value>
<InternalLinkPreviewContext_1.InternalLinkPreviewContext value={{
isVisible: isCurrentPreviewOpen,
href: rest.hrefForPreviewNavigation,
blockPressRef,
}}>
<BaseExpoRouterLink_1.BaseExpoRouterLink {...rest} children={trigger} ref={rest.ref}/>
{preview}
{menuElement}
</InternalLinkPreviewContext_1.InternalLinkPreviewContext>
</NativeMenuContext_1.NativeMenuContext>
</native_1.NativeLinkPreview>);
}
//# sourceMappingURL=LinkWithPreview.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
/**
* Context to indicate if native menu in toolbar or link preview can be used.
*/
export declare const NativeMenuContext: import("react").Context<boolean>;
//# sourceMappingURL=NativeMenuContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeMenuContext.d.ts","sourceRoot":"","sources":["../../src/link/NativeMenuContext.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,iBAAiB,kCAAgC,CAAC"}

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NativeMenuContext = void 0;
const react_1 = require("react");
/**
* Context to indicate if native menu in toolbar or link preview can be used.
*/
exports.NativeMenuContext = (0, react_1.createContext)(false);
//# sourceMappingURL=NativeMenuContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeMenuContext.js","sourceRoot":"","sources":["../../src/link/NativeMenuContext.tsx"],"names":[],"mappings":";;;AAAA,iCAAsC;AAEtC;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,qBAAa,EAAU,KAAK,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\n/**\n * Context to indicate if native menu in toolbar or link preview can be used.\n */\nexport const NativeMenuContext = createContext<boolean>(false);\n"]}

58
node_modules/expo-router/build/link/Redirect.d.ts generated vendored Normal file
View File

@@ -0,0 +1,58 @@
import type { Href } from '../types';
export type RedirectProps = {
/**
* The path of the route to navigate to. It can either be:
* - **string**: A full path like `/profile/settings` or a relative path like `../settings`.
* - **object**: An object with a `pathname` and optional `params`. The `pathname` can be
* a full path like `/profile/settings` or a relative path like `../settings`. The
* params can be an object of key-value pairs.
*
* @example
* ```tsx Dynamic
* import { Redirect } from 'expo-router';
*
* export default function RedirectToAbout() {
* return (
* <Redirect href="/about" />
* );
*}
* ```
*/
href: Href;
/**
* Relative URL references are either relative to the directory or the document.
* By default, relative paths are relative to the document.
*
* @see [Resolving relative references in Mozilla's documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).
*/
relativeToDirectory?: boolean;
/**
* Replaces the initial screen with the current route.
*/
withAnchor?: boolean;
};
/**
* Redirects to the `href` as soon as the component is mounted.
*
* @example
* ```tsx
* import { View, Text } from 'react-native';
* import { Redirect } from 'expo-router';
*
* export default function Page() {
* const { user } = useAuth();
*
* if (!user) {
* return <Redirect href="/login" />;
* }
*
* return (
* <View>
* <Text>Welcome Back!</Text>
* </View>
* );
* }
* ```
*/
export declare function Redirect({ href, relativeToDirectory, withAnchor }: RedirectProps): null;
//# sourceMappingURL=Redirect.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Redirect.d.ts","sourceRoot":"","sources":["../../src/link/Redirect.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIrC,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,QAahF"}

46
node_modules/expo-router/build/link/Redirect.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
"use strict";
'use client';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Redirect = Redirect;
const hooks_1 = require("../hooks");
const useFocusEffect_1 = require("../useFocusEffect");
const PreviewRouteContext_1 = require("./preview/PreviewRouteContext");
/**
* Redirects to the `href` as soon as the component is mounted.
*
* @example
* ```tsx
* import { View, Text } from 'react-native';
* import { Redirect } from 'expo-router';
*
* export default function Page() {
* const { user } = useAuth();
*
* if (!user) {
* return <Redirect href="/login" />;
* }
*
* return (
* <View>
* <Text>Welcome Back!</Text>
* </View>
* );
* }
* ```
*/
function Redirect({ href, relativeToDirectory, withAnchor }) {
const router = (0, hooks_1.useRouter)();
const isPreview = (0, PreviewRouteContext_1.useIsPreview)();
(0, useFocusEffect_1.useFocusEffect)(() => {
if (!isPreview) {
try {
router.replace(href, { relativeToDirectory, withAnchor });
}
catch (error) {
console.error(error);
}
}
});
return null;
}
//# sourceMappingURL=Redirect.js.map

1
node_modules/expo-router/build/link/Redirect.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Redirect.js","sourceRoot":"","sources":["../../src/link/Redirect.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAiEb,4BAaC;AA5ED,oCAAqC;AAErC,sDAAmD;AACnD,uEAA6D;AAqC7D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,UAAU,EAAiB;IAC/E,MAAM,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC3B,MAAM,SAAS,GAAG,IAAA,kCAAY,GAAE,CAAC;IACjC,IAAA,+BAAc,EAAC,GAAG,EAAE;QAClB,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,IAAI,CAAC;gBACH,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,mBAAmB,EAAE,UAAU,EAAE,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["'use client';\n\nimport { useRouter } from '../hooks';\nimport type { Href } from '../types';\nimport { useFocusEffect } from '../useFocusEffect';\nimport { useIsPreview } from './preview/PreviewRouteContext';\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\" />\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 const isPreview = useIsPreview();\n useFocusEffect(() => {\n if (!isPreview) {\n try {\n router.replace(href, { relativeToDirectory, withAnchor });\n } catch (error) {\n console.error(error);\n }\n }\n });\n return null;\n}\n"]}

279
node_modules/expo-router/build/link/elements.d.ts generated vendored Normal file
View File

@@ -0,0 +1,279 @@
import type { ImageRef } from 'expo-image';
import React, { type PropsWithChildren, type ReactNode } from 'react';
import type { ViewStyle } from 'react-native';
import type { SFSymbol } from 'sf-symbols-typescript';
export interface LinkMenuActionProps {
/**
* The title of the menu item.
*/
children?: ReactNode;
/**
* If `true`, the menu item will be displayed as destructive.
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.
*/
destructive?: boolean;
/**
* If `true`, the menu item will be disabled and not selectable.
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled) for more information.
*/
disabled?: boolean;
/**
* An elaborated title that explains the purpose of the action.
*/
discoverabilityLabel?: string;
/**
* Whether the menu element should be hidden.
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/hidden) for more information.
*
* @default false
*/
hidden?: boolean;
/**
* SF Symbol displayed alongside the menu item.
*/
icon?: SFSymbol;
/**
* Custom image loaded using `useImage()` hook from `expo-image`.
* Takes priority over `icon` (SF Symbol) when both are provided.
*
* @example
* ```tsx
* import { useImage } from 'expo-image';
* import { Link } from 'expo-router';
*
* const customIcon = useImage('https://simpleicons.org/icons/expo.svg', {
* maxWidth: 24,
* maxHeight: 24,
* });
*
* <Link.Menu title="Menu">
* <Link.MenuAction image={customIcon} title="Action" onPress={() => {}} />
* </Link.Menu>
* ```
*/
image?: ImageRef | null;
/**
* Controls how image-based icons are rendered on iOS.
*
* - `'template'`: iOS applies tint color to the icon
* - `'original'`: Preserves original icon colors
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uiimage/renderingmode-swift.enum) for more information.
*
* @platform ios
*/
imageRenderingMode?: 'template' | 'original';
/**
* If `true`, the menu item will be displayed as selected.
*/
isOn?: boolean;
onPress?: () => void;
/**
* An optional subtitle for the menu item.
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.
*/
subtitle?: string;
/**
* The title of the menu item.
* @deprecated Use `children` prop instead.
*/
title?: string;
/**
* If `true`, the menu will be kept presented after the action is selected.
*
* This is marked as unstable, because when action is selected it will recreate the menu,
* which will close all opened submenus and reset the scroll position.
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.
*/
unstable_keepPresented?: boolean;
}
/**
* This component renders a context menu action for a link.
* It should only be used as a child of `Link.Menu` or `LinkMenu`.
*
* @platform ios
*/
export declare function LinkMenuAction(props: LinkMenuActionProps): React.JSX.Element | null;
export interface LinkMenuProps {
/**
* The title of the menu item
*/
title?: string;
/**
* An optional subtitle for the submenu. Does not appear on `inline` menus.
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.
*/
subtitle?: string;
/**
* Optional SF Symbol displayed alongside the menu item.
*/
icon?: SFSymbol;
/**
* Custom image loaded using `useImage()` hook from `expo-image`.
* Takes priority over `icon` (SF Symbol) when both are provided.
*
* @example
* ```tsx
* import { useImage } from 'expo-image';
* import { Link } from 'expo-router';
*
* const customIcon = useImage('https://simpleicons.org/icons/expo.svg', {
* maxWidth: 24,
* maxHeight: 24,
* });
*
* <Link.Menu image={customIcon} title="Menu">
* <Link.MenuAction title="Action" onPress={() => {}} />
* </Link.Menu>
* ```
*/
image?: ImageRef | null;
/**
* If `true`, the menu will be displayed as a palette.
* This means that the menu will be displayed as one row.
* The `elementSize` property is ignored when palette is used, all items will be `elementSize="small"`. Use `elementSize="medium"` instead of `palette` to display actions with titles horizontally.
*
* > **Note**: Palette menus are only supported in submenus.
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.
*/
palette?: boolean;
/**
* @deprecated Use `palette` prop instead.
*/
displayAsPalette?: boolean;
/**
* If `true`, the menu will be displayed inline.
* This means that the menu will not be collapsed
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.
*/
inline?: boolean;
/**
* @deprecated Use `inline` prop instead.
*/
displayInline?: boolean;
/**
* If `true`, the menu item will be displayed as destructive.
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive) for more information.
*/
destructive?: boolean;
/**
* The preferred size of the menu elements.
* `elementSize` property is ignored when `palette` is used.
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/preferredelementsize) for more information.
*
* @platform iOS 16.0+
*/
elementSize?: 'small' | 'medium' | 'large' | 'auto';
children?: React.ReactNode;
}
/**
* Groups context menu actions for a link.
*
* If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.
* Only `Link.MenuAction` and `Link.Menu` components are allowed as children.
*
* @example
* ```tsx
* <Link.Menu>
* <Link.MenuAction title="Action 1" onPress={() => {}} />
* <Link.MenuAction title="Action 2" onPress={() => {}} />
* </Link.Menu>
* ```
*
* @platform ios
*/
export declare const LinkMenu: (props: LinkMenuProps) => React.JSX.Element | null;
export type LinkPreviewStyle = Omit<ViewStyle, 'position' | 'width' | 'height'> & {
/**
* Sets the preferred width of the preview.
* If not set, full width of the screen will be used.
*
* This is only **preferred** width, the actual width may be different
*/
width?: number;
/**
* Sets the preferred height of the preview.
* If not set, full height of the screen will be used.
*
* This is only **preferred** height, the actual height may be different
*/
height?: number;
};
export interface LinkPreviewProps {
children?: React.ReactNode;
/**
* Custom styles for the preview container.
*
* Note that some styles may not work, as they are limited or reset by the native view
*/
style?: LinkPreviewStyle;
}
/**
* A component used to render and customize the link preview.
*
* If `Link.Preview` is used without any props, it will render a preview of the `href` passed to the `Link`.
*
* If multiple `Link.Preview` components are used within a single `Link`, only the first one will be rendered.
*
* To customize the preview, you can pass custom content as children.
*
* @example
* ```tsx
* <Link href="/about">
* <Link.Preview>
* <Text>Custom Preview Content</Text>
* </Link.Preview>
* </Link>
* ```
*
* @example
* ```tsx
* <Link href="/about">
* <Link.Preview />
* </Link>
* ```
*
* @platform ios
*/
export declare function LinkPreview(props: LinkPreviewProps): React.JSX.Element | null;
export interface LinkTriggerProps extends PropsWithChildren {
/**
* A shorthand for enabling the Apple Zoom Transition on this link trigger.
*
* When set to `true`, the trigger will be wrapped with `Link.AppleZoom`.
* If another `Link.AppleZoom` is already used inside `Link.Trigger`, an error
* will be thrown.
*
* @platform ios 18+
*/
withAppleZoom?: boolean;
}
/**
* Serves as the trigger for a link.
* The content inside this component will be rendered as part of the base link.
*
* If multiple `Link.Trigger` components are used within a single `Link`, only the first will be rendered.
*
* @example
* ```tsx
* <Link href="/about">
* <Link.Trigger>
* Trigger
* </Link.Trigger>
* </Link>
* ```
*
* @platform ios
*/
export declare function LinkTrigger({ withAppleZoom, ...props }: LinkTriggerProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
//# sourceMappingURL=elements.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":"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"}

186
node_modules/expo-router/build/link/elements.js generated vendored Normal file
View File

@@ -0,0 +1,186 @@
"use strict";
'use client';
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkMenu = void 0;
exports.LinkMenuAction = LinkMenuAction;
exports.LinkPreview = LinkPreview;
exports.LinkTrigger = LinkTrigger;
const react_1 = __importStar(require("react"));
const InternalLinkPreviewContext_1 = require("./InternalLinkPreviewContext");
const NativeMenuContext_1 = require("./NativeMenuContext");
const primitives_1 = require("../primitives");
const HrefPreview_1 = require("./preview/HrefPreview");
const PreviewRouteContext_1 = require("./preview/PreviewRouteContext");
const native_1 = require("./preview/native");
const Slot_1 = require("../ui/Slot");
const link_apple_zoom_1 = require("./zoom/link-apple-zoom");
const children_1 = require("../utils/children");
/**
* This component renders a context menu action for a link.
* It should only be used as a child of `Link.Menu` or `LinkMenu`.
*
* @platform ios
*/
function LinkMenuAction(props) {
const identifier = (0, react_1.useId)();
if ((0, PreviewRouteContext_1.useIsPreview)() || process.env.EXPO_OS !== 'ios' || !(0, react_1.use)(NativeMenuContext_1.NativeMenuContext)) {
return null;
}
const { unstable_keepPresented, onPress, children, title, ...rest } = props;
const areChildrenString = typeof children === 'string';
const label = areChildrenString
? children
: (0, children_1.getFirstChildOfType)(children, primitives_1.Label)?.props.children;
const iconComponent = !props.icon && !areChildrenString ? (0, children_1.getFirstChildOfType)(children, primitives_1.Icon) : undefined;
const icon = props.icon ??
(iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);
const sf = typeof icon === 'string' ? icon : undefined;
const rawXcasset = iconComponent?.props && 'xcasset' in iconComponent.props
? iconComponent.props.xcasset
: undefined;
const xcassetName = typeof rawXcasset === 'string' ? rawXcasset : undefined;
return (<native_1.NativeLinkPreviewAction {...rest} identifier={identifier} icon={sf} xcassetName={xcassetName} title={label ?? title ?? ''} keepPresented={unstable_keepPresented} onSelected={() => onPress?.()}/>);
}
/**
* Groups context menu actions for a link.
*
* If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.
* Only `Link.MenuAction` and `Link.Menu` components are allowed as children.
*
* @example
* ```tsx
* <Link.Menu>
* <Link.MenuAction title="Action 1" onPress={() => {}} />
* <Link.MenuAction title="Action 2" onPress={() => {}} />
* </Link.Menu>
* ```
*
* @platform ios
*/
const LinkMenu = (props) => {
const identifier = (0, react_1.useId)();
if ((0, PreviewRouteContext_1.useIsPreview)() || process.env.EXPO_OS !== 'ios' || !(0, react_1.use)(NativeMenuContext_1.NativeMenuContext)) {
return null;
}
const children = react_1.default.Children.toArray(props.children).filter((child) => (0, react_1.isValidElement)(child) && (child.type === LinkMenuAction || child.type === exports.LinkMenu));
const displayAsPalette = props.palette ?? props.displayAsPalette;
const displayInline = props.inline ?? props.displayInline;
return (<native_1.NativeLinkPreviewAction {...props} displayAsPalette={displayAsPalette} displayInline={displayInline} preferredElementSize={props.elementSize} title={props.title ?? ''} onSelected={() => { }} children={children} identifier={identifier}/>);
};
exports.LinkMenu = LinkMenu;
/**
* A component used to render and customize the link preview.
*
* If `Link.Preview` is used without any props, it will render a preview of the `href` passed to the `Link`.
*
* If multiple `Link.Preview` components are used within a single `Link`, only the first one will be rendered.
*
* To customize the preview, you can pass custom content as children.
*
* @example
* ```tsx
* <Link href="/about">
* <Link.Preview>
* <Text>Custom Preview Content</Text>
* </Link.Preview>
* </Link>
* ```
*
* @example
* ```tsx
* <Link href="/about">
* <Link.Preview />
* </Link>
* ```
*
* @platform ios
*/
function LinkPreview(props) {
const { children, style } = props;
const internalPreviewContext = (0, react_1.use)(InternalLinkPreviewContext_1.InternalLinkPreviewContext);
if ((0, PreviewRouteContext_1.useIsPreview)() || process.env.EXPO_OS !== 'ios' || !internalPreviewContext) {
return null;
}
const { isVisible, href } = internalPreviewContext;
const { width, height, ...restOfStyle } = style ?? {};
const contentSize = {
width: width ?? 0,
height: height ?? 0,
};
let content;
if (children) {
content = isVisible ? children : null;
}
else {
content = isVisible ? <HrefPreview_1.HrefPreview href={href}/> : null;
}
return (<native_1.NativeLinkPreviewContent style={restOfStyle} preferredContentSize={contentSize}>
{content}
</native_1.NativeLinkPreviewContent>);
}
/**
* Serves as the trigger for a link.
* The content inside this component will be rendered as part of the base link.
*
* If multiple `Link.Trigger` components are used within a single `Link`, only the first will be rendered.
*
* @example
* ```tsx
* <Link href="/about">
* <Link.Trigger>
* Trigger
* </Link.Trigger>
* </Link>
* ```
*
* @platform ios
*/
function LinkTrigger({ withAppleZoom, ...props }) {
if (react_1.default.Children.count(props.children) > 1 || !(0, react_1.isValidElement)(props.children)) {
// If onPress is passed, this means that Link passed props to this component.
// We can assume that asChild is used, so we throw an error, because link will not work in this case.
if (props && typeof props === 'object' && 'onPress' in props) {
throw new Error('When using Link.Trigger in an asChild Link, you must pass a single child element that will emit onPress event.');
}
return props.children;
}
const content = <Slot_1.Slot {...props}/>;
if (withAppleZoom) {
return <link_apple_zoom_1.LinkAppleZoom>{content}</link_apple_zoom_1.LinkAppleZoom>;
}
return content;
}
//# sourceMappingURL=elements.js.map

1
node_modules/expo-router/build/link/elements.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

7
node_modules/expo-router/build/link/href.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import { UrlObject } from '../LocationProvider';
import { LinkToOptions } from '../global-state/routing';
import { Href } from '../types';
/** Resolve an href object into a fully qualified, relative href. */
export declare const resolveHref: (href: Href) => string;
export declare function resolveHrefStringWithSegments(href: string, { segments, params }?: Partial<UrlObject>, { relativeToDirectory }?: LinkToOptions): string;
//# sourceMappingURL=href.d.ts.map

1
node_modules/expo-router/build/link/href.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../../src/link/href.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,oEAAoE;AACpE,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,KAAG,MAaxC,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,MAAM,EACZ,EAAE,QAAa,EAAE,MAAW,EAAE,GAAE,OAAO,CAAC,SAAS,CAAM,EACvD,EAAE,mBAAmB,EAAE,GAAE,aAAkB,UAmC5C"}

83
node_modules/expo-router/build/link/href.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveHref = void 0;
exports.resolveHrefStringWithSegments = resolveHrefStringWithSegments;
/** Resolve an href object into a fully qualified, relative href. */
const resolveHref = (href) => {
if (typeof href === 'string') {
return (0, exports.resolveHref)({ pathname: href });
}
const path = href.pathname ?? '';
if (!href?.params) {
return path;
}
const { pathname, params } = createQualifiedPathname(path, {
...href.params,
});
const paramsString = createQueryParams(params);
return pathname + (paramsString ? `?${paramsString}` : '');
};
exports.resolveHref = resolveHref;
function resolveHrefStringWithSegments(href, { segments = [], params = {} } = {}, { relativeToDirectory } = {}) {
if (href.startsWith('.')) {
// Resolve base path by merging the current segments with the params
let base = segments
?.map((segment) => {
if (!segment.startsWith('['))
return segment;
if (segment.startsWith('[...')) {
segment = segment.slice(4, -1);
const param = params[segment];
if (Array.isArray(param)) {
return param.join('/');
}
else {
return param?.split(',')?.join('/') ?? '';
}
}
else {
segment = segment.slice(1, -1);
return params[segment];
}
})
.filter(Boolean)
.join('/') ?? '/';
if (relativeToDirectory) {
base = `${base}/`;
}
const url = new URL(href, `http://hostname/${base}`);
href = `${url.pathname}${url.search}`;
}
return href;
}
function createQualifiedPathname(pathname, params) {
for (const [key, value = ''] of Object.entries(params)) {
const dynamicKey = `[${key}]`;
const deepDynamicKey = `[...${key}]`;
if (pathname.includes(dynamicKey)) {
pathname = pathname.replace(dynamicKey, encodeParam(value));
}
else if (pathname.includes(deepDynamicKey)) {
pathname = pathname.replace(deepDynamicKey, encodeParam(value));
}
else {
continue;
}
delete params[key];
}
return { pathname, params };
}
function encodeParam(param) {
if (Array.isArray(param)) {
return param.map((p) => encodeParam(p)).join('/');
}
return encodeURIComponent(param.toString());
}
function createQueryParams(params) {
return (Object.entries(params)
// Allow nullish params
.filter(([, value]) => value != null)
.map(([key, value]) => `${key}=${encodeURIComponent(value.toString())}`)
.join('&'));
}
//# sourceMappingURL=href.js.map

1
node_modules/expo-router/build/link/href.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

10
node_modules/expo-router/build/link/linking.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { LinkingOptions } from '@react-navigation/native';
import { getPathFromState } from '../fork/getPathFromState';
import { getStateFromPath } from '../fork/getStateFromPath';
import { StoreRedirects } from '../global-state/router-store';
import { NativeIntent } from '../types';
export declare function getInitialURL(): ReturnType<NonNullable<LinkingOptions<Record<string, unknown>>['getInitialURL']>>;
export declare function getRootURL(): string;
export declare function subscribe(nativeLinking: NativeIntent | undefined, redirects: StoreRedirects[] | undefined): (listener: (url: string) => void) => () => void;
export { getStateFromPath, getPathFromState };
//# sourceMappingURL=linking.d.ts.map

1
node_modules/expo-router/build/link/linking.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../src/link/linking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AASxC,wBAAgB,aAAa,IAAI,UAAU,CACzC,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CACtE,CA0BA;AAID,wBAAgB,UAAU,IAAI,MAAM,CAQnC;AAgBD,wBAAgB,SAAS,CACvB,aAAa,EAAE,YAAY,GAAG,SAAS,EACvC,SAAS,EAAE,cAAc,EAAE,GAAG,SAAS,IAE/B,UAAU,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,gBAuCxC;AAED,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}

135
node_modules/expo-router/build/link/linking.js generated vendored Normal file
View File

@@ -0,0 +1,135 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPathFromState = exports.getStateFromPath = void 0;
exports.getInitialURL = getInitialURL;
exports.getRootURL = getRootURL;
exports.subscribe = subscribe;
const Linking = __importStar(require("expo-linking"));
const react_native_1 = require("react-native");
const extractPathFromURL_1 = require("../fork/extractPathFromURL");
const getPathFromState_1 = require("../fork/getPathFromState");
Object.defineProperty(exports, "getPathFromState", { enumerable: true, get: function () { return getPathFromState_1.getPathFromState; } });
const getStateFromPath_1 = require("../fork/getStateFromPath");
Object.defineProperty(exports, "getStateFromPath", { enumerable: true, get: function () { return getStateFromPath_1.getStateFromPath; } });
const useLinking_1 = require("../fork/useLinking");
const getRoutesRedirects_1 = require("../getRoutesRedirects");
const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;
// A custom getInitialURL is used on native to ensure the app always starts at
// the root path if it's launched from something other than a deep link.
// This helps keep the native functionality working like the web functionality.
// For example, if you had a root navigator where the first screen was `/settings` and the second was `/index`
// then `/index` would be used on web and `/settings` would be used on native.
function getInitialURL() {
if (typeof window === 'undefined') {
return '';
}
if (react_native_1.Platform.OS === 'web' && window.location?.href) {
return window.location.href;
}
if (react_native_1.Platform.OS === 'ios') {
// Use the new Expo API for iOS. This has better support for App Clips and handoff.
const url = Linking.getLinkingURL();
return (parseExpoGoUrlFromListener(url) ??
// The path will be nullish in bare apps when the app is launched from the home screen.
// TODO(EvanBacon): define some policy around notifications.
getRootURL());
}
// TODO: Figure out if expo-linking on Android has full interop with the React Native implementation.
return Promise.resolve((0, useLinking_1.getInitialURLWithTimeout)()).then((url) => parseExpoGoUrlFromListener(url) ??
// The path will be nullish in bare apps when the app is launched from the home screen.
// TODO(EvanBacon): define some policy around notifications.
getRootURL());
}
let _rootURL;
function getRootURL() {
if (_rootURL === undefined) {
_rootURL = Linking.createURL('/');
if (isExpoGo) {
_rootURL = (0, extractPathFromURL_1.parsePathFromExpoGoLink)(_rootURL);
}
}
return _rootURL;
}
// Expo Go is weird and requires the root path to be `/--/`
function parseExpoGoUrlFromListener(url) {
if (!url || !isExpoGo) {
return url;
}
const { pathname, queryString } = (0, extractPathFromURL_1.parsePathAndParamsFromExpoGoLink)(url);
// If the URL is defined (default in Expo Go dev apps) and the URL has no path:
// `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`
if (!pathname || pathname === '/') {
return (getRootURL() + queryString);
}
return url;
}
function subscribe(nativeLinking, redirects) {
return (listener) => {
let callback;
const legacySubscription = nativeLinking?.legacy_subscribe?.(listener);
if (isExpoGo) {
// This extra work is only done in the Expo Go app.
callback = async ({ url }) => {
let href = parseExpoGoUrlFromListener(url);
href = (0, getRoutesRedirects_1.applyRedirects)(href, redirects);
if (href && nativeLinking?.redirectSystemPath) {
href = await nativeLinking.redirectSystemPath({ path: href, initial: false });
}
if (href) {
listener(href);
}
};
}
else {
callback = async ({ url }) => {
let href = (0, getRoutesRedirects_1.applyRedirects)(url, redirects);
if (href && nativeLinking?.redirectSystemPath) {
href = await nativeLinking.redirectSystemPath({ path: href, initial: false });
}
if (href) {
listener(href);
}
};
}
const subscription = Linking.addEventListener('url', callback);
return () => {
// https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7
subscription?.remove?.();
legacySubscription?.();
};
};
}
//# sourceMappingURL=linking.js.map

1
node_modules/expo-router/build/link/linking.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
import { Href } from '../../types';
export declare function HrefPreview({ href }: {
href: Href;
}): import("react").JSX.Element;
//# sourceMappingURL=HrefPreview.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"HrefPreview.d.ts","sourceRoot":"","sources":["../../../src/link/preview/HrefPreview.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,IAAI,EAAuB,MAAM,aAAa,CAAC;AAKxD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,+BAyCnD"}

View File

@@ -0,0 +1,162 @@
"use strict";
'use client';
Object.defineProperty(exports, "__esModule", { value: true });
exports.HrefPreview = HrefPreview;
const native_1 = require("@react-navigation/native");
const react_1 = require("react");
const react_native_1 = require("react-native");
const PreviewRouteContext_1 = require("./PreviewRouteContext");
const constants_1 = require("../../constants");
const composition_options_1 = require("../../fork/native-stack/composition-options");
const router_store_1 = require("../../global-state/router-store");
const utils_1 = require("../../global-state/utils");
const hooks_1 = require("../../hooks");
const useNavigation_1 = require("../../useNavigation");
const useScreens_1 = require("../../useScreens");
const linking_1 = require("../linking");
function HrefPreview({ href }) {
const hrefState = (0, react_1.useMemo)(() => getHrefState(href), [href]);
const index = hrefState?.index ?? 0;
let isProtected = false;
if (hrefState?.routes[index]?.name === constants_1.INTERNAL_SLOT_NAME) {
let routerState = hrefState;
let rnState = router_store_1.store.state;
while (routerState && rnState) {
const routerRoute = routerState.routes[0];
// When the route we want to show is not present in react-navigation state
// Then most likely it is a protected route
if (rnState.stale === false && !rnState.routeNames?.includes(routerRoute.name)) {
isProtected = true;
break;
}
const rnIndex = rnState.routes.findIndex((route) => route.name === routerRoute.name);
if (rnIndex === -1) {
break;
}
routerState = routerRoute.state;
rnState = rnState.routes[rnIndex]?.state;
}
if (!isProtected) {
return <PreviewForRootHrefState hrefState={hrefState} href={href}/>;
}
}
const pathname = href.toString();
const segments = pathname.split('/').filter(Boolean);
return (<PreviewRouteContext_1.PreviewRouteContext.Provider value={{
params: {},
pathname,
segments,
}}>
<PreviewForInternalRoutes />
</PreviewRouteContext_1.PreviewRouteContext.Provider>);
}
function PreviewForRootHrefState({ hrefState, href }) {
const navigation = (0, useNavigation_1.useNavigation)();
const { routeNode, params, state } = getParamsAndNodeFromHref(hrefState);
const path = state ? (0, linking_1.getPathFromState)(state) : undefined;
const value = (0, react_1.useMemo)(() => ({
params,
pathname: href.toString(),
segments: path?.split('/').filter(Boolean) || [],
}), [params, href]);
// This can happen in a theoretical case where the state is not yet initialized or is incorrectly initialized.
// This check ensures TypeScript type safety as well.
if (!routeNode) {
return null;
}
const Component = (0, useScreens_1.getQualifiedRouteComponent)(routeNode);
return (<PreviewRouteContext_1.PreviewRouteContext value={value}>
<composition_options_1.CompositionContext value={{ set: () => { }, unset: () => { } }}>
{/* Using NavigationContext to override useNavigation */}
<native_1.NavigationContext value={navigationPropWithWarnings}>
<Component navigation={navigation}/>
</native_1.NavigationContext>
</composition_options_1.CompositionContext>
</PreviewRouteContext_1.PreviewRouteContext>);
}
function PreviewForInternalRoutes() {
const pathname = (0, hooks_1.usePathname)();
return (<react_native_1.View style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
gap: 8,
backgroundColor: 'white',
}}>
<react_native_1.Text style={{ fontWeight: '600', fontSize: 24 }}>Invalid preview</react_native_1.Text>
<react_native_1.Text style={{ fontWeight: '200', fontSize: 14 }}>{pathname}</react_native_1.Text>
</react_native_1.View>);
}
function getHrefState(href) {
const hrefState = router_store_1.store.getStateForHref(href);
return hrefState;
}
function getParamsAndNodeFromHref(hrefState) {
const index = hrefState?.index ?? 0;
if (hrefState?.routes[index] && hrefState.routes[index].name !== constants_1.INTERNAL_SLOT_NAME) {
const name = hrefState.routes[index].name;
if (name === constants_1.SITEMAP_ROUTE_NAME || name === constants_1.NOT_FOUND_ROUTE_NAME) {
console.log(router_store_1.store.routeNode);
console.log(hrefState);
}
const error = `Expo Router Error: Expected navigation state to begin with one of [${(0, utils_1.getRootStackRouteNames)().join(', ')}] routes`;
if (process.env.NODE_ENV !== 'production') {
throw new Error(error);
}
else {
console.warn(error);
}
}
const initialState = hrefState?.routes[index]?.state;
let state = initialState;
let routeNode = router_store_1.store.routeNode;
const params = {};
while (state && routeNode) {
const route = state.routes[state.index || state.routes.length - 1];
Object.assign(params, route.params);
state = route.state;
routeNode = routeNode.children.find((child) => child.route === route.name);
}
return { params, routeNode, state: initialState };
}
const displayWarningForProp = (prop) => {
if (process.env.NODE_ENV !== 'production') {
console.warn(`navigation.${prop} should not be used in a previewed screen. To fix this issue, wrap navigation calls with 'if (!isPreview) { ... }'.`);
}
};
const createNOOPWithWarning = (prop) => () => displayWarningForProp(prop);
const navigationPropWithWarnings = {
setParams: createNOOPWithWarning('setParams'),
setOptions: createNOOPWithWarning('setOptions'),
addListener: (() => () => { }),
removeListener: () => { },
isFocused: () => true,
canGoBack: () => false,
dispatch: createNOOPWithWarning('dispatch'),
navigate: createNOOPWithWarning('navigate'),
goBack: createNOOPWithWarning('goBack'),
reset: createNOOPWithWarning('reset'),
push: createNOOPWithWarning('push'),
pop: createNOOPWithWarning('pop'),
popToTop: createNOOPWithWarning('popToTop'),
navigateDeprecated: createNOOPWithWarning('navigateDeprecated'),
preload: createNOOPWithWarning('preload'),
getId: () => {
displayWarningForProp('getId');
return '';
},
// @ts-expect-error
getParent: createNOOPWithWarning('getParent'),
getState: () => {
displayWarningForProp('getState');
return {
key: '',
index: 0,
routeNames: [],
routes: [],
type: '',
stale: false,
};
},
};
//# sourceMappingURL=HrefPreview.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
import { PropsWithChildren } from 'react';
export declare function LinkPreviewContextProvider({ children }: PropsWithChildren): import("react").JSX.Element;
export declare const useLinkPreviewContext: () => {
isStackAnimationDisabled: boolean;
openPreviewKey: string | undefined;
setOpenPreviewKey: (openPreviewKey: string | undefined) => void;
};
//# sourceMappingURL=LinkPreviewContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LinkPreviewContext.d.ts","sourceRoot":"","sources":["../../../src/link/preview/LinkPreviewContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAWxE,wBAAgB,0BAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BASzE;AAED,eAAO,MAAM,qBAAqB;8BAlBF,OAAO;oBACjB,MAAM,GAAG,SAAS;uBACf,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;CAwBpE,CAAC"}

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useLinkPreviewContext = void 0;
exports.LinkPreviewContextProvider = LinkPreviewContextProvider;
const react_1 = require("react");
const LinkPreviewContext = (0, react_1.createContext)(undefined);
function LinkPreviewContextProvider({ children }) {
const [openPreviewKey, setOpenPreviewKey] = (0, react_1.useState)(undefined);
const isStackAnimationDisabled = openPreviewKey !== undefined;
return (<LinkPreviewContext.Provider value={{ isStackAnimationDisabled, openPreviewKey, setOpenPreviewKey }}>
{children}
</LinkPreviewContext.Provider>);
}
const useLinkPreviewContext = () => {
const context = (0, react_1.use)(LinkPreviewContext);
if (context == null) {
throw new Error('useLinkPreviewContext must be used within a LinkPreviewContextProvider. This is likely a bug in Expo Router.');
}
return context;
};
exports.useLinkPreviewContext = useLinkPreviewContext;
//# sourceMappingURL=LinkPreviewContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LinkPreviewContext.js","sourceRoot":"","sources":["../../../src/link/preview/LinkPreviewContext.tsx"],"names":[],"mappings":";;;AAWA,gEASC;AApBD,iCAAwE;AAExE,MAAM,kBAAkB,GAAG,IAAA,qBAAa,EAOtC,SAAS,CAAC,CAAC;AAEb,SAAgB,0BAA0B,CAAC,EAAE,QAAQ,EAAqB;IACxE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAqB,SAAS,CAAC,CAAC;IACpF,MAAM,wBAAwB,GAAG,cAAc,KAAK,SAAS,CAAC;IAC9D,OAAO,CACL,CAAC,kBAAkB,CAAC,QAAQ,CAC1B,KAAK,CAAC,CAAC,EAAE,wBAAwB,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC,CACvE;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAC/B,CAAC;AACJ,CAAC;AAEM,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,OAAO,GAAG,IAAA,WAAG,EAAC,kBAAkB,CAAC,CAAC;IACxC,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,8GAA8G,CAC/G,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC","sourcesContent":["import { createContext, PropsWithChildren, use, useState } from 'react';\n\nconst LinkPreviewContext = createContext<\n | {\n isStackAnimationDisabled: boolean;\n openPreviewKey: string | undefined;\n setOpenPreviewKey: (openPreviewKey: string | undefined) => void;\n }\n | undefined\n>(undefined);\n\nexport function LinkPreviewContextProvider({ children }: PropsWithChildren) {\n const [openPreviewKey, setOpenPreviewKey] = useState<string | undefined>(undefined);\n const isStackAnimationDisabled = openPreviewKey !== undefined;\n return (\n <LinkPreviewContext.Provider\n value={{ isStackAnimationDisabled, openPreviewKey, setOpenPreviewKey }}>\n {children}\n </LinkPreviewContext.Provider>\n );\n}\n\nexport const useLinkPreviewContext = () => {\n const context = use(LinkPreviewContext);\n if (context == null) {\n throw new Error(\n 'useLinkPreviewContext must be used within a LinkPreviewContextProvider. This is likely a bug in Expo Router.'\n );\n }\n return context;\n};\n"]}

View File

@@ -0,0 +1,22 @@
import type { UnknownOutputParams } from '../../types';
export interface PreviewRouteContextType {
params: UnknownOutputParams;
pathname: string;
segments: string[];
}
export declare const PreviewRouteContext: import("react").Context<PreviewRouteContextType | undefined>;
type UsePreviewInfo = {
isPreview: boolean;
} & Partial<PreviewRouteContextType>;
/**
* Returns information about the current route if it is displayed in preview mode.
*/
export declare function usePreviewInfo(): UsePreviewInfo;
/**
* Hook to determine if the current route is rendered inside a preview.
*
* @returns {boolean} - True if the current route is rendered inside a preview, false otherwise.
*/
export declare function useIsPreview(): boolean;
export {};
//# sourceMappingURL=PreviewRouteContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PreviewRouteContext.d.ts","sourceRoot":"","sources":["../../../src/link/preview/PreviewRouteContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,mBAAmB,8DAAgE,CAAC;AAEjG,KAAK,cAAc,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEhF;;GAEG;AACH,wBAAgB,cAAc,IAAI,cAAc,CAM/C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAGtC"}

View File

@@ -0,0 +1,28 @@
"use strict";
'use client';
Object.defineProperty(exports, "__esModule", { value: true });
exports.PreviewRouteContext = void 0;
exports.usePreviewInfo = usePreviewInfo;
exports.useIsPreview = useIsPreview;
const react_1 = require("react");
exports.PreviewRouteContext = (0, react_1.createContext)(undefined);
/**
* Returns information about the current route if it is displayed in preview mode.
*/
function usePreviewInfo() {
const paramsContext = (0, react_1.use)(exports.PreviewRouteContext);
return {
isPreview: !!paramsContext,
...paramsContext,
};
}
/**
* Hook to determine if the current route is rendered inside a preview.
*
* @returns {boolean} - True if the current route is rendered inside a preview, false otherwise.
*/
function useIsPreview() {
const { isPreview } = usePreviewInfo();
return isPreview;
}
//# sourceMappingURL=PreviewRouteContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PreviewRouteContext.js","sourceRoot":"","sources":["../../../src/link/preview/PreviewRouteContext.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAmBb,wCAMC;AAOD,oCAGC;AAjCD,iCAA2C;AAU9B,QAAA,mBAAmB,GAAG,IAAA,qBAAa,EAAsC,SAAS,CAAC,CAAC;AAIjG;;GAEG;AACH,SAAgB,cAAc;IAC5B,MAAM,aAAa,GAAG,IAAA,WAAG,EAAC,2BAAmB,CAAC,CAAC;IAC/C,OAAO;QACL,SAAS,EAAE,CAAC,CAAC,aAAa;QAC1B,GAAG,aAAa;KACjB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,YAAY;IAC1B,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["'use client';\n\nimport { createContext, use } from 'react';\n\nimport type { UnknownOutputParams } from '../../types';\n\nexport interface PreviewRouteContextType {\n params: UnknownOutputParams;\n pathname: string;\n segments: string[];\n}\n\nexport const PreviewRouteContext = createContext<PreviewRouteContextType | undefined>(undefined);\n\ntype UsePreviewInfo = { isPreview: boolean } & Partial<PreviewRouteContextType>;\n\n/**\n * Returns information about the current route if it is displayed in preview mode.\n */\nexport function usePreviewInfo(): UsePreviewInfo {\n const paramsContext = use(PreviewRouteContext);\n return {\n isPreview: !!paramsContext,\n ...paramsContext,\n };\n}\n\n/**\n * Hook to determine if the current route is rendered inside a preview.\n *\n * @returns {boolean} - True if the current route is rendered inside a preview, false otherwise.\n */\nexport function useIsPreview(): boolean {\n const { isPreview } = usePreviewInfo();\n return isPreview;\n}\n"]}

View File

@@ -0,0 +1,87 @@
import type { ImageRef } from 'expo-image';
import { type PropsWithChildren } from 'react';
import { type ViewProps, type ColorValue } from 'react-native';
import type { BasicTextStyle } from '../../utils/font';
export interface NativeLinkPreviewActionProps {
identifier: string;
title: string;
label?: string;
icon?: string;
xcassetName?: string;
image?: ImageRef | null;
imageRenderingMode?: 'template' | 'original';
children?: React.ReactNode;
disabled?: boolean;
destructive?: boolean;
discoverabilityLabel?: string;
subtitle?: string;
accessibilityLabel?: string;
accessibilityHint?: string;
displayAsPalette?: boolean;
displayInline?: boolean;
preferredElementSize?: 'auto' | 'small' | 'medium' | 'large';
isOn?: boolean;
keepPresented?: boolean;
hidden?: boolean;
tintColor?: ColorValue;
barButtonItemStyle?: 'plain' | 'prominent';
sharesBackground?: boolean;
hidesSharedBackground?: boolean;
onSelected: () => void;
titleStyle?: BasicTextStyle;
}
export declare function NativeLinkPreviewAction(props: NativeLinkPreviewActionProps): import("react").JSX.Element | null;
export interface TabPath {
oldTabKey: string;
newTabKey: string;
}
export interface NativeLinkPreviewProps extends ViewProps {
nextScreenId: string | undefined;
tabPath: {
path: TabPath[];
} | undefined;
disableForceFlatten?: boolean;
onWillPreviewOpen?: () => void;
onDidPreviewOpen?: () => void;
onPreviewWillClose?: () => void;
onPreviewDidClose?: () => void;
onPreviewTapped?: () => void;
onPreviewTappedAnimationCompleted?: () => void;
children: React.ReactNode;
}
export declare function NativeLinkPreview(props: NativeLinkPreviewProps): import("react").JSX.Element | null;
export interface NativeLinkPreviewContentProps extends ViewProps {
preferredContentSize?: {
width: number;
height: number;
};
}
export declare function NativeLinkPreviewContent(props: NativeLinkPreviewContentProps): import("react").JSX.Element | null;
interface DismissalBoundsRect {
minX?: number;
maxX?: number;
minY?: number;
maxY?: number;
}
export declare function LinkZoomTransitionEnabler(props: {
zoomTransitionSourceIdentifier: string;
dismissalBoundsRect?: DismissalBoundsRect | null;
}): import("react").JSX.Element | null;
interface LinkSourceAlignmentRect {
x: number;
y: number;
width: number;
height: number;
}
interface LinkZoomTransitionSourceProps extends PropsWithChildren {
identifier: string;
alignment?: LinkSourceAlignmentRect;
animateAspectRatioChange?: boolean;
}
export declare function LinkZoomTransitionSource(props: LinkZoomTransitionSourceProps): import("react").JSX.Element | null;
export declare function LinkZoomTransitionAlignmentRectDetector(props: {
identifier: string;
children: React.ReactNode;
}): import("react").JSX.Element | null;
export {};
//# sourceMappingURL=native.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":"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"}

81
node_modules/expo-router/build/link/preview/native.js generated vendored Normal file
View File

@@ -0,0 +1,81 @@
"use strict";
'use client';
Object.defineProperty(exports, "__esModule", { value: true });
exports.NativeLinkPreviewAction = NativeLinkPreviewAction;
exports.NativeLinkPreview = NativeLinkPreview;
exports.NativeLinkPreviewContent = NativeLinkPreviewContent;
exports.LinkZoomTransitionEnabler = LinkZoomTransitionEnabler;
exports.LinkZoomTransitionSource = LinkZoomTransitionSource;
exports.LinkZoomTransitionAlignmentRectDetector = LinkZoomTransitionAlignmentRectDetector;
const expo_1 = require("expo");
const react_1 = require("react");
const react_native_1 = require("react-native");
const areNativeViewsAvailable = process.env.EXPO_OS === 'ios' && !react_native_1.Platform.isTV && global.RN$Bridgeless === true;
const LinkPreviewNativeActionView = areNativeViewsAvailable
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'LinkPreviewNativeActionView')
: null;
function NativeLinkPreviewAction(props) {
if (!LinkPreviewNativeActionView) {
return null;
}
// Needed to pass shared object ID to native side
const imageObjectId = props.image?.__expo_shared_object_id__;
return <LinkPreviewNativeActionView {...props} image={imageObjectId}/>;
}
const NativeLinkPreviewView = areNativeViewsAvailable
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewView')
: null;
function NativeLinkPreview(props) {
if (!NativeLinkPreviewView) {
return null;
}
return <NativeLinkPreviewView {...props}/>;
}
const NativeLinkPreviewContentView = areNativeViewsAvailable
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewContentView')
: null;
function NativeLinkPreviewContent(props) {
if (!NativeLinkPreviewContentView) {
return null;
}
const style = react_native_1.StyleSheet.flatten([
props.style,
{
position: 'absolute',
top: 0,
left: 0,
},
]);
return <NativeLinkPreviewContentView {...props} style={style}/>;
}
const LinkZoomTransitionEnablerNativeView = areNativeViewsAvailable
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionEnabler')
: null;
function LinkZoomTransitionEnabler(props) {
if (!LinkZoomTransitionEnablerNativeView) {
return null;
}
return (<LinkZoomTransitionEnablerNativeView {...props} disableForceFlatten style={{ display: 'contents' }}/>);
}
const LinkZoomTransitionSourceNativeView = areNativeViewsAvailable
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionSource')
: null;
function LinkZoomTransitionSource(props) {
if (!LinkZoomTransitionSourceNativeView) {
return null;
}
return (<LinkZoomTransitionSourceNativeView {...props} disableForceFlatten collapsable={false} collapsableChildren={false} style={{ display: 'contents' }}/>);
}
// #endregion
// #region Zoom transition rect detector
const LinkZoomTransitionAlignmentRectDetectorNative = areNativeViewsAvailable
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionAlignmentRectDetector')
: react_1.Fragment;
function LinkZoomTransitionAlignmentRectDetector(props) {
if (!LinkZoomTransitionAlignmentRectDetectorNative) {
return null;
}
return (<LinkZoomTransitionAlignmentRectDetectorNative {...props} disableForceFlatten collapsable={false} collapsableChildren={false} style={{ display: 'contents' }}/>);
}
// #endregion
//# sourceMappingURL=native.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
import { TabPath } from './native';
import { Href } from '../../types';
export declare function useNextScreenId(): [
{
nextScreenId: string | undefined;
tabPath: TabPath[];
},
(href: Href) => void
];
//# sourceMappingURL=useNextScreenId.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useNextScreenId.d.ts","sourceRoot":"","sources":["../../../src/link/preview/useNextScreenId.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAInC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,wBAAgB,eAAe,IAAI;IACjC;QAAE,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE;IACxD,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;CACrB,CAyCA"}

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useNextScreenId = useNextScreenId;
const react_1 = require("react");
const LinkPreviewContext_1 = require("./LinkPreviewContext");
const utils_1 = require("./utils");
const router_store_1 = require("../../global-state/router-store");
const hooks_1 = require("../../hooks");
function useNextScreenId() {
const router = (0, hooks_1.useRouter)();
const { setOpenPreviewKey } = (0, LinkPreviewContext_1.useLinkPreviewContext)();
const [internalNextScreenId, internalSetNextScreenId] = (0, react_1.useState)();
const currentHref = (0, react_1.useRef)(undefined);
const [tabPath, setTabPath] = (0, react_1.useState)([]);
(0, react_1.useEffect)(() => {
// When screen is prefetched, then the root state is updated with the preloaded route.
return router_store_1.store.navigationRef.addListener('state', ({ data: { state } }) => {
// If we have the current href, it means that we prefetched the route
if (currentHref.current && state) {
const preloadedRoute = (0, utils_1.getPreloadedRouteFromRootStateByHref)(currentHref.current, state);
const routeKey = preloadedRoute?.key;
const tabPathFromRootState = (0, utils_1.getTabPathFromRootStateByHref)(currentHref.current, state);
// Without this timeout react-native does not have enough time to mount the new screen
// and thus it will not be found on the native side
if (routeKey || tabPathFromRootState.length) {
setTimeout(() => {
internalSetNextScreenId(routeKey);
setOpenPreviewKey(routeKey);
setTabPath(tabPathFromRootState);
});
}
// We got the preloaded state, so we can reset the currentHref
// to prevent unnecessary processing
currentHref.current = undefined;
}
});
}, []);
const prefetch = (0, react_1.useCallback)((href) => {
// Resetting the nextScreenId to undefined
internalSetNextScreenId(undefined);
router.prefetch(href);
currentHref.current = href;
}, [router.prefetch]);
return [{ nextScreenId: internalNextScreenId, tabPath }, prefetch];
}
//# sourceMappingURL=useNextScreenId.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useNextScreenId.js","sourceRoot":"","sources":["../../../src/link/preview/useNextScreenId.ts"],"names":[],"mappings":";;AASA,0CA4CC;AArDD,iCAAiE;AAEjE,6DAA6D;AAE7D,mCAA8F;AAC9F,kEAAwD;AACxD,uCAAwC;AAGxC,SAAgB,eAAe;IAI7B,MAAM,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC3B,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAA,0CAAqB,GAAE,CAAC;IACtD,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,IAAA,gBAAQ,GAAsB,CAAC;IACvF,MAAM,WAAW,GAAG,IAAA,cAAM,EAAmB,SAAS,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAY,EAAE,CAAC,CAAC;IAEtD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,sFAAsF;QACtF,OAAO,oBAAK,CAAC,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YACtE,qEAAqE;YACrE,IAAI,WAAW,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC;gBACjC,MAAM,cAAc,GAAG,IAAA,4CAAoC,EAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBACxF,MAAM,QAAQ,GAAG,cAAc,EAAE,GAAG,CAAC;gBACrC,MAAM,oBAAoB,GAAG,IAAA,qCAA6B,EAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBACvF,sFAAsF;gBACtF,mDAAmD;gBACnD,IAAI,QAAQ,IAAI,oBAAoB,CAAC,MAAM,EAAE,CAAC;oBAC5C,UAAU,CAAC,GAAG,EAAE;wBACd,uBAAuB,CAAC,QAAQ,CAAC,CAAC;wBAClC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;wBAC5B,UAAU,CAAC,oBAAoB,CAAC,CAAC;oBACnC,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,8DAA8D;gBAC9D,oCAAoC;gBACpC,WAAW,CAAC,OAAO,GAAG,SAAS,CAAC;YAClC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAC1B,CAAC,IAAU,EAAQ,EAAE;QACnB,0CAA0C;QAC1C,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;IAC7B,CAAC,EACD,CAAC,MAAM,CAAC,QAAQ,CAAC,CAClB,CAAC;IACF,OAAO,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useLinkPreviewContext } from './LinkPreviewContext';\nimport { TabPath } from './native';\nimport { getPreloadedRouteFromRootStateByHref, getTabPathFromRootStateByHref } from './utils';\nimport { store } from '../../global-state/router-store';\nimport { useRouter } from '../../hooks';\nimport { Href } from '../../types';\n\nexport function useNextScreenId(): [\n { nextScreenId: string | undefined; tabPath: TabPath[] },\n (href: Href) => void,\n] {\n const router = useRouter();\n const { setOpenPreviewKey } = useLinkPreviewContext();\n const [internalNextScreenId, internalSetNextScreenId] = useState<string | undefined>();\n const currentHref = useRef<Href | undefined>(undefined);\n const [tabPath, setTabPath] = useState<TabPath[]>([]);\n\n useEffect(() => {\n // When screen is prefetched, then the root state is updated with the preloaded route.\n return store.navigationRef.addListener('state', ({ data: { state } }) => {\n // If we have the current href, it means that we prefetched the route\n if (currentHref.current && state) {\n const preloadedRoute = getPreloadedRouteFromRootStateByHref(currentHref.current, state);\n const routeKey = preloadedRoute?.key;\n const tabPathFromRootState = getTabPathFromRootStateByHref(currentHref.current, state);\n // Without this timeout react-native does not have enough time to mount the new screen\n // and thus it will not be found on the native side\n if (routeKey || tabPathFromRootState.length) {\n setTimeout(() => {\n internalSetNextScreenId(routeKey);\n setOpenPreviewKey(routeKey);\n setTabPath(tabPathFromRootState);\n });\n }\n // We got the preloaded state, so we can reset the currentHref\n // to prevent unnecessary processing\n currentHref.current = undefined;\n }\n });\n }, []);\n\n const prefetch = useCallback(\n (href: Href): void => {\n // Resetting the nextScreenId to undefined\n internalSetNextScreenId(undefined);\n router.prefetch(href);\n currentHref.current = href;\n },\n [router.prefetch]\n );\n return [{ nextScreenId: internalNextScreenId, tabPath }, prefetch];\n}\n"]}

12
node_modules/expo-router/build/link/preview/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import { ParamListBase, type NavigationRoute } from '@react-navigation/native';
import { type ReactNavigationState } from '../../global-state/router-store';
import { Href } from '../../types';
import { TabPath } from './native';
export declare function getTabPathFromRootStateByHref(href: Href, rootState: ReactNavigationState): TabPath[];
export declare function getPreloadedRouteFromRootStateByHref(href: Href, rootState: ReactNavigationState): NavigationRoute<ParamListBase, string> | undefined;
export declare function deepEqual(a: {
[key: string]: any;
} | undefined, b: {
[key: string]: any;
} | undefined): boolean;
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/link/preview/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,KAAK,eAAe,EAGrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAS,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEnF,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,oBAAoB,GAC9B,OAAO,EAAE,CA6BX;AAED,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,oBAAoB,GAC9B,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,SAAS,CAgDpD;AAED,wBAAgB,SAAS,CACvB,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,EACrC,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,GACpC,OAAO,CAYT"}

78
node_modules/expo-router/build/link/preview/utils.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTabPathFromRootStateByHref = getTabPathFromRootStateByHref;
exports.getPreloadedRouteFromRootStateByHref = getPreloadedRouteFromRootStateByHref;
exports.deepEqual = deepEqual;
const router_store_1 = require("../../global-state/router-store");
const routing_1 = require("../../global-state/routing");
const href_1 = require("../href");
const navigationParams_1 = require("../../navigationParams");
function getTabPathFromRootStateByHref(href, rootState) {
const hrefState = router_store_1.store.getStateForHref((0, href_1.resolveHref)(href));
const state = rootState;
if (!hrefState || !state) {
return [];
}
// Replicating the logic from `linkTo`
const { navigationRoutes } = (0, routing_1.findDivergentState)(hrefState, state, true);
if (!navigationRoutes.length) {
return [];
}
const tabPath = [];
navigationRoutes.forEach((route, i, arr) => {
if (route.state?.type === 'tab') {
const tabState = route.state;
const oldTabKey = tabState.routes[tabState.index].key;
// The next route will be either stack inside a tab or a new tab key
if (!arr[i + 1]) {
throw new Error(`New tab route is missing for ${route.key}. This is likely an internal Expo Router bug.`);
}
const newTabKey = arr[i + 1].key;
tabPath.push({ oldTabKey, newTabKey });
}
});
return tabPath;
}
function getPreloadedRouteFromRootStateByHref(href, rootState) {
const hrefState = router_store_1.store.getStateForHref((0, href_1.resolveHref)(href));
const state = rootState;
if (!hrefState || !state) {
return undefined;
}
// Replicating the logic from `linkTo`
const { navigationState, actionStateRoute } = (0, routing_1.findDivergentState)(hrefState, state, true);
if (!navigationState || !actionStateRoute) {
return undefined;
}
if (navigationState.type === 'stack') {
const stackState = navigationState;
const payload = (0, routing_1.getPayloadFromStateRoute)(actionStateRoute);
const preloadedRoute = stackState.preloadedRoutes.find((route) => route.name === actionStateRoute.name &&
deepEqual((0, navigationParams_1.removeInternalExpoRouterParams)(route.params), (0, navigationParams_1.removeInternalExpoRouterParams)(payload.params)));
const activeRoute = stackState.routes[stackState.index];
// When the active route is the same as the preloaded route,
// then we should not navigate. It aligns with base link behavior.
if (activeRoute.name === preloadedRoute?.name &&
deepEqual(
// using ?? {}, because from our perspective undefined === {}, as both mean no params
(0, navigationParams_1.removeInternalExpoRouterParams)(activeRoute.params ?? {}), (0, navigationParams_1.removeInternalExpoRouterParams)(payload.params ?? {}))) {
return undefined;
}
return preloadedRoute;
}
return undefined;
}
function deepEqual(a, b) {
if (a === b) {
return true;
}
if (a == null || b == null) {
return false;
}
if (typeof a !== 'object' || typeof b !== 'object') {
return false;
}
const keys = Object.keys(a);
return keys.length === Object.keys(b).length && keys.every((key) => deepEqual(a[key], b[key]));
}
//# sourceMappingURL=utils.js.map

File diff suppressed because one or more lines are too long

221
node_modules/expo-router/build/link/useLinkHooks.d.ts generated vendored Normal file
View File

@@ -0,0 +1,221 @@
import { MouseEvent, type Ref } from 'react';
import { TextProps, GestureResponderEvent, type Text } from 'react-native';
import { Href } from '../types';
import { SingularOptions } from '../useScreens';
/**
* @platform web
*/
export type WebAnchorProps = {
/**
* Specifies where to open the [`href`](#href).
*
* - **_self**: the current tab.
* - **_blank**: opens in a new tab or window.
* - **_parent**: opens in the parent browsing context. If no parent, defaults to **_self**.
* - **_top**: opens in the highest browsing context ancestor. If no ancestors,
* defaults to **_self**.
*
* This property is passed to the underlying anchor (`<a>`) tag.
*
* @default '_self'
*
* @example
* ```jsx
* <Link href="https://expo.dev" target="_blank">Go to Expo in new tab</Link>
* ```
*/
target?: '_self' | '_blank' | '_parent' | '_top' | (string & object);
/**
* Specifies the relationship between the [`href`](#href) and the current route.
*
* Common values:
* - **nofollow**: Indicates to search engines that they should not follow the `href`.
* This is often used for user-generated content or links that should not influence
* search engine rankings.
* - **noopener**: Suggests that the `href` should not have access to the opening
* window's `window.opener` object, which is a security measure to prevent potentially
* harmful behavior in cases of links that open new tabs or windows.
* - **noreferrer**: Requests that the browser does not send the `Referer` HTTP header
* when navigating to the `href`. This can enhance user privacy.
*
* The `rel` property is primarily used for informational and instructive purposes, helping browsers and web
* crawlers make better decisions about how to handle and interpret the links on a web
* page. It is important to use appropriate `rel` values to ensure that links behave as intended and adhere
* to best practices for web development and SEO (Search Engine Optimization).
*
* This property is passed to the underlying anchor (`<a>`) tag.
*
* @example
* ```jsx
* <Link href="https://expo.dev" rel="nofollow">Go to Expo</Link>
* ```
*/
rel?: string;
/**
* Specifies that the [`href`](#href) should be downloaded when the user clicks on the
* link, instead of navigating to it. It is typically used for links that point to
* files that the user should download, such as PDFs, images, documents, and more.
*
* The value of the `download` property, which represents the filename for the
* downloaded file. This property is passed to the underlying anchor (`<a>`) tag.
*
* @example
* ```jsx
* <Link href="/image.jpg" download="my-image.jpg">Download image</Link>
* ```
*/
download?: string;
};
export interface LinkProps extends Omit<TextProps, 'href'>, WebAnchorProps {
/**
* The path of the route to navigate to. It can either be:
* - **string**: A full path like `/profile/settings` or a relative path like `../settings`.
* - **object**: An object with a `pathname` and optional `params`. The `pathname` can be
* a full path like `/profile/settings` or a relative path like `../settings`. The
* params can be an object of key-value pairs.
*
* @example
* ```tsx Dynamic
* import { Link } from 'expo-router';
* import { View } from 'react-native';
*
* export default function Route() {
* return (
* <View>
* <Link href="/about">About</Link>
* <Link
* href={{
* pathname: '/user/[id]',
* params: { id: 'bacon' }
* }}>
* View user
* </Link>
* </View>
* );
*}
* ```
*/
href: Href;
/**
* Used to customize the `Link` component. It will forward all props to the
* first child of the `Link`. Note that the child component must accept
* `onPress` or `onClick` props. The `href` and `role` are also
* passed to the child.
*
* @example
* ```tsx
* import { Link } from 'expo-router';
* import { Pressable, Text } from 'react-native';
*
* export default function Route() {
* return (
* <View>
* <Link href="/home" asChild>
* <Pressable>
* <Text>Home</Text>
* </Pressable>
* </Link>
* </View>
* );
*}
* ```
*/
asChild?: boolean;
/**
* Removes the current route from the history and replace it with the
* specified URL. This is useful for [redirects](/router/reference/redirects/).
*
* @example
*```tsx
* import { Link } from 'expo-router';
* import { View } from 'react-native';
*
* export default function Route() {
* return (
* <View>
* <Link replace href="/feed">Login</Link>
* </View>
* );
*}
* ```
*/
replace?: boolean;
/**
* Always pushes a new route, and never pops or replaces to existing route.
* You can push the current route multiple times or with new parameters.
*
* @example
*```tsx
* import { Link } from 'expo-router';
* import { View } from 'react-native';
*
* export default function Route() {
* return (
* <View>
* <Link push href="/feed">Login</Link>
* </View>
* );
*}
* ```
*/
push?: boolean;
/**
* While in a stack, this will dismiss screens until the provided `href` is reached. If the href is not found,
* it will instead replace the current screen with the provided `href`.
*
* @example
*```tsx
* import { Link } from 'expo-router';
* import { View } from 'react-native';
*
* export default function Route() {
* return (
* <View>
* <Link dismissTo href="/feed">Close modal</Link>
* </View>
* );
*}
* ```
*/
dismissTo?: boolean;
/**
* On native, this can be used with CSS interop tools like Nativewind.
* On web, this sets the HTML `class` directly.
*/
className?: string;
onPress?: (event: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => void;
/**
* Relative URL references are either relative to the directory or the document.
* By default, relative paths are relative to the document.
*
* @see [Resolving relative references in Mozilla's documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).
*/
relativeToDirectory?: boolean;
/**
* Replaces the initial screen with the current route.
*/
withAnchor?: boolean;
/**
* When navigating in a Stack, if the target is valid then screens in the history that matches
* the uniqueness constraint will be removed.
*
* If used with `push`, the history will be filtered even if no navigation occurs.
*/
dangerouslySingular?: SingularOptions;
/**
* Prefetches the route when the component is rendered on a focused screen.
*/
prefetch?: boolean;
ref?: Ref<Text>;
}
export declare function useInteropClassName(props: {
style?: TextProps['style'];
className?: string;
}): false | "" | import("react-native").TextStyle | (import("react-native").Falsy | import("react-native").TextStyle | import("react-native").RecursiveArray<import("react-native").Falsy | import("react-native").TextStyle> | readonly (import("react-native").Falsy | import("react-native").TextStyle)[] | {
$$css: boolean;
__routerLinkClassName: string;
})[] | null | undefined;
export declare const useHrefAttrs: (props: Partial<LinkProps>) => {
hrefAttrs?: any;
} & Partial<LinkProps>;
//# sourceMappingURL=useLinkHooks.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useLinkHooks.d.ts","sourceRoot":"","sources":["../../src/link/useLinkHooks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAY,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAErF,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAErE;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAGF,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,cAAc;IACxE;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,IAAI,EAAE,IAAI,CAAC;IAGX;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,qBAAqB,KAAK,IAAI,CAAC;IAEjF;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,eAAe,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,GAAG,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;CACjB;AAGD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;;;wBAoB5F;AAED,eAAO,MAAM,YAAY,UACf,OAAO,CAAC,SAAS,CAAC,KAAK;IAAE,SAAS,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,OAAO,CAAC,SAAS,CAoBtE,CAAC"}

50
node_modules/expo-router/build/link/useLinkHooks.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
'use client';
Object.defineProperty(exports, "__esModule", { value: true });
exports.useHrefAttrs = void 0;
exports.useInteropClassName = useInteropClassName;
// Fork of @react-navigation/native Link.tsx with `href` and `replace` support added and
// `to` / `action` support removed.
const react_1 = require("react");
const react_native_1 = require("react-native");
// Mutate the style prop to add the className on web.
function useInteropClassName(props) {
if (react_native_1.Platform.OS !== 'web') {
return props.style;
}
// eslint-disable-next-line react-hooks/rules-of-hooks
return (0, react_1.useMemo)(() => {
if (props.className == null) {
return props.style;
}
const cssStyle = {
$$css: true,
__routerLinkClassName: props.className,
};
if (Array.isArray(props.style)) {
return [...props.style, cssStyle];
}
return [props.style, cssStyle];
}, [props.style, props.className]);
}
exports.useHrefAttrs = react_native_1.Platform.select({
web: function useHrefAttrs({ asChild, rel, target, download }) {
return (0, react_1.useMemo)(() => {
const hrefAttrs = {
rel,
target,
download,
};
if (asChild) {
return hrefAttrs;
}
return {
hrefAttrs,
};
}, [asChild, rel, target, download]);
},
default: function useHrefAttrs() {
return {};
},
});
//# sourceMappingURL=useLinkHooks.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
import { MouseEvent } from 'react';
import { GestureResponderEvent } from 'react-native';
import { LinkToOptions } from '../global-state/routing';
type UseLinkToPathPropsOptions = LinkToOptions & {
href: string;
};
export default function useLinkToPathProps({ href, ...options }: UseLinkToPathPropsOptions): {
href: string;
role: "link";
onPress: (event?: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => void;
};
export declare function shouldHandleMouseEvent(event?: MouseEvent<HTMLAnchorElement> | GestureResponderEvent): boolean;
export {};
//# sourceMappingURL=useLinkToPathProps.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useLinkToPathProps.d.ts","sourceRoot":"","sources":["../../src/link/useLinkToPathProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAY,MAAM,cAAc,CAAC;AAI/D,OAAO,EAAU,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA4BhE,KAAK,yBAAyB,GAAG,aAAa,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,yBAAyB;;;sBAC/D,UAAU,CAAC,iBAAiB,CAAC,GAAG,qBAAqB;EAqB/E;AAED,wBAAgB,sBAAsB,CACpC,KAAK,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,qBAAqB,WAY9D"}

View File

@@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = useLinkToPathProps;
exports.shouldHandleMouseEvent = shouldHandleMouseEvent;
const react_native_1 = require("react-native");
const emitDomEvent_1 = require("../domComponents/emitDomEvent");
const getPathFromState_forks_1 = require("../fork/getPathFromState-forks");
const routing_1 = require("../global-state/routing");
const matchers_1 = require("../matchers");
const url_1 = require("../utils/url");
function eventShouldPreventDefault(e) {
if (e?.defaultPrevented) {
return false;
}
if (
// Only check MouseEvents
'button' in e &&
// ignore clicks with modifier keys
!e.metaKey &&
!e.altKey &&
!e.ctrlKey &&
!e.shiftKey &&
(e.button == null || e.button === 0) && // Only accept left clicks
[undefined, null, '', 'self'].includes(e.currentTarget.target) // let browser handle "target=_blank" etc.
) {
return true;
}
return false;
}
function useLinkToPathProps({ href, ...options }) {
const onPress = (event) => {
if (shouldHandleMouseEvent(event)) {
if ((0, emitDomEvent_1.emitDomLinkEvent)(href, options)) {
return;
}
(0, routing_1.linkTo)(href, options);
}
};
let strippedHref = (0, matchers_1.stripGroupSegmentsFromPath)(href) || '/';
// Append base url only if needed.
if (!(0, url_1.shouldLinkExternally)(strippedHref)) {
strippedHref = (0, getPathFromState_forks_1.appendBaseUrl)(strippedHref);
}
return {
href: strippedHref,
role: 'link',
onPress,
};
}
function shouldHandleMouseEvent(event) {
if (react_native_1.Platform.OS !== 'web') {
return !event?.defaultPrevented;
}
if (event && eventShouldPreventDefault(event)) {
event.preventDefault();
return true;
}
return false;
}
//# sourceMappingURL=useLinkToPathProps.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useLinkToPathProps.js","sourceRoot":"","sources":["../../src/link/useLinkToPathProps.tsx"],"names":[],"mappings":";;AAqCA,qCAsBC;AAED,wDAaC;AAzED,+CAA+D;AAE/D,gEAAiE;AACjE,2EAA+D;AAC/D,qDAAgE;AAChE,0CAAyD;AACzD,sCAAoD;AAEpD,SAAS,yBAAyB,CAChC,CAAwD;IAExD,IAAI,CAAC,EAAE,gBAAgB,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;IACE,yBAAyB;IACzB,QAAQ,IAAI,CAAC;QACb,mCAAmC;QACnC,CAAC,CAAC,CAAC,OAAO;QACV,CAAC,CAAC,CAAC,MAAM;QACT,CAAC,CAAC,CAAC,OAAO;QACV,CAAC,CAAC,CAAC,QAAQ;QACX,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,0BAA0B;QAClE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,0CAA0C;MACzG,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAMD,SAAwB,kBAAkB,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAA6B;IACxF,MAAM,OAAO,GAAG,CAAC,KAA6D,EAAE,EAAE;QAChF,IAAI,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC;YAClC,IAAI,IAAA,+BAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;gBACpC,OAAO;YACT,CAAC;YACD,IAAA,gBAAM,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxB,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,YAAY,GAAG,IAAA,qCAA0B,EAAC,IAAI,CAAC,IAAI,GAAG,CAAC;IAE3D,kCAAkC;IAClC,IAAI,CAAC,IAAA,0BAAoB,EAAC,YAAY,CAAC,EAAE,CAAC;QACxC,YAAY,GAAG,IAAA,sCAAa,EAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,MAAe;QACrB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CACpC,KAA6D;IAE7D,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAClC,CAAC;IAED,IAAI,KAAK,IAAI,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { MouseEvent } from 'react';\nimport { GestureResponderEvent, Platform } from 'react-native';\n\nimport { emitDomLinkEvent } from '../domComponents/emitDomEvent';\nimport { appendBaseUrl } from '../fork/getPathFromState-forks';\nimport { linkTo, LinkToOptions } from '../global-state/routing';\nimport { stripGroupSegmentsFromPath } from '../matchers';\nimport { shouldLinkExternally } from '../utils/url';\n\nfunction eventShouldPreventDefault(\n e: MouseEvent<HTMLAnchorElement> | GestureResponderEvent\n): boolean {\n if (e?.defaultPrevented) {\n return false;\n }\n\n if (\n // Only check MouseEvents\n 'button' in e &&\n // ignore clicks with modifier keys\n !e.metaKey &&\n !e.altKey &&\n !e.ctrlKey &&\n !e.shiftKey &&\n (e.button == null || e.button === 0) && // Only accept left clicks\n [undefined, null, '', 'self'].includes(e.currentTarget.target) // let browser handle \"target=_blank\" etc.\n ) {\n return true;\n }\n\n return false;\n}\n\ntype UseLinkToPathPropsOptions = LinkToOptions & {\n href: string;\n};\n\nexport default function useLinkToPathProps({ href, ...options }: UseLinkToPathPropsOptions) {\n const onPress = (event?: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => {\n if (shouldHandleMouseEvent(event)) {\n if (emitDomLinkEvent(href, options)) {\n return;\n }\n linkTo(href, options);\n }\n };\n\n let strippedHref = stripGroupSegmentsFromPath(href) || '/';\n\n // Append base url only if needed.\n if (!shouldLinkExternally(strippedHref)) {\n strippedHref = appendBaseUrl(strippedHref);\n }\n\n return {\n href: strippedHref,\n role: 'link' as const,\n onPress,\n };\n}\n\nexport function shouldHandleMouseEvent(\n event?: MouseEvent<HTMLAnchorElement> | GestureResponderEvent\n) {\n if (Platform.OS !== 'web') {\n return !event?.defaultPrevented;\n }\n\n if (event && eventShouldPreventDefault(event)) {\n event.preventDefault();\n return true;\n }\n\n return false;\n}\n"]}

View File

@@ -0,0 +1,9 @@
import { NavigationProp, NavigationState } from '@react-navigation/native';
type GenericNavigation = NavigationProp<ReactNavigation.RootParamList> & {
getState(): NavigationState | undefined;
};
/** Returns a callback which is invoked when the navigation state has loaded. */
export declare function useLoadedNavigation(): (fn: (navigation: GenericNavigation) => void) => void;
export declare function useOptionalNavigation(): GenericNavigation | null;
export {};
//# sourceMappingURL=useLoadedNavigation.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useLoadedNavigation.d.ts","sourceRoot":"","sources":["../../src/link/useLoadedNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,0BAA0B,CAAC;AAK1F,KAAK,iBAAiB,GAAG,cAAc,CAAC,eAAe,CAAC,aAAa,CAAC,GAAG;IACvE,QAAQ,IAAI,eAAe,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,mBAAmB,SA6B1B,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,UAU/C;AAED,wBAAgB,qBAAqB,IAAI,iBAAiB,GAAG,IAAI,CAShE"}

View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useLoadedNavigation = useLoadedNavigation;
exports.useOptionalNavigation = useOptionalNavigation;
const native_1 = require("@react-navigation/native");
const react_1 = require("react");
const router_store_1 = require("../global-state/router-store");
/** Returns a callback which is invoked when the navigation state has loaded. */
function useLoadedNavigation() {
const navigation = (0, native_1.useNavigation)();
const isMounted = (0, react_1.useRef)(true);
const pending = (0, react_1.useRef)([]);
(0, react_1.useEffect)(() => {
isMounted.current = true;
return () => {
isMounted.current = false;
};
}, []);
const flush = (0, react_1.useCallback)(() => {
if (isMounted.current) {
const pendingCallbacks = pending.current;
pending.current = [];
pendingCallbacks.forEach((callback) => {
callback(navigation);
});
}
}, [navigation]);
(0, react_1.useEffect)(() => {
if (router_store_1.store.navigationRef.current) {
flush();
}
}, [flush]);
const push = (0, react_1.useCallback)((fn) => {
pending.current.push(fn);
if (router_store_1.store.navigationRef.current) {
flush();
}
}, [flush]);
return push;
}
function useOptionalNavigation() {
const [navigation, setNavigation] = (0, react_1.useState)(null);
const loadNavigation = useLoadedNavigation();
(0, react_1.useEffect)(() => {
loadNavigation((nav) => setNavigation(nav));
}, []);
return navigation;
}
//# sourceMappingURL=useLoadedNavigation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useLoadedNavigation.js","sourceRoot":"","sources":["../../src/link/useLoadedNavigation.ts"],"names":[],"mappings":";;AAUA,kDAuCC;AAED,sDASC;AA5DD,qDAA0F;AAC1F,iCAAiE;AAEjE,+DAAqD;AAMrD,gFAAgF;AAChF,SAAgB,mBAAmB;IACjC,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,SAAS,GAAG,IAAA,cAAM,EAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAA,cAAM,EAA8C,EAAE,CAAC,CAAC;IAExE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;QACzB,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC7B,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,MAAM,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;YACzC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;YACrB,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACpC,QAAQ,CAAC,UAA+B,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,oBAAK,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAChC,KAAK,EAAE,CAAC;QACV,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,IAAI,GAAG,IAAA,mBAAW,EACtB,CAAC,EAA2C,EAAE,EAAE;QAC9C,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzB,IAAI,oBAAK,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAChC,KAAK,EAAE,CAAC;QACV,CAAC;IACH,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,qBAAqB;IACnC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAA2B,IAAI,CAAC,CAAC;IAC7E,MAAM,cAAc,GAAG,mBAAmB,EAAE,CAAC;IAE7C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,cAAc,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { NavigationProp, NavigationState, useNavigation } from '@react-navigation/native';\nimport { useCallback, useState, useEffect, useRef } from 'react';\n\nimport { store } from '../global-state/router-store';\n\ntype GenericNavigation = NavigationProp<ReactNavigation.RootParamList> & {\n getState(): NavigationState | undefined;\n};\n\n/** Returns a callback which is invoked when the navigation state has loaded. */\nexport function useLoadedNavigation() {\n const navigation = useNavigation();\n const isMounted = useRef(true);\n const pending = useRef<((navigation: GenericNavigation) => void)[]>([]);\n\n useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const flush = useCallback(() => {\n if (isMounted.current) {\n const pendingCallbacks = pending.current;\n pending.current = [];\n pendingCallbacks.forEach((callback) => {\n callback(navigation as GenericNavigation);\n });\n }\n }, [navigation]);\n\n useEffect(() => {\n if (store.navigationRef.current) {\n flush();\n }\n }, [flush]);\n\n const push = useCallback(\n (fn: (navigation: GenericNavigation) => void) => {\n pending.current.push(fn);\n if (store.navigationRef.current) {\n flush();\n }\n },\n [flush]\n );\n\n return push;\n}\n\nexport function useOptionalNavigation(): GenericNavigation | null {\n const [navigation, setNavigation] = useState<GenericNavigation | null>(null);\n const loadNavigation = useLoadedNavigation();\n\n useEffect(() => {\n loadNavigation((nav) => setNavigation(nav));\n }, []);\n\n return navigation;\n}\n"]}

View File

@@ -0,0 +1,5 @@
import type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';
export declare function disableZoomTransition(): void;
export declare function isZoomTransitionEnabled(): boolean;
export declare function ZoomTransitionEnabler(props: ZoomTransitionEnablerProps): null;
//# sourceMappingURL=ZoomTransitionEnabler.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ZoomTransitionEnabler.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAEhF,wBAAgB,qBAAqB,SAAK;AAE1C,wBAAgB,uBAAuB,YAEtC;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,QAEtE"}

View File

@@ -0,0 +1,16 @@
import type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';
import { INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME, INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME } from '../../navigationParams';
export declare function disableZoomTransition(): void;
export declare function isZoomTransitionEnabled(): boolean;
export declare function ZoomTransitionEnabler({ route }: ZoomTransitionEnablerProps): import("react").JSX.Element | null;
/**
* @internal
*/
export declare function useShouldEnableZoomTransition(route: unknown): route is {
key: string;
params: {
[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME]: string;
[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME]: string;
};
};
//# sourceMappingURL=ZoomTransitionEnabler.ios.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ZoomTransitionEnabler.ios.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.ios.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAGhF,OAAO,EAGL,yDAAyD,EACzD,yDAAyD,EAC1D,MAAM,wBAAwB,CAAC;AAOhC,wBAAgB,qBAAqB,SAEpC;AAED,wBAAgB,uBAAuB,YAEtC;AAED,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE,0BAA0B,sCAmC1E;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE;QACN,CAAC,yDAAyD,CAAC,EAAE,MAAM,CAAC;QACpE,CAAC,yDAAyD,CAAC,EAAE,MAAM,CAAC;KACrE,CAAC;CACH,CAuCA"}

View File

@@ -0,0 +1,84 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.disableZoomTransition = disableZoomTransition;
exports.isZoomTransitionEnabled = isZoomTransitionEnabled;
exports.ZoomTransitionEnabler = ZoomTransitionEnabler;
exports.useShouldEnableZoomTransition = useShouldEnableZoomTransition;
const react_1 = require("react");
const zoom_transition_context_1 = require("./zoom-transition-context");
const descriptors_context_1 = require("../../fork/native-stack/descriptors-context");
const navigationParams_1 = require("../../navigationParams");
const stackPresentation_1 = require("../../utils/stackPresentation");
const PreviewRouteContext_1 = require("../preview/PreviewRouteContext");
const native_1 = require("../preview/native");
let _isZoomTransitionEnabled = process.env.EXPO_OS === 'ios';
function disableZoomTransition() {
_isZoomTransitionEnabled = false;
}
function isZoomTransitionEnabled() {
return _isZoomTransitionEnabled;
}
function ZoomTransitionEnabler({ route }) {
const shouldEnableZoomTransition = useShouldEnableZoomTransition(route);
const targetContext = (0, react_1.use)(zoom_transition_context_1.ZoomTransitionTargetContext);
(0, react_1.useLayoutEffect)(() => {
if (shouldEnableZoomTransition && targetContext?.addEnabler && targetContext?.removeEnabler) {
targetContext.addEnabler();
return () => {
targetContext.removeEnabler();
};
}
return () => { };
}, [shouldEnableZoomTransition]);
if (shouldEnableZoomTransition) {
const params = route.params;
const zoomTransitionId = params[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];
// Read dismissalBoundsRect from context (set by usePreventZoomTransitionDismissal hook)
const dismissalBoundsRect = targetContext.dismissalBoundsRect;
// Read gestureEnabled from the screen descriptor so that gestureEnabled: false
// automatically blocks the native zoom transition dismissal gesture,
// even when the user hasn't called usePreventZoomTransitionDismissal().
const descriptorsMap = (0, react_1.use)(descriptors_context_1.DescriptorsContext);
const gestureEnabled = descriptorsMap[route.key]?.options?.gestureEnabled;
const effectiveDismissalBoundsRect = dismissalBoundsRect ?? (gestureEnabled === false ? { maxX: 0, maxY: 0 } : null);
return (<native_1.LinkZoomTransitionEnabler zoomTransitionSourceIdentifier={zoomTransitionId} dismissalBoundsRect={effectiveDismissalBoundsRect}/>);
}
return null;
}
/**
* @internal
*/
function useShouldEnableZoomTransition(route) {
const isPreview = (0, PreviewRouteContext_1.useIsPreview)();
if (isZoomTransitionEnabled() &&
!isPreview &&
route &&
typeof route === 'object' &&
'params' in route &&
typeof route.params === 'object' &&
route.params &&
'key' in route &&
typeof route.key === 'string') {
const params = route.params;
const internalParams = (0, navigationParams_1.getInternalExpoRouterParams)(params);
const zoomTransitionId = internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];
const zoomTransitionScreenId = internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME];
const hasZoomTransition = !!zoomTransitionId && zoomTransitionScreenId === route.key;
if (hasZoomTransition && typeof zoomTransitionId === 'string') {
// Read gestureEnabled from the screen descriptor so that gestureEnabled: false
// automatically blocks the native zoom transition dismissal gesture,
// even when the user hasn't called usePreventZoomTransitionDismissal().
const descriptorsMap = (0, react_1.use)(descriptors_context_1.DescriptorsContext);
const isLinkPreviewNavigation = !!internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME];
const isPresentedAsModal = (0, stackPresentation_1.isModalPresentation)(descriptorsMap[route.key]?.options);
if (isLinkPreviewNavigation && !isPresentedAsModal) {
console.warn('[expo-router] Zoom transition with link preview is only supported for screens presented modally. Please set the screen presentation to "fullScreenModal" or another modal presentation style.');
}
else {
return true;
}
}
}
return false;
}
//# sourceMappingURL=ZoomTransitionEnabler.ios.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.disableZoomTransition = disableZoomTransition;
exports.isZoomTransitionEnabled = isZoomTransitionEnabled;
exports.ZoomTransitionEnabler = ZoomTransitionEnabler;
function disableZoomTransition() { }
function isZoomTransitionEnabled() {
return false;
}
function ZoomTransitionEnabler(props) {
return null;
}
//# sourceMappingURL=ZoomTransitionEnabler.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ZoomTransitionEnabler.js","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.tsx"],"names":[],"mappings":";;AAEA,sDAA0C;AAE1C,0DAEC;AAED,sDAEC;AARD,SAAgB,qBAAqB,KAAI,CAAC;AAE1C,SAAgB,uBAAuB;IACrC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,qBAAqB,CAAC,KAAiC;IACrE,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';\n\nexport function disableZoomTransition() {}\n\nexport function isZoomTransitionEnabled() {\n return false;\n}\n\nexport function ZoomTransitionEnabler(props: ZoomTransitionEnablerProps) {\n return null;\n}\n"]}

View File

@@ -0,0 +1,4 @@
export interface ZoomTransitionEnablerProps {
route?: unknown;
}
//# sourceMappingURL=ZoomTransitionEnabler.types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ZoomTransitionEnabler.types.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=ZoomTransitionEnabler.types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ZoomTransitionEnabler.types.js","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface ZoomTransitionEnablerProps {\n route?: unknown;\n}\n"]}

View File

@@ -0,0 +1,25 @@
import { type ReactNode } from 'react';
/**
* Defines the target for an Apple zoom transition.
*
* @example
* ```tsx
* import { Link } from 'expo-router';
*
* export default function Screen() {
* return (
* <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
* <Link.AppleZoomTarget>
* <Image source={require('../assets/image.png')} style={{ width: 200, height: 200 }} />
* </Link.AppleZoomTarget>
* </View>
* );
* }
* ```
*
* @platform ios 18+
*/
export declare function LinkAppleZoomTarget({ children }: {
children?: ReactNode;
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
//# sourceMappingURL=link-apple-zoom-target.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"link-apple-zoom-target.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/link-apple-zoom-target.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,+TAgBzE"}

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkAppleZoomTarget = LinkAppleZoomTarget;
const react_1 = require("react");
const zoom_transition_context_1 = require("./zoom-transition-context");
const native_1 = require("../preview/native");
/**
* Defines the target for an Apple zoom transition.
*
* @example
* ```tsx
* import { Link } from 'expo-router';
*
* export default function Screen() {
* return (
* <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
* <Link.AppleZoomTarget>
* <Image source={require('../assets/image.png')} style={{ width: 200, height: 200 }} />
* </Link.AppleZoomTarget>
* </View>
* );
* }
* ```
*
* @platform ios 18+
*/
function LinkAppleZoomTarget({ children }) {
if (react_1.Children.count(children) > 1) {
console.warn('[expo-router] Link.AppleZoomTarget only accepts a single child component. Please wrap multiple children in a View or another container component.');
return null;
}
const { identifier } = (0, react_1.use)(zoom_transition_context_1.ZoomTransitionTargetContext);
if (!identifier) {
return children;
}
return (<native_1.LinkZoomTransitionAlignmentRectDetector identifier={identifier}>
{children}
</native_1.LinkZoomTransitionAlignmentRectDetector>);
}
//# sourceMappingURL=link-apple-zoom-target.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"link-apple-zoom-target.js","sourceRoot":"","sources":["../../../src/link/zoom/link-apple-zoom-target.tsx"],"names":[],"mappings":";;AAyBA,kDAgBC;AAzCD,iCAAsD;AAEtD,uEAAwE;AACxE,8CAA4E;AAE5E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAA4B;IACxE,IAAI,gBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,CACV,mJAAmJ,CACpJ,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,WAAG,EAAC,qDAA2B,CAAC,CAAC;IACxD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,CACL,CAAC,gDAAuC,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAC9D;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,gDAAuC,CAAC,CAC3C,CAAC;AACJ,CAAC","sourcesContent":["import { Children, use, type ReactNode } from 'react';\n\nimport { ZoomTransitionTargetContext } from './zoom-transition-context';\nimport { LinkZoomTransitionAlignmentRectDetector } from '../preview/native';\n\n/**\n * Defines the target for an Apple zoom transition.\n *\n * @example\n * ```tsx\n * import { Link } from 'expo-router';\n *\n * export default function Screen() {\n * return (\n * <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>\n * <Link.AppleZoomTarget>\n * <Image source={require('../assets/image.png')} style={{ width: 200, height: 200 }} />\n * </Link.AppleZoomTarget>\n * </View>\n * );\n * }\n * ```\n *\n * @platform ios 18+\n */\nexport function LinkAppleZoomTarget({ children }: { children?: ReactNode }) {\n if (Children.count(children) > 1) {\n console.warn(\n '[expo-router] Link.AppleZoomTarget only accepts a single child component. Please wrap multiple children in a View or another container component.'\n );\n return null;\n }\n const { identifier } = use(ZoomTransitionTargetContext);\n if (!identifier) {\n return children;\n }\n return (\n <LinkZoomTransitionAlignmentRectDetector identifier={identifier}>\n {children}\n </LinkZoomTransitionAlignmentRectDetector>\n );\n}\n"]}

View File

@@ -0,0 +1,22 @@
import { type PropsWithChildren } from 'react';
export interface LinkAppleZoomProps extends PropsWithChildren {
/**
* Defines the rectangle used for the zoom transition's alignment. This rectangle is specified in the zoomed screen's coordinate space.
*
* @platform ios 18+
*/
alignmentRect?: {
x: number;
y: number;
width: number;
height: number;
};
}
/**
* When this component is used inside a Link, [zoom transition](https://developer.apple.com/documentation/uikit/enhancing-your-app-with-fluid-transitions?language=objc)
* will be used when navigating to the link's href.
*
* @platform ios 18+
*/
export declare function LinkAppleZoom(props: LinkAppleZoomProps): import("react").JSX.Element;
//# sourceMappingURL=link-apple-zoom.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"link-apple-zoom.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/link-apple-zoom.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAOzE,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D;;;;OAIG;IACH,aAAa,CAAC,EAAE;QACd,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAKtD"}

View File

@@ -0,0 +1,47 @@
"use strict";
'use client';
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkAppleZoom = LinkAppleZoom;
const react_1 = require("react");
const ZoomTransitionEnabler_1 = require("./ZoomTransitionEnabler");
const zoom_transition_context_1 = require("./zoom-transition-context");
const Slot_1 = require("../../ui/Slot");
const native_1 = require("../preview/native");
/**
* When this component is used inside a Link, [zoom transition](https://developer.apple.com/documentation/uikit/enhancing-your-app-with-fluid-transitions?language=objc)
* will be used when navigating to the link's href.
*
* @platform ios 18+
*/
function LinkAppleZoom(props) {
if (!(0, ZoomTransitionEnabler_1.isZoomTransitionEnabled)()) {
return <Slot_1.Slot {...props}/>;
}
return <LinkAppleZoomImpl {...props}/>;
}
function LinkAppleZoomImpl({ children, alignmentRect, ...rest }) {
const value = (0, react_1.use)(zoom_transition_context_1.ZoomTransitionSourceContext);
if (!value) {
throw new Error('[expo-router] Link.ZoomTransitionSource must be used within a Link');
}
const { identifier, addSource, removeSource } = value;
(0, react_1.useEffect)(() => {
addSource();
return removeSource;
}, [addSource, removeSource]);
const hasTooManyChildren = react_1.Children.count(children) > 1;
(0, react_1.useEffect)(() => {
if (process.env.NODE_ENV !== 'production' && hasTooManyChildren) {
console.warn('[expo-router] Link.ZoomTransitionSource only accepts a single child component. Please wrap multiple children in a View or another container component.');
}
}, [hasTooManyChildren]);
if (hasTooManyChildren) {
return null;
}
return (<native_1.LinkZoomTransitionSource identifier={identifier} alignment={alignmentRect}
// Note(@ubax): Even though we always set this to true, I want to keep the prop here for easier future changes.
animateAspectRatioChange>
<Slot_1.Slot {...rest}>{children}</Slot_1.Slot>
</native_1.LinkZoomTransitionSource>);
}
//# sourceMappingURL=link-apple-zoom.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"link-apple-zoom.js","sourceRoot":"","sources":["../../../src/link/zoom/link-apple-zoom.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA6Bb,sCAKC;AAhCD,iCAAyE;AAEzE,mEAAkE;AAClE,uEAAwE;AACxE,wCAAqC;AACrC,8CAA6D;AAgB7D;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAyB;IACrD,IAAI,CAAC,IAAA,+CAAuB,GAAE,EAAE,CAAC;QAC/B,OAAO,CAAC,WAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC1C,CAAC;AAMD,SAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,EAA0B;IACrF,MAAM,KAAK,GAAG,IAAA,WAAG,EAAC,qDAA2B,CAAC,CAAC;IAC/C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;IACxF,CAAC;IACD,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAEtD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,SAAS,EAAE,CAAC;QACZ,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;IAE9B,MAAM,kBAAkB,GAAG,gBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAExD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,kBAAkB,EAAE,CAAC;YAChE,OAAO,CAAC,IAAI,CACV,wJAAwJ,CACzJ,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,CAAC,iCAAwB,CACvB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,SAAS,CAAC,CAAC,aAAa,CAAC;IACzB,+GAA+G;IAC/G,wBAAwB,CACxB;MAAA,CAAC,WAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,WAAI,CAClC;IAAA,EAAE,iCAAwB,CAAC,CAC5B,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { Children, use, useEffect, type PropsWithChildren } from 'react';\n\nimport { isZoomTransitionEnabled } from './ZoomTransitionEnabler';\nimport { ZoomTransitionSourceContext } from './zoom-transition-context';\nimport { Slot } from '../../ui/Slot';\nimport { LinkZoomTransitionSource } from '../preview/native';\n\nexport interface LinkAppleZoomProps extends PropsWithChildren {\n /**\n * Defines the rectangle used for the zoom transition's alignment. This rectangle is specified in the zoomed screen's coordinate space.\n *\n * @platform ios 18+\n */\n alignmentRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n}\n\n/**\n * When this component is used inside a Link, [zoom transition](https://developer.apple.com/documentation/uikit/enhancing-your-app-with-fluid-transitions?language=objc)\n * will be used when navigating to the link's href.\n *\n * @platform ios 18+\n */\nexport function LinkAppleZoom(props: LinkAppleZoomProps) {\n if (!isZoomTransitionEnabled()) {\n return <Slot {...props} />;\n }\n return <LinkAppleZoomImpl {...props} />;\n}\n\ntype LinkAppleZoomImplProps = LinkAppleZoomProps & {\n onPress?: () => void;\n};\n\nfunction LinkAppleZoomImpl({ children, alignmentRect, ...rest }: LinkAppleZoomImplProps) {\n const value = use(ZoomTransitionSourceContext);\n if (!value) {\n throw new Error('[expo-router] Link.ZoomTransitionSource must be used within a Link');\n }\n const { identifier, addSource, removeSource } = value;\n\n useEffect(() => {\n addSource();\n return removeSource;\n }, [addSource, removeSource]);\n\n const hasTooManyChildren = Children.count(children) > 1;\n\n useEffect(() => {\n if (process.env.NODE_ENV !== 'production' && hasTooManyChildren) {\n console.warn(\n '[expo-router] Link.ZoomTransitionSource only accepts a single child component. Please wrap multiple children in a View or another container component.'\n );\n }\n }, [hasTooManyChildren]);\n\n if (hasTooManyChildren) {\n return null;\n }\n\n return (\n <LinkZoomTransitionSource\n identifier={identifier}\n alignment={alignmentRect}\n // Note(@ubax): Even though we always set this to true, I want to keep the prop here for easier future changes.\n animateAspectRatioChange>\n <Slot {...rest}>{children}</Slot>\n </LinkZoomTransitionSource>\n );\n}\n"]}

View File

@@ -0,0 +1,36 @@
import type { UsePreventZoomTransitionDismissalOptions } from './usePreventZoomTransitionDismissal.types';
/**
* Limits the screen area where interactive dismissal gestures are allowed for zoom transitions.
*
* This hook must be called from the destination screen of a zoom transition (the screen you navigate to, not the source).
* It restricts where app users can start swipe gestures to dismiss the screen and return to the previous screen.
*
* When a dismissal gesture starts inside the bounds, the screen can be dismissed. When a dismissal gesture starts outside
* the bounds, dismissal is blocked completely. Undefined coordinates place no restriction on that dimension.
*
* > **Note**: Only one instance of this hook should be used per screen. If multiple instances exist, the last one to render will take effect.
*
* @example
* ```tsx
* // In your destination screen (e.g., app/image.tsx)
* import { usePreventZoomTransitionDismissal } from 'expo-router';
* import { useWindowDimensions } from 'react-native';
* import { Image } from 'expo-image';
*
* export default function ImageScreen() {
* const dimensions = useWindowDimensions();
* // Only allow dismissal from the bottom 200px of the screen
* usePreventZoomTransitionDismissal({
* unstable_dismissalBoundsRect: {
* minY: dimensions.height - 200
* }
* });
*
* return <Image source={...} style={{ flex: 1 }} />;
* }
* ```
*
* @platform ios
*/
export declare function usePreventZoomTransitionDismissal(_options?: UsePreventZoomTransitionDismissalOptions): void;
//# sourceMappingURL=usePreventZoomTransitionDismissal.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"usePreventZoomTransitionDismissal.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/usePreventZoomTransitionDismissal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,2CAA2C,CAAC;AAE1G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,CAAC,EAAE,wCAAwC,QAGpD"}

View File

@@ -0,0 +1,3 @@
import type { UsePreventZoomTransitionDismissalOptions } from './usePreventZoomTransitionDismissal.types';
export declare function usePreventZoomTransitionDismissal(options?: UsePreventZoomTransitionDismissalOptions): void;
//# sourceMappingURL=usePreventZoomTransitionDismissal.ios.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"usePreventZoomTransitionDismissal.ios.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/usePreventZoomTransitionDismissal.ios.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,2CAA2C,CAAC;AAU1G,wBAAgB,iCAAiC,CAC/C,OAAO,CAAC,EAAE,wCAAwC,QA6EnD"}

Some files were not shown because too many files have changed in this diff Show More