expo-router 7.0.0-canary-20251216-3f01dbf → 7.0.0-canary-20251223-b83b31e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +2 -2
- package/build/color/index.d.ts +44 -0
- package/build/color/index.d.ts.map +1 -1
- package/build/color/index.js +69 -5
- package/build/color/index.js.map +1 -1
- package/build/exports.d.ts +1 -0
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js +3 -1
- package/build/exports.js.map +1 -1
- package/build/layouts/StackClient.d.ts +1 -1
- package/build/layouts/stack-utils/StackHeaderButton.d.ts +77 -2
- package/build/layouts/stack-utils/StackHeaderButton.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderButton.js +3 -0
- package/build/layouts/stack-utils/StackHeaderButton.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderLeftRight.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderLeftRight.js +7 -5
- package/build/layouts/stack-utils/StackHeaderLeftRight.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderMenu.d.ts +83 -7
- package/build/layouts/stack-utils/StackHeaderMenu.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderMenu.js +14 -4
- package/build/layouts/stack-utils/StackHeaderMenu.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderSpacer.d.ts +7 -1
- package/build/layouts/stack-utils/StackHeaderSpacer.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderSpacer.js +5 -2
- package/build/layouts/stack-utils/StackHeaderSpacer.js.map +1 -1
- package/build/layouts/stack-utils/{StackHeaderItem.d.ts → StackHeaderView.d.ts} +18 -5
- package/build/layouts/stack-utils/StackHeaderView.d.ts.map +1 -0
- package/build/layouts/stack-utils/{StackHeaderItem.js → StackHeaderView.js} +14 -10
- package/build/layouts/stack-utils/StackHeaderView.js.map +1 -0
- package/build/layouts/stack-utils/index.d.ts +3 -3
- package/build/layouts/stack-utils/index.d.ts.map +1 -1
- package/build/layouts/stack-utils/index.js +4 -4
- package/build/layouts/stack-utils/index.js.map +1 -1
- package/build/layouts/stack-utils/shared.d.ts +4 -42
- package/build/layouts/stack-utils/shared.d.ts.map +1 -1
- package/build/layouts/stack-utils/shared.js +3 -22
- package/build/layouts/stack-utils/shared.js.map +1 -1
- package/build/link/ExpoLink.d.ts.map +1 -1
- package/build/link/ExpoLink.js +1 -8
- package/build/link/ExpoLink.js.map +1 -1
- package/build/link/elements.d.ts +36 -13
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +14 -5
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +12 -1
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js.map +1 -1
- package/build/navigationEvents/index.d.ts +36 -0
- package/build/navigationEvents/index.d.ts.map +1 -0
- package/build/navigationEvents/index.js +53 -0
- package/build/navigationEvents/index.js.map +1 -0
- package/build/toolbar/elements.d.ts +325 -16
- package/build/toolbar/elements.d.ts.map +1 -1
- package/build/toolbar/elements.js +130 -12
- package/build/toolbar/elements.js.map +1 -1
- package/build/toolbar/index.d.ts +38 -6
- package/build/toolbar/index.d.ts.map +1 -1
- package/build/toolbar/index.js +36 -1
- package/build/toolbar/index.js.map +1 -1
- package/build/toolbar/native.ios.d.ts.map +1 -1
- package/build/toolbar/native.ios.js.map +1 -1
- package/build/toolbar/native.types.d.ts +6 -5
- package/build/toolbar/native.types.d.ts.map +1 -1
- package/build/toolbar/native.types.js.map +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +50 -0
- package/build/useScreens.js.map +1 -1
- package/build/utils/font.d.ts +9 -0
- package/build/utils/font.d.ts.map +1 -0
- package/build/utils/font.js +20 -0
- package/build/utils/font.js.map +1 -0
- package/expo-module.config.json +1 -1
- package/ios/LinkPreview/LinkPreviewNativeActionView.swift +105 -24
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +35 -8
- package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +16 -20
- package/ios/LinkPreview/LinkPreviewNativePreviewView.swift +1 -8
- package/ios/LinkPreview/LinkPreviewNativeView.swift +48 -50
- package/ios/LinkPreview/LinkZoomTransition.swift +8 -10
- package/ios/RouterViewWithLogger.swift +5 -0
- package/ios/Toolbar/RouterFontUtils.swift +50 -0
- package/ios/Toolbar/RouterToolbarHostView.swift +41 -17
- package/ios/Toolbar/RouterToolbarItemView.swift +30 -13
- package/ios/Toolbar/RouterToolbarModule.swift +28 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar +0 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module} +17 -17
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
- package/package.json +10 -10
- package/build/layouts/stack-utils/StackHeaderItem.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderItem.js.map +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar +0 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar.md5 → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar.sha1 → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar.sha256 → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar.sha512 → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar.sha512} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/layouts/stack-utils/shared.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/layouts/stack-utils/shared.ts"],"names":[],"mappings":";;AA2CA,8GAqDC;AA/FD,iCAAiD;AAIjD,2DAA0F;AAC1F,mDAA2D;AAC3D,2CAAsF;AAoCtF,SAAgB,iDAAiD,CAC/D,KAAiC;IAEjC,MAAM,EAAE,Q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AAK,CAAC,QAAQ,IAAI,cAAc;QAC9C,gBAAgB,EAAE,CAAC,kBAAkB;KACtC,CAAC;IACF,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,cAAc,GAAG,IAAA,oCAA6B,EAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAClE,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC;IACnC,CAAC;IACD,IAAI,cAAc,EAAE,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG;YACX,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE;SAC3C,CAAC;QACF,MAAM,UAAU,GAAG,IAAA,oCAA6B,EAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7E,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;QAChC,CAAC;IACH,CAAC;IACD,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;IACtB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { NativeStackHeaderItemButton } from '@react-navigation/native-stack';\nimport { Children, type ReactNode } from 'react';\nimport { type ColorValue, type ImageSourcePropType, type StyleProp } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { StackHeaderBadge, StackHeaderIcon, StackHeaderLabel } from './common-primitives';\nimport { getFirstChildOfType } from '../../utils/children';\nimport { convertTextStyleToRNTextStyle, type BasicTextStyle } from '../../utils/font';\n\nexport interface StackHeaderItemSharedProps {\n children?: ReactNode;\n style?: StyleProp<BasicTextStyle>;\n hidesSharedBackground?: boolean;\n separateBackground?: boolean;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n disabled?: boolean;\n tintColor?: ColorValue;\n icon?: SFSymbol | ImageSourcePropType;\n /**\n * @default 'plain'\n */\n variant?: 'plain' | 'done' | 'prominent';\n}\n\n// We need to pick these properties, as the SharedHeaderItem is not exported by React Navigation\ntype RNSharedHeaderItem = Pick<\n NativeStackHeaderItemButton,\n | 'label'\n | 'labelStyle'\n | 'icon'\n | 'variant'\n | 'tintColor'\n | 'disabled'\n | 'width'\n | 'hidesSharedBackground'\n | 'sharesBackground'\n | 'identifier'\n | 'badge'\n | 'accessibilityLabel'\n | 'accessibilityHint'\n>;\n\nexport function convertStackHeaderSharedPropsToRNSharedHeaderItem(\n props: StackHeaderItemSharedProps\n): RNSharedHeaderItem {\n const { children, style, separateBackground, icon, ...rest } = props;\n const stringChildren = Children.toArray(children)\n .filter((child) => typeof child === 'string')\n .join('');\n const label = getFirstChildOfType(children, StackHeaderLabel);\n const iconPropConvertedToIcon = props.icon\n ? typeof props.icon === 'string'\n ? { sf: props.icon }\n : { src: props.icon }\n : undefined;\n const iconComponentProps =\n getFirstChildOfType(children, StackHeaderIcon)?.props ?? iconPropConvertedToIcon;\n const badgeComponent = getFirstChildOfType(children, StackHeaderBadge);\n const rnsIcon: NativeStackHeaderItemButton['icon'] = (() => {\n if (!iconComponentProps) {\n return undefined;\n }\n if ('src' in iconComponentProps) {\n return {\n type: 'image',\n source: iconComponentProps.src,\n };\n }\n return {\n type: 'sfSymbol',\n name: iconComponentProps.sf,\n };\n })();\n const item: RNSharedHeaderItem = {\n ...rest,\n label: label?.props.children ?? stringChildren,\n sharesBackground: !separateBackground,\n };\n if (style) {\n const convertedStyle = convertTextStyleToRNTextStyle(style) ?? {};\n item.labelStyle = convertedStyle;\n }\n if (badgeComponent) {\n item.badge = {\n value: badgeComponent.props.children ?? '',\n };\n const badgeStyle = convertTextStyleToRNTextStyle(badgeComponent.props.style);\n if (badgeStyle) {\n item.badge.style = badgeStyle;\n }\n }\n if (rnsIcon) {\n item.icon = rnsIcon;\n }\n return item;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoLink.d.ts","sourceRoot":"","sources":["../../src/link/ExpoLink.tsx"],"names":[],"mappings":"
|
|
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"}
|
package/build/link/ExpoLink.js
CHANGED
|
@@ -33,12 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
37
|
exports.ExpoLink = ExpoLink;
|
|
41
|
-
const expo_constants_1 = __importDefault(require("expo-constants"));
|
|
42
38
|
const react_1 = __importStar(require("react"));
|
|
43
39
|
const BaseExpoRouterLink_1 = require("./BaseExpoRouterLink");
|
|
44
40
|
const LinkWithPreview_1 = require("./LinkWithPreview");
|
|
@@ -55,10 +51,7 @@ function ExpoLink(props) {
|
|
|
55
51
|
function ExpoLinkImpl(props) {
|
|
56
52
|
const isPreview = (0, PreviewRouteContext_1.useIsPreview)();
|
|
57
53
|
const href = (0, useZoomHref_1.useZoomHref)(props);
|
|
58
|
-
const shouldUseLinkWithPreview = process.env.EXPO_OS === 'ios' &&
|
|
59
|
-
isLinkWithPreview(props) &&
|
|
60
|
-
!isPreview &&
|
|
61
|
-
expo_constants_1.default?.expoConfig?.newArchEnabled !== false;
|
|
54
|
+
const shouldUseLinkWithPreview = process.env.EXPO_OS === 'ios' && isLinkWithPreview(props) && !isPreview;
|
|
62
55
|
if (shouldUseLinkWithPreview) {
|
|
63
56
|
return <LinkWithPreview_1.LinkWithPreview {...props} href={href} hrefForPreviewNavigation={props.href}/>;
|
|
64
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoLink.js","sourceRoot":"","sources":["../../src/link/ExpoLink.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC
|
|
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"]}
|
package/build/link/elements.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
1
|
+
import React, { type PropsWithChildren, type ReactNode } from 'react';
|
|
2
2
|
import type { ViewStyle } from 'react-native';
|
|
3
3
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
4
4
|
export interface LinkMenuActionProps {
|
|
5
5
|
/**
|
|
6
6
|
* The title of the menu item.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
children?: ReactNode;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* If `true`, the menu item will be displayed as destructive.
|
|
11
|
+
*
|
|
12
|
+
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
destructive?: boolean;
|
|
13
15
|
/**
|
|
14
16
|
* If `true`, the menu item will be disabled and not selectable.
|
|
15
17
|
*
|
|
@@ -17,11 +19,37 @@ export interface LinkMenuActionProps {
|
|
|
17
19
|
*/
|
|
18
20
|
disabled?: boolean;
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* An elaborated title that explains the purpose of the action.
|
|
23
|
+
*/
|
|
24
|
+
discoverabilityLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the menu element should be hidden.
|
|
21
27
|
*
|
|
22
|
-
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/
|
|
28
|
+
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/hidden) for more information.
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
23
31
|
*/
|
|
24
|
-
|
|
32
|
+
hidden?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* SF Symbol displayed alongside the menu item.
|
|
35
|
+
*/
|
|
36
|
+
icon?: SFSymbol;
|
|
37
|
+
/**
|
|
38
|
+
* If `true`, the menu item will be displayed as selected.
|
|
39
|
+
*/
|
|
40
|
+
isOn?: boolean;
|
|
41
|
+
onPress?: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* An optional subtitle for the menu item.
|
|
44
|
+
*
|
|
45
|
+
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.
|
|
46
|
+
*/
|
|
47
|
+
subtitle?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The title of the menu item.
|
|
50
|
+
* @deprecated Use `children` prop instead.
|
|
51
|
+
*/
|
|
52
|
+
title?: string;
|
|
25
53
|
/**
|
|
26
54
|
* If `true`, the menu will be kept presented after the action is selected.
|
|
27
55
|
*
|
|
@@ -31,11 +59,6 @@ export interface LinkMenuActionProps {
|
|
|
31
59
|
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.
|
|
32
60
|
*/
|
|
33
61
|
unstable_keepPresented?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* If `true`, the menu item will be displayed as selected.
|
|
36
|
-
*/
|
|
37
|
-
isOn?: boolean;
|
|
38
|
-
onPress: () => void;
|
|
39
62
|
}
|
|
40
63
|
/**
|
|
41
64
|
* This component renders a context menu action for a link.
|
|
@@ -54,7 +77,7 @@ export interface LinkMenuProps {
|
|
|
54
77
|
/**
|
|
55
78
|
* Optional SF Symbol displayed alongside the menu item.
|
|
56
79
|
*/
|
|
57
|
-
icon?:
|
|
80
|
+
icon?: SFSymbol;
|
|
58
81
|
/**
|
|
59
82
|
* If `true`, the menu will be displayed as a palette.
|
|
60
83
|
* This means that the menu will be displayed as one row
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAA8B,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAWtD,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,M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,4BAwBlD;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,EAAE,aAAa,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,mSAgBxE"}
|
package/build/link/elements.js
CHANGED
|
@@ -38,14 +38,15 @@ exports.LinkMenu = void 0;
|
|
|
38
38
|
exports.LinkMenuAction = LinkMenuAction;
|
|
39
39
|
exports.LinkPreview = LinkPreview;
|
|
40
40
|
exports.LinkTrigger = LinkTrigger;
|
|
41
|
-
const non_secure_1 = require("nanoid/non-secure");
|
|
42
41
|
const react_1 = __importStar(require("react"));
|
|
43
42
|
const InternalLinkPreviewContext_1 = require("./InternalLinkPreviewContext");
|
|
43
|
+
const primitives_1 = require("../primitives");
|
|
44
44
|
const HrefPreview_1 = require("./preview/HrefPreview");
|
|
45
45
|
const PreviewRouteContext_1 = require("./preview/PreviewRouteContext");
|
|
46
46
|
const native_1 = require("./preview/native");
|
|
47
47
|
const Slot_1 = require("../ui/Slot");
|
|
48
48
|
const link_apple_zoom_1 = require("./zoom/link-apple-zoom");
|
|
49
|
+
const children_1 = require("../utils/children");
|
|
49
50
|
/**
|
|
50
51
|
* This component renders a context menu action for a link.
|
|
51
52
|
* It should only be used as a child of `Link.Menu` or `LinkMenu`.
|
|
@@ -55,12 +56,20 @@ const link_apple_zoom_1 = require("./zoom/link-apple-zoom");
|
|
|
55
56
|
* @platform ios
|
|
56
57
|
*/
|
|
57
58
|
function LinkMenuAction(props) {
|
|
58
|
-
const identifier = (0, react_1.
|
|
59
|
+
const identifier = (0, react_1.useId)();
|
|
59
60
|
if ((0, PreviewRouteContext_1.useIsPreview)() || process.env.EXPO_OS !== 'ios' || !(0, react_1.use)(InternalLinkPreviewContext_1.InternalLinkPreviewContext)) {
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
|
-
const { unstable_keepPresented, onPress, ...rest } = props;
|
|
63
|
-
|
|
63
|
+
const { unstable_keepPresented, onPress, children, title, ...rest } = props;
|
|
64
|
+
const areChildrenString = typeof children === 'string';
|
|
65
|
+
const label = areChildrenString
|
|
66
|
+
? children
|
|
67
|
+
: (0, children_1.getFirstChildOfType)(children, primitives_1.Label)?.props.children;
|
|
68
|
+
const iconComponent = !props.icon && !areChildrenString ? (0, children_1.getFirstChildOfType)(children, primitives_1.Icon) : undefined;
|
|
69
|
+
const icon = props.icon ??
|
|
70
|
+
(iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);
|
|
71
|
+
const sf = typeof icon === 'string' ? icon : undefined;
|
|
72
|
+
return (<native_1.NativeLinkPreviewAction {...rest} identifier={identifier} icon={sf} title={label ?? title ?? ''} keepPresented={unstable_keepPresented} onSelected={() => onPress?.()}/>);
|
|
64
73
|
}
|
|
65
74
|
/**
|
|
66
75
|
* Groups context menu actions for a link.
|
|
@@ -81,7 +90,7 @@ function LinkMenuAction(props) {
|
|
|
81
90
|
* @platform ios
|
|
82
91
|
*/
|
|
83
92
|
const LinkMenu = (props) => {
|
|
84
|
-
const identifier = (0, react_1.
|
|
93
|
+
const identifier = (0, react_1.useId)();
|
|
85
94
|
if ((0, PreviewRouteContext_1.useIsPreview)() || process.env.EXPO_OS !== 'ios' || !(0, react_1.use)(InternalLinkPreviewContext_1.InternalLinkPreviewContext)) {
|
|
86
95
|
return null;
|
|
87
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2Db,wCAcC;AA4ID,kCAwBC;AAkCD,kCAgBC;AA7RD,kDAA2C;AAC3C,+CAAoF;AAIpF,6EAA0E;AAC1E,uDAAoD;AACpD,uEAA6D;AAC7D,6CAAqF;AACrF,qCAAkC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SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACxC,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;IAED,OAAO,CACL,CAAC,iCAAwB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,CAAC,WAAW,CAAC,CAC9E;MAAA,CAAC,OAAO,CACV;IAAA,EAAE,iCAAwB,CAAC,CAC5B,CAAC;AACJ,CAAC;AAeD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,WAAW,CAAC,EAAE,aAAa,EAAE,GAAG,KAAK,EAAoB;IACvE,IAAI,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChF,6EAA6E;QAC7E,qGAAqG;QACrG,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;YAC7D,MAAM,IAAI,KAAK,CACb,gHAAgH,CACjH,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,WAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;IACpC,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CAAC,+BAAa,CAAC,CAAC,OAAO,CAAC,EAAE,+BAAa,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["'use client';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport React, { isValidElement, use, useMemo, type PropsWithChildren } from 'react';\nimport type { ViewStyle } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { InternalLinkPreviewContext } from './InternalLinkPreviewContext';\nimport { HrefPreview } from './preview/HrefPreview';\nimport { useIsPreview } from './preview/PreviewRouteContext';\nimport { NativeLinkPreviewAction, NativeLinkPreviewContent } from './preview/native';\nimport { Slot } from '../ui/Slot';\nimport { LinkAppleZoom } from './zoom/link-apple-zoom';\n\nexport interface LinkMenuActionProps {\n /**\n * The title of the menu item.\n */\n title: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: SFSymbol;\n /**\n * If `true`, the menu item will be disabled and not selectable.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled) for more information.\n */\n disabled?: boolean;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n /**\n * If `true`, the menu will be kept presented after the action is selected.\n *\n * This is marked as unstable, because when action is selected it will recreate the menu,\n * which will close all opened submenus and reset the scroll position.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.\n */\n unstable_keepPresented?: boolean;\n /**\n * If `true`, the menu item will be displayed as selected.\n */\n isOn?: boolean;\n onPress: () => void;\n}\n\n/**\n * This component renders a context menu action for a link.\n * It should only be used as a child of `Link.Menu` or `LinkMenu`.\n *\n * > **Note**: You can use the alias `Link.MenuAction` for this component.\n *\n * @platform ios\n */\nexport function LinkMenuAction(props: LinkMenuActionProps) {\n const identifier = useMemo(() => nanoid(), []);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const { unstable_keepPresented, onPress, ...rest } = props;\n return (\n <NativeLinkPreviewAction\n {...rest}\n onSelected={onPress}\n keepPresented={unstable_keepPresented}\n identifier={identifier}\n />\n );\n}\n\nexport interface LinkMenuProps {\n /**\n * The title of the menu item\n */\n title?: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: string;\n /**\n * If `true`, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.\n */\n palette?: boolean;\n /**\n * @deprecated Use `palette` prop instead.\n */\n displayAsPalette?: boolean;\n /**\n * If `true`, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.\n */\n inline?: boolean;\n /**\n * @deprecated Use `inline` prop instead.\n */\n displayInline?: boolean;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive) for more information.\n */\n destructive?: boolean;\n children?: React.ReactNode;\n}\n\n/**\n * Groups context menu actions for a link.\n *\n * If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.\n * Only `Link.MenuAction` and `LinkMenuAction` components are allowed as children.\n *\n * @example\n * ```tsx\n * <Link.Menu>\n * <Link.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Link.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Link.Menu>\n * ```\n *\n * > **Note**: You can use the alias `Link.Menu` for this component.\n *\n * @platform ios\n */\nexport const LinkMenu: React.FC<LinkMenuProps> = (props) => {\n const identifier = useMemo(() => nanoid(), []);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const children = React.Children.toArray(props.children).filter(\n (child) => isValidElement(child) && (child.type === LinkMenuAction || child.type === LinkMenu)\n );\n const displayAsPalette = props.palette ?? props.displayAsPalette;\n const displayInline = props.inline ?? props.displayInline;\n return (\n <NativeLinkPreviewAction\n {...props}\n displayAsPalette={displayAsPalette}\n displayInline={displayInline}\n title={props.title ?? ''}\n onSelected={() => {}}\n children={children}\n identifier={identifier}\n />\n );\n};\n\nexport type LinkPreviewStyle = Omit<ViewStyle, 'position' | 'width' | 'height'> & {\n /**\n * Sets the preferred width of the preview.\n * If not set, full width of the screen will be used.\n *\n * This is only **preferred** width, the actual width may be different\n */\n width?: number;\n\n /**\n * Sets the preferred height of the preview.\n * If not set, full height of the screen will be used.\n *\n * This is only **preferred** height, the actual height may be different\n */\n height?: number;\n};\n\nexport interface LinkPreviewProps {\n children?: React.ReactNode;\n /**\n * Custom styles for the preview container.\n *\n * Note that some styles may not work, as they are limited or reset by the native view\n */\n style?: LinkPreviewStyle;\n}\n\n/**\n * A component used to render and customize the link preview.\n *\n * If `Link.Preview` is used without any props, it will render a preview of the `href` passed to the `Link`.\n *\n * If multiple `Link.Preview` components are used within a single `Link`, only the first one will be rendered.\n *\n * To customize the preview, you can pass custom content as children.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview>\n * <Text>Custom Preview Content</Text>\n * </Link.Preview>\n * </Link>\n * ```\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview />\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Preview` for this component.\n *\n * @platform ios\n */\nexport function LinkPreview(props: LinkPreviewProps) {\n const { children, style } = props;\n const internalPreviewContext = use(InternalLinkPreviewContext);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !internalPreviewContext) {\n return null;\n }\n const { isVisible, href } = internalPreviewContext;\n const { width, height, ...restOfStyle } = style ?? {};\n const contentSize = {\n width: width ?? 0,\n height: height ?? 0,\n };\n let content: React.ReactNode;\n if (children) {\n content = isVisible ? children : null;\n } else {\n content = isVisible ? <HrefPreview href={href} /> : null;\n }\n\n return (\n <NativeLinkPreviewContent style={restOfStyle} preferredContentSize={contentSize}>\n {content}\n </NativeLinkPreviewContent>\n );\n}\n\nexport interface LinkTriggerProps extends PropsWithChildren {\n /**\n * A shorthand for enabling the Apple Zoom Transition on this link trigger.\n *\n * When set to `true`, the trigger will be wrapped with `Link.AppleZoom`.\n * If another `Link.AppleZoom` is already used inside `Link.Trigger`, an error\n * will be thrown.\n *\n * @platform ios 18+\n */\n withAppleZoom?: boolean;\n}\n\n/**\n * Serves as the trigger for a link.\n * The content inside this component will be rendered as part of the base link.\n *\n * If multiple `Link.Trigger` components are used within a single `Link`, only the first will be rendered.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Trigger>\n * Trigger\n * </Link.Trigger>\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Trigger` for this component.\n *\n * @platform ios\n */\nexport function LinkTrigger({ withAppleZoom, ...props }: LinkTriggerProps) {\n if (React.Children.count(props.children) > 1 || !isValidElement(props.children)) {\n // If onPress is passed, this means that Link passed props to this component.\n // We can assume that asChild is used, so we throw an error, because link will not work in this case.\n if (props && typeof props === 'object' && 'onPress' in props) {\n throw new Error(\n 'When using Link.Trigger in an asChild Link, you must pass a single child element that will emit onPress event.'\n );\n }\n return props.children;\n }\n const content = <Slot {...props} />;\n if (withAppleZoom) {\n return <LinkAppleZoom>{content}</LinkAppleZoom>;\n }\n return content;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFb,wCA0BC;AA4ID,kCAwBC;AAkCD,kCAgBC;AAlUD,+CAAkG;AAIlG,6EAA0E;AAC1E,8CAA4C;AAC5C,uDAAoD;AACpD,uEAA6D;AAC7D,6CAAqF;AACrF,qCAAkC;AAClC,4DAAuD;AACvD,gDAAwD;AA+DxD;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,UAAU,GAAG,IAAA,aAAK,GAAE,CAAC;IAC3B,IAAI,IAAA,kCAAY,GAAE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,IAAA,WAAG,EAAC,uDAA0B,CAAC,EAAE,CAAC;QACxF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;YAC7D,MAAM,IAAI,KAAK,CACb,gHAAgH,CACjH,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,WAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;IACpC,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CAAC,+BAAa,CAAC,CAAC,OAAO,CAAC,EAAE,+BAAa,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["'use client';\n\nimport React, { isValidElement, use, useId, type PropsWithChildren, type ReactNode } from 'react';\nimport type { ViewStyle } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { InternalLinkPreviewContext } from './InternalLinkPreviewContext';\nimport { Icon, Label } from '../primitives';\nimport { HrefPreview } from './preview/HrefPreview';\nimport { useIsPreview } from './preview/PreviewRouteContext';\nimport { NativeLinkPreviewAction, NativeLinkPreviewContent } from './preview/native';\nimport { Slot } from '../ui/Slot';\nimport { LinkAppleZoom } from './zoom/link-apple-zoom';\nimport { getFirstChildOfType } from '../utils/children';\n\nexport interface LinkMenuActionProps {\n /**\n * The title of the menu item.\n */\n children?: ReactNode;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n /**\n * If `true`, the menu item will be disabled and not selectable.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled) for more information.\n */\n disabled?: boolean;\n /**\n * An elaborated title that explains the purpose of the action.\n */\n discoverabilityLabel?: string;\n /**\n * Whether the menu element should be hidden.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/hidden) for more information.\n *\n * @default false\n */\n hidden?: boolean;\n // TODO: support ImageSourcePropType icons in addition to SFSymbols\n /**\n * SF Symbol displayed alongside the menu item.\n */\n icon?: SFSymbol;\n /**\n * If `true`, the menu item will be displayed as selected.\n */\n isOn?: boolean;\n onPress?: () => void;\n /**\n * An optional subtitle for the menu item.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.\n */\n subtitle?: string;\n /**\n * The title of the menu item.\n * @deprecated Use `children` prop instead.\n */\n title?: string;\n /**\n * If `true`, the menu will be kept presented after the action is selected.\n *\n * This is marked as unstable, because when action is selected it will recreate the menu,\n * which will close all opened submenus and reset the scroll position.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.\n */\n unstable_keepPresented?: boolean;\n}\n\n/**\n * This component renders a context menu action for a link.\n * It should only be used as a child of `Link.Menu` or `LinkMenu`.\n *\n * > **Note**: You can use the alias `Link.MenuAction` for this component.\n *\n * @platform ios\n */\nexport function LinkMenuAction(props: LinkMenuActionProps) {\n const identifier = useId();\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const { unstable_keepPresented, onPress, children, title, ...rest } = props;\n const areChildrenString = typeof children === 'string';\n const label = areChildrenString\n ? (children as string)\n : getFirstChildOfType(children, Label)?.props.children;\n const iconComponent =\n !props.icon && !areChildrenString ? getFirstChildOfType(children, Icon) : undefined;\n const icon =\n props.icon ??\n (iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);\n const sf = typeof icon === 'string' ? icon : undefined;\n return (\n <NativeLinkPreviewAction\n {...rest}\n identifier={identifier}\n icon={sf}\n title={label ?? title ?? ''}\n keepPresented={unstable_keepPresented}\n onSelected={() => onPress?.()}\n />\n );\n}\n\nexport interface LinkMenuProps {\n /**\n * The title of the menu item\n */\n title?: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: SFSymbol;\n /**\n * If `true`, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.\n */\n palette?: boolean;\n /**\n * @deprecated Use `palette` prop instead.\n */\n displayAsPalette?: boolean;\n /**\n * If `true`, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.\n */\n inline?: boolean;\n /**\n * @deprecated Use `inline` prop instead.\n */\n displayInline?: boolean;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive) for more information.\n */\n destructive?: boolean;\n children?: React.ReactNode;\n}\n\n/**\n * Groups context menu actions for a link.\n *\n * If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.\n * Only `Link.MenuAction` and `LinkMenuAction` components are allowed as children.\n *\n * @example\n * ```tsx\n * <Link.Menu>\n * <Link.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Link.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Link.Menu>\n * ```\n *\n * > **Note**: You can use the alias `Link.Menu` for this component.\n *\n * @platform ios\n */\nexport const LinkMenu: React.FC<LinkMenuProps> = (props) => {\n const identifier = useId();\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const children = React.Children.toArray(props.children).filter(\n (child) => isValidElement(child) && (child.type === LinkMenuAction || child.type === LinkMenu)\n );\n const displayAsPalette = props.palette ?? props.displayAsPalette;\n const displayInline = props.inline ?? props.displayInline;\n return (\n <NativeLinkPreviewAction\n {...props}\n displayAsPalette={displayAsPalette}\n displayInline={displayInline}\n title={props.title ?? ''}\n onSelected={() => {}}\n children={children}\n identifier={identifier}\n />\n );\n};\n\nexport type LinkPreviewStyle = Omit<ViewStyle, 'position' | 'width' | 'height'> & {\n /**\n * Sets the preferred width of the preview.\n * If not set, full width of the screen will be used.\n *\n * This is only **preferred** width, the actual width may be different\n */\n width?: number;\n\n /**\n * Sets the preferred height of the preview.\n * If not set, full height of the screen will be used.\n *\n * This is only **preferred** height, the actual height may be different\n */\n height?: number;\n};\n\nexport interface LinkPreviewProps {\n children?: React.ReactNode;\n /**\n * Custom styles for the preview container.\n *\n * Note that some styles may not work, as they are limited or reset by the native view\n */\n style?: LinkPreviewStyle;\n}\n\n/**\n * A component used to render and customize the link preview.\n *\n * If `Link.Preview` is used without any props, it will render a preview of the `href` passed to the `Link`.\n *\n * If multiple `Link.Preview` components are used within a single `Link`, only the first one will be rendered.\n *\n * To customize the preview, you can pass custom content as children.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview>\n * <Text>Custom Preview Content</Text>\n * </Link.Preview>\n * </Link>\n * ```\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview />\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Preview` for this component.\n *\n * @platform ios\n */\nexport function LinkPreview(props: LinkPreviewProps) {\n const { children, style } = props;\n const internalPreviewContext = use(InternalLinkPreviewContext);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !internalPreviewContext) {\n return null;\n }\n const { isVisible, href } = internalPreviewContext;\n const { width, height, ...restOfStyle } = style ?? {};\n const contentSize = {\n width: width ?? 0,\n height: height ?? 0,\n };\n let content: React.ReactNode;\n if (children) {\n content = isVisible ? children : null;\n } else {\n content = isVisible ? <HrefPreview href={href} /> : null;\n }\n\n return (\n <NativeLinkPreviewContent style={restOfStyle} preferredContentSize={contentSize}>\n {content}\n </NativeLinkPreviewContent>\n );\n}\n\nexport interface LinkTriggerProps extends PropsWithChildren {\n /**\n * A shorthand for enabling the Apple Zoom Transition on this link trigger.\n *\n * When set to `true`, the trigger will be wrapped with `Link.AppleZoom`.\n * If another `Link.AppleZoom` is already used inside `Link.Trigger`, an error\n * will be thrown.\n *\n * @platform ios 18+\n */\n withAppleZoom?: boolean;\n}\n\n/**\n * Serves as the trigger for a link.\n * The content inside this component will be rendered as part of the base link.\n *\n * If multiple `Link.Trigger` components are used within a single `Link`, only the first will be rendered.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Trigger>\n * Trigger\n * </Link.Trigger>\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Trigger` for this component.\n *\n * @platform ios\n */\nexport function LinkTrigger({ withAppleZoom, ...props }: LinkTriggerProps) {\n if (React.Children.count(props.children) > 1 || !isValidElement(props.children)) {\n // If onPress is passed, this means that Link passed props to this component.\n // We can assume that asChild is used, so we throw an error, because link will not work in this case.\n if (props && typeof props === 'object' && 'onPress' in props) {\n throw new Error(\n 'When using Link.Trigger in an asChild Link, you must pass a single child element that will emit onPress event.'\n );\n }\n return props.children;\n }\n const content = <Slot {...props} />;\n if (withAppleZoom) {\n return <LinkAppleZoom>{content}</LinkAppleZoom>;\n }\n return content;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PropsWithChildren } from 'react';
|
|
2
|
-
import { type ViewProps } from 'react-native';
|
|
2
|
+
import { type ViewProps, type ColorValue } from 'react-native';
|
|
3
|
+
import type { BasicTextStyle } from '../../utils/font';
|
|
3
4
|
export interface NativeLinkPreviewActionProps {
|
|
4
5
|
identifier: string;
|
|
5
6
|
title: string;
|
|
@@ -7,11 +8,21 @@ export interface NativeLinkPreviewActionProps {
|
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
destructive?: boolean;
|
|
11
|
+
discoverabilityLabel?: string;
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
accessibilityLabel?: string;
|
|
14
|
+
accessibilityHint?: string;
|
|
10
15
|
displayAsPalette?: boolean;
|
|
11
16
|
displayInline?: boolean;
|
|
12
17
|
isOn?: boolean;
|
|
13
18
|
keepPresented?: boolean;
|
|
19
|
+
hidden?: boolean;
|
|
20
|
+
tintColor?: ColorValue;
|
|
21
|
+
barButtonItemStyle?: 'plain' | 'prominent';
|
|
22
|
+
sharesBackground?: boolean;
|
|
23
|
+
hidesSharedBackground?: boolean;
|
|
14
24
|
onSelected: () => void;
|
|
25
|
+
titleStyle?: BasicTextStyle;
|
|
15
26
|
}
|
|
16
27
|
export declare function NativeLinkPreviewAction(props: NativeLinkPreviewActionProps): import("react").JSX.Element | null;
|
|
17
28
|
export interface TabPath {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAwB,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAErF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAI3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IAKf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MA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AE;IAC/C,8BAA8B,EAAE,MAAM,CAAC;IACvC,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,sCAWA;AAID,UAAU,uBAAuB;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,6BAA8B,SAAQ,iBAAiB;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,uBAAuB,CAAC;IACpC,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAUD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,sCAa5E;AASD,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,sCAaA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAiDb,0DAKC;AA4BD,8CAKC;AAYD,4DAaC;AASD,8DAcC;AAyBD,4DAaC;AASD,0FAgBC;AApMD,+BAAyC;AACzC,iCAAyD;AACzD,+CAAqF;AAIrF,MAAM,uBAAuB,GAC3B,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,uBAAQ,CAAC,IAAI,IAAI,MAAM,CAAC,aAAa,KAAK,IAAI,CAAC;AAoCnF,MAAM,2BAA2B,GAC/B,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,6BAA6B,CAAC;IACjF,CAAC,CAAC,IAAI,CAAC;AACX,SAAgB,uBAAuB,CAAC,KAAmC;IACz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,CAAC;IACd,CAAC;IACD,OAAO,CACL,CAAC,mCAAmC,CAClC,IAAI,KAAK,CAAC,CACV,mBAAmB,CACnB,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAC/B,CACH,CAAC;AACJ,CAAC;AAqBD,MAAM,kCAAkC,GACtC,uBAAuB;IACrB,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,0BAA0B,CAAC;IAC9E,CAAC,CAAC,IAAI,CAAC;AACX,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,IAAI,CAAC,kCAAkC,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,CAAC,kCAAkC,CACjC,IAAI,KAAK,CAAC,CACV,mBAAmB,CACnB,WAAW,CAAC,CAAC,KAAK,CAAC,CACnB,mBAAmB,CAAC,CAAC,KAAK,CAAC,CAC3B,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAC/B,CACH,CAAC;AACJ,CAAC;AACD,aAAa;AAEb,wCAAwC;AACxC,MAAM,6CAA6C,GAExC,uBAAuB;IAChC,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,yCAAyC,CAAC;IAC7F,CAAC,CAAC,gBAAQ,CAAC;AACb,SAAgB,uCAAuC,CAAC,KAGvD;IACC,IAAI,CAAC,6CAA6C,EAAE,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,CAAC,6CAA6C,CAC5C,IAAI,KAAK,CAAC,CACV,mBAAmB,CACnB,WAAW,CAAC,CAAC,KAAK,CAAC,CACnB,mBAAmB,CAAC,CAAC,KAAK,CAAC,CAC3B,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAC/B,CACH,CAAC;AACJ,CAAC;AACD,aAAa","sourcesContent":["'use client';\n\nimport { requireNativeView } from 'expo';\nimport { Fragment, type PropsWithChildren } from 'react';\nimport { Platform, StyleSheet, type ViewProps, type ColorValue } from 'react-native';\n\nimport type { BasicTextStyle } from '../../utils/font';\n\nconst areNativeViewsAvailable =\n process.env.EXPO_OS === 'ios' && !Platform.isTV && global.RN$Bridgeless === true;\n\n// #region Action View\nexport interface NativeLinkPreviewActionProps {\n identifier: string;\n title: string;\n icon?: string;\n children?: React.ReactNode;\n disabled?: boolean;\n destructive?: boolean;\n discoverabilityLabel?: string;\n subtitle?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n // This may lead to race conditions, when two menu actions are on at the same time.\n // The logic should be enforced in the JS code, rather than in the native code.\n // singleSelection?: boolean;\n displayAsPalette?: boolean;\n displayInline?: boolean;\n isOn?: boolean;\n // There are issues with menu state updates when keep presented is set to true.\n // When updating the context menu state, it will either not update or it will recreate the menu. The latter is a problem,\n // because it will close all opened submenus and reset the scroll position.\n // TODO: (@ubax) find a way to fix this.\n keepPresented?: boolean;\n hidden?: boolean;\n tintColor?: ColorValue;\n barButtonItemStyle?: 'plain' | 'prominent';\n\n // These properties are for UIBarButtonItem compatibility but don't apply to context menus.\n // They're included for API consistency with toolbar items.\n sharesBackground?: boolean;\n hidesSharedBackground?: boolean;\n onSelected: () => void;\n titleStyle?: BasicTextStyle;\n}\nconst LinkPreviewNativeActionView: React.ComponentType<NativeLinkPreviewActionProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkPreviewNativeActionView')\n : null;\nexport function NativeLinkPreviewAction(props: NativeLinkPreviewActionProps) {\n if (!LinkPreviewNativeActionView) {\n return null;\n }\n return <LinkPreviewNativeActionView {...props} />;\n}\n// #endregion\n\n// #region Preview View\nexport interface TabPath {\n oldTabKey: string;\n newTabKey: string;\n}\nexport interface NativeLinkPreviewProps extends ViewProps {\n nextScreenId: string | undefined;\n tabPath:\n | {\n path: TabPath[];\n }\n | undefined;\n disableForceFlatten?: boolean;\n onWillPreviewOpen?: () => void;\n onDidPreviewOpen?: () => void;\n onPreviewWillClose?: () => void;\n onPreviewDidClose?: () => void;\n onPreviewTapped?: () => void;\n onPreviewTappedAnimationCompleted?: () => void;\n children: React.ReactNode;\n}\nconst NativeLinkPreviewView: React.ComponentType<NativeLinkPreviewProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewView')\n : null;\nexport function NativeLinkPreview(props: NativeLinkPreviewProps) {\n if (!NativeLinkPreviewView) {\n return null;\n }\n return <NativeLinkPreviewView {...props} />;\n}\n// #endregion\n\n// #region Preview Content View\nexport interface NativeLinkPreviewContentProps extends ViewProps {\n preferredContentSize?: { width: number; height: number };\n}\nconst NativeLinkPreviewContentView: React.ComponentType<NativeLinkPreviewContentProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewContentView')\n : null;\n\nexport function NativeLinkPreviewContent(props: NativeLinkPreviewContentProps) {\n if (!NativeLinkPreviewContentView) {\n return null;\n }\n const style = StyleSheet.flatten([\n props.style,\n {\n position: 'absolute',\n top: 0,\n left: 0,\n } as const,\n ]);\n return <NativeLinkPreviewContentView {...props} style={style} />;\n}\n// #endregion\n\n// #region Zoom transition enabler\nconst LinkZoomTransitionEnablerNativeView: React.ComponentType<\n ViewProps & { zoomTransitionSourceIdentifier: string; disableForceFlatten?: boolean }\n> | null = areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionEnabler')\n : null;\nexport function LinkZoomTransitionEnabler(props: {\n zoomTransitionSourceIdentifier: string;\n preventInteractiveDismissal?: boolean;\n}) {\n if (!LinkZoomTransitionEnablerNativeView) {\n return null;\n }\n return (\n <LinkZoomTransitionEnablerNativeView\n {...props}\n disableForceFlatten\n style={{ display: 'contents' }}\n />\n );\n}\n// #endregion\n\n// #region Zoom transition source\ninterface LinkSourceAlignmentRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface LinkZoomTransitionSourceProps extends PropsWithChildren {\n identifier: string;\n alignment?: LinkSourceAlignmentRect;\n animateAspectRatioChange?: boolean;\n}\n\ninterface LinkZoomTransitionSourceNativeProps extends ViewProps, LinkZoomTransitionSourceProps {\n disableForceFlatten?: boolean;\n}\n\nconst LinkZoomTransitionSourceNativeView: React.ComponentType<LinkZoomTransitionSourceNativeProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionSource')\n : null;\nexport function LinkZoomTransitionSource(props: LinkZoomTransitionSourceProps) {\n if (!LinkZoomTransitionSourceNativeView) {\n return null;\n }\n return (\n <LinkZoomTransitionSourceNativeView\n {...props}\n disableForceFlatten\n collapsable={false}\n collapsableChildren={false}\n style={{ display: 'contents' }}\n />\n );\n}\n// #endregion\n\n// #region Zoom transition rect detector\nconst LinkZoomTransitionAlignmentRectDetectorNative: React.ComponentType<\n ViewProps & { identifier: string; disableForceFlatten?: boolean; children?: React.ReactNode }\n> | null = areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionAlignmentRectDetector')\n : Fragment;\nexport function LinkZoomTransitionAlignmentRectDetector(props: {\n identifier: string;\n children: React.ReactNode;\n}) {\n if (!LinkZoomTransitionAlignmentRectDetectorNative) {\n return null;\n }\n return (\n <LinkZoomTransitionAlignmentRectDetectorNative\n {...props}\n disableForceFlatten\n collapsable={false}\n collapsableChildren={false}\n style={{ display: 'contents' }}\n />\n );\n}\n// #endregion\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
interface BasePageEvent {
|
|
2
|
+
pathname: string;
|
|
3
|
+
screenId: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The rendering of the page started
|
|
7
|
+
*
|
|
8
|
+
* This can happen if screen is to be focused for the first time or when the screen is preloaded
|
|
9
|
+
*/
|
|
10
|
+
export interface PageWillRender extends BasePageEvent {
|
|
11
|
+
type: 'pageWillRender';
|
|
12
|
+
}
|
|
13
|
+
export interface PageFocusedEvent extends BasePageEvent {
|
|
14
|
+
type: 'pageFocused';
|
|
15
|
+
}
|
|
16
|
+
export interface PageBlurredEvent extends BasePageEvent {
|
|
17
|
+
type: 'pageBlurred';
|
|
18
|
+
}
|
|
19
|
+
export interface PageRemoved extends BasePageEvent {
|
|
20
|
+
type: 'pageRemoved';
|
|
21
|
+
}
|
|
22
|
+
export type AnalyticsEvent = PageWillRender | PageFocusedEvent | PageBlurredEvent | PageRemoved;
|
|
23
|
+
type EventTypeName = AnalyticsEvent['type'];
|
|
24
|
+
type Payload<T extends EventTypeName> = Omit<Extract<AnalyticsEvent, {
|
|
25
|
+
type: T;
|
|
26
|
+
}>, 'type'>;
|
|
27
|
+
declare function addListener<EventType extends EventTypeName>(eventType: EventType, callback: (event: Payload<EventType>) => void): () => void;
|
|
28
|
+
export declare function emit<EventType extends EventTypeName>(type: EventType, event: Payload<EventType>): void;
|
|
29
|
+
export declare const unstable_navigationEvents: {
|
|
30
|
+
addListener: typeof addListener;
|
|
31
|
+
emit: typeof emit;
|
|
32
|
+
hasAnyListener(): boolean;
|
|
33
|
+
markInitialRender(): void;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigationEvents/index.ts"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAYhG,KAAK,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAC5C,KAAK,OAAO,CAAC,CAAC,SAAS,aAAa,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAM3F,iBAAS,WAAW,CAAC,SAAS,SAAS,aAAa,EAClD,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI,cAuB9C;AAED,wBAAgB,IAAI,CAAC,SAAS,SAAS,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,QAO/F;AAED,eAAO,MAAM,yBAAyB;;;;;CASrC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unstable_navigationEvents = void 0;
|
|
4
|
+
exports.emit = emit;
|
|
5
|
+
const availableEvents = [
|
|
6
|
+
'pageWillRender',
|
|
7
|
+
'pageFocused',
|
|
8
|
+
'pageBlurred',
|
|
9
|
+
'pageRemoved',
|
|
10
|
+
];
|
|
11
|
+
let isAfterInitialRender = false;
|
|
12
|
+
let hasListener = false;
|
|
13
|
+
const subscribers = {};
|
|
14
|
+
function addListener(eventType, callback) {
|
|
15
|
+
if (isAfterInitialRender) {
|
|
16
|
+
console.warn('[expo-router] unstable_analytics.addListener was called after the initial render. Analytics listeners should be added in the global scope before first render of your app, preferably in a root _layout.tsx');
|
|
17
|
+
return () => { };
|
|
18
|
+
}
|
|
19
|
+
if (!availableEvents.includes(eventType)) {
|
|
20
|
+
throw new Error(`Unsupported event type: ${eventType}`);
|
|
21
|
+
}
|
|
22
|
+
hasListener = true;
|
|
23
|
+
if (!subscribers[eventType]) {
|
|
24
|
+
subscribers[eventType] = new Set();
|
|
25
|
+
}
|
|
26
|
+
subscribers[eventType].add(callback);
|
|
27
|
+
return () => {
|
|
28
|
+
subscribers[eventType].delete(callback);
|
|
29
|
+
if (subscribers[eventType].size === 0) {
|
|
30
|
+
delete subscribers[eventType];
|
|
31
|
+
}
|
|
32
|
+
hasListener = Object.keys(subscribers).length > 0;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function emit(type, event) {
|
|
36
|
+
const subscribersForEvent = subscribers[type];
|
|
37
|
+
if (subscribersForEvent) {
|
|
38
|
+
for (const callback of subscribersForEvent) {
|
|
39
|
+
callback(event);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.unstable_navigationEvents = {
|
|
44
|
+
addListener,
|
|
45
|
+
emit,
|
|
46
|
+
hasAnyListener() {
|
|
47
|
+
return hasListener;
|
|
48
|
+
},
|
|
49
|
+
markInitialRender() {
|
|
50
|
+
isAfterInitialRender = true;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigationEvents/index.ts"],"names":[],"mappings":";;;AAwEA,oBAOC;AAnDD,MAAM,eAAe,GAA6B;IAChD,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,aAAa;CACd,CAAC;AAEF,IAAI,oBAAoB,GAAG,KAAK,CAAC;AACjC,IAAI,WAAW,GAAG,KAAK,CAAC;AAKxB,MAAM,WAAW,GAEb,EAAE,CAAC;AAEP,SAAS,WAAW,CAClB,SAAoB,EACpB,QAA6C;IAE7C,IAAI,oBAAoB,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CACV,6MAA6M,CAC9M,CAAC;QACF,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IACnB,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,WAAW,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,EAAqC,CAAC;IACxE,CAAC;IACD,WAAW,CAAC,SAAS,CAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,GAAG,EAAE;QACV,WAAW,CAAC,SAAS,CAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,WAAW,CAAC,SAAS,CAAE,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACvC,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;QAChC,CAAC;QACD,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,IAAI,CAAkC,IAAe,EAAE,KAAyB;IAC9F,MAAM,mBAAmB,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,mBAAmB,EAAE,CAAC;QACxB,KAAK,MAAM,QAAQ,IAAI,mBAAmB,EAAE,CAAC;YAC3C,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;AACH,CAAC;AAEY,QAAA,yBAAyB,GAAG;IACvC,WAAW;IACX,IAAI;IACJ,cAAc;QACZ,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,iBAAiB;QACf,oBAAoB,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF,CAAC","sourcesContent":["interface BasePageEvent {\n pathname: string;\n screenId: string;\n}\n\n/**\n * The rendering of the page started\n *\n * This can happen if screen is to be focused for the first time or when the screen is preloaded\n */\nexport interface PageWillRender extends BasePageEvent {\n type: 'pageWillRender';\n}\n\nexport interface PageFocusedEvent extends BasePageEvent {\n type: 'pageFocused';\n}\n\nexport interface PageBlurredEvent extends BasePageEvent {\n type: 'pageBlurred';\n}\n\nexport interface PageRemoved extends BasePageEvent {\n type: 'pageRemoved';\n}\n\nexport type AnalyticsEvent = PageWillRender | PageFocusedEvent | PageBlurredEvent | PageRemoved;\n\nconst availableEvents: AnalyticsEvent['type'][] = [\n 'pageWillRender',\n 'pageFocused',\n 'pageBlurred',\n 'pageRemoved',\n];\n\nlet isAfterInitialRender = false;\nlet hasListener = false;\n\ntype EventTypeName = AnalyticsEvent['type'];\ntype Payload<T extends EventTypeName> = Omit<Extract<AnalyticsEvent, { type: T }>, 'type'>;\n\nconst subscribers: {\n [K in EventTypeName]?: Set<(event: Payload<K>) => void>;\n} = {};\n\nfunction addListener<EventType extends EventTypeName>(\n eventType: EventType,\n callback: (event: Payload<EventType>) => void\n) {\n if (isAfterInitialRender) {\n console.warn(\n '[expo-router] unstable_analytics.addListener was called after the initial render. Analytics listeners should be added in the global scope before first render of your app, preferably in a root _layout.tsx'\n );\n return () => {};\n }\n if (!availableEvents.includes(eventType)) {\n throw new Error(`Unsupported event type: ${eventType}`);\n }\n hasListener = true;\n if (!subscribers[eventType]) {\n subscribers[eventType] = new Set() as (typeof subscribers)[EventType];\n }\n subscribers[eventType]!.add(callback);\n return () => {\n subscribers[eventType]!.delete(callback);\n if (subscribers[eventType]!.size === 0) {\n delete subscribers[eventType];\n }\n hasListener = Object.keys(subscribers).length > 0;\n };\n}\n\nexport function emit<EventType extends EventTypeName>(type: EventType, event: Payload<EventType>) {\n const subscribersForEvent = subscribers[type];\n if (subscribersForEvent) {\n for (const callback of subscribersForEvent) {\n callback(event);\n }\n }\n}\n\nexport const unstable_navigationEvents = {\n addListener,\n emit,\n hasAnyListener() {\n return hasListener;\n },\n markInitialRender() {\n isAfterInitialRender = true;\n },\n};\n"]}
|