expo-router 7.0.0-canary-20251120-e46b3cc → 7.0.0-canary-20251205-756eb7a
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/fork/getStateFromPath-forks.d.ts +5 -10
- package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
- package/build/fork/getStateFromPath-forks.js +14 -13
- package/build/fork/getStateFromPath-forks.js.map +1 -1
- package/build/fork/getStateFromPath.js +3 -3
- package/build/fork/getStateFromPath.js.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.d.ts.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.js +25 -7
- package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
- package/build/fork/native-stack/descriptors-context.d.ts +8 -0
- package/build/fork/native-stack/descriptors-context.d.ts.map +1 -0
- package/build/fork/native-stack/descriptors-context.js +6 -0
- package/build/fork/native-stack/descriptors-context.js.map +1 -0
- package/build/internal/utils.d.ts +1 -0
- package/build/internal/utils.d.ts.map +1 -1
- package/build/internal/utils.js +3 -1
- package/build/internal/utils.js.map +1 -1
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +39 -5
- package/build/layouts/StackClient.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderComponent.js +6 -6
- package/build/layouts/stack-utils/StackHeaderComponent.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderTitle.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderTitle.js +3 -8
- package/build/layouts/stack-utils/StackHeaderTitle.js.map +1 -1
- package/build/layouts/stack-utils/index.d.ts +0 -1
- package/build/layouts/stack-utils/index.d.ts.map +1 -1
- package/build/layouts/stack-utils/index.js +1 -3
- package/build/layouts/stack-utils/index.js.map +1 -1
- package/build/link/ExpoLink.d.ts.map +1 -1
- package/build/link/ExpoLink.js +12 -4
- package/build/link/ExpoLink.js.map +1 -1
- package/build/link/Link.d.ts +2 -0
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +2 -0
- package/build/link/Link.js.map +1 -1
- package/build/link/LinkWithPreview.d.ts +6 -1
- package/build/link/LinkWithPreview.d.ts.map +1 -1
- package/build/link/LinkWithPreview.js +10 -11
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/elements.d.ts +8 -0
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +7 -2
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +17 -0
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js +22 -0
- package/build/link/preview/native.js.map +1 -1
- package/build/link/zoom/ZoomTransitionEnabler.d.ts +5 -0
- package/build/link/zoom/ZoomTransitionEnabler.d.ts.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.d.ts +5 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.d.ts.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.js +44 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.js.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.js +13 -0
- package/build/link/zoom/ZoomTransitionEnabler.js.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.d.ts +4 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.d.ts.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.js +3 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.js.map +1 -0
- package/build/link/zoom/link-apple-zoom.d.ts +23 -0
- package/build/link/zoom/link-apple-zoom.d.ts.map +1 -0
- package/build/link/zoom/link-apple-zoom.js +40 -0
- package/build/link/zoom/link-apple-zoom.js.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.d.ts +6 -0
- package/build/link/zoom/useZoomTransitionPrimitives.d.ts.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.d.ts +11 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.d.ts.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.js +66 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.js.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.js +9 -0
- package/build/link/zoom/useZoomTransitionPrimitives.js.map +1 -0
- package/build/link/zoom/zoom-transition-context.d.ts +7 -0
- package/build/link/zoom/zoom-transition-context.d.ts.map +1 -0
- package/build/link/zoom/zoom-transition-context.js +6 -0
- package/build/link/zoom/zoom-transition-context.js.map +1 -0
- package/build/native-tabs/NativeBottomTabsNavigator.d.ts +3 -15
- package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabsNavigator.js +17 -2
- package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -1
- package/build/native-tabs/NativeBottomTabsRouter.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabsRouter.js +12 -1
- package/build/native-tabs/NativeBottomTabsRouter.js.map +1 -1
- package/build/native-tabs/NativeTabTrigger.d.ts +2 -2
- package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeTabTrigger.js +24 -14
- package/build/native-tabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeTabs.d.ts +6 -3
- package/build/native-tabs/NativeTabs.d.ts.map +1 -1
- package/build/native-tabs/NativeTabs.js +7 -2
- package/build/native-tabs/NativeTabs.js.map +1 -1
- package/build/native-tabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeTabsView.js +26 -3
- package/build/native-tabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/appearance.d.ts.map +1 -1
- package/build/native-tabs/appearance.js +2 -4
- package/build/native-tabs/appearance.js.map +1 -1
- package/build/native-tabs/common/elements.d.ts +36 -3
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js +30 -1
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/native-tabs/hooks.d.ts +45 -0
- package/build/native-tabs/hooks.d.ts.map +1 -0
- package/build/native-tabs/hooks.js +57 -0
- package/build/native-tabs/hooks.js.map +1 -0
- package/build/native-tabs/index.d.ts +1 -1
- package/build/native-tabs/index.d.ts.map +1 -1
- package/build/native-tabs/index.js.map +1 -1
- package/build/native-tabs/types.d.ts +42 -55
- package/build/native-tabs/types.d.ts.map +1 -1
- package/build/native-tabs/types.js.map +1 -1
- package/build/native-tabs/utils/bottomAccessory.d.ts +9 -0
- package/build/native-tabs/utils/bottomAccessory.d.ts.map +1 -0
- package/build/native-tabs/utils/bottomAccessory.js +17 -0
- package/build/native-tabs/utils/bottomAccessory.js.map +1 -0
- package/build/native-tabs/utils/icon.d.ts +3 -0
- package/build/native-tabs/utils/icon.d.ts.map +1 -1
- package/build/native-tabs/utils/icon.js +16 -0
- package/build/native-tabs/utils/icon.js.map +1 -1
- package/build/native-tabs/utils/index.d.ts +0 -1
- package/build/native-tabs/utils/index.d.ts.map +1 -1
- package/build/native-tabs/utils/index.js +1 -4
- package/build/native-tabs/utils/index.js.map +1 -1
- package/build/native-tabs/utils/label.d.ts.map +1 -1
- package/build/native-tabs/utils/label.js +6 -2
- package/build/native-tabs/utils/label.js.map +1 -1
- package/build/native-tabs/utils/materialIconConverter.android.d.ts +4 -0
- package/build/native-tabs/utils/materialIconConverter.android.d.ts.map +1 -0
- package/build/native-tabs/utils/materialIconConverter.android.js +10 -0
- package/build/native-tabs/utils/materialIconConverter.android.js.map +1 -0
- package/build/native-tabs/utils/materialIconConverter.d.ts +4 -0
- package/build/native-tabs/utils/materialIconConverter.d.ts.map +1 -0
- package/build/native-tabs/utils/materialIconConverter.js +8 -0
- package/build/native-tabs/utils/materialIconConverter.js.map +1 -0
- package/build/navigationParams.d.ts +5 -1
- package/build/navigationParams.d.ts.map +1 -1
- package/build/navigationParams.js +32 -8
- package/build/navigationParams.js.map +1 -1
- package/build/toolbar/elements.d.ts +24 -0
- package/build/toolbar/elements.d.ts.map +1 -0
- package/build/toolbar/elements.js +36 -0
- package/build/toolbar/elements.js.map +1 -0
- package/build/toolbar/index.d.ts +9 -0
- package/build/toolbar/index.d.ts.map +1 -0
- package/build/toolbar/index.js +12 -0
- package/build/toolbar/index.js.map +1 -0
- package/build/toolbar/native.d.ts +4 -0
- package/build/toolbar/native.d.ts.map +1 -0
- package/build/toolbar/native.ios.d.ts +4 -0
- package/build/toolbar/native.ios.d.ts.map +1 -0
- package/build/toolbar/native.ios.js +21 -0
- package/build/toolbar/native.ios.js.map +1 -0
- package/build/toolbar/native.js +11 -0
- package/build/toolbar/native.js.map +1 -0
- package/build/toolbar/native.types.d.ts +30 -0
- package/build/toolbar/native.types.d.ts.map +1 -0
- package/build/toolbar/native.types.js +3 -0
- package/build/toolbar/native.types.js.map +1 -0
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +14 -0
- package/build/useScreens.js.map +1 -1
- package/build/utils/children.d.ts +7 -0
- package/build/utils/children.d.ts.map +1 -0
- package/build/utils/children.js +24 -0
- package/build/utils/children.js.map +1 -0
- package/build/utils/style.d.ts +3 -0
- package/build/utils/style.d.ts.map +1 -0
- package/build/utils/style.js +10 -0
- package/build/utils/style.js.map +1 -0
- package/build/views/Sitemap.js +3 -2
- package/build/views/Sitemap.js.map +1 -1
- package/expo-module.config.json +2 -2
- package/ios/LinkPreview/LinkPreviewNativeActionView.swift +1 -0
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +49 -1
- package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +132 -70
- package/ios/LinkPreview/LinkPreviewNativeView.swift +34 -17
- package/ios/LinkPreview/LinkZoomTransition.swift +227 -0
- package/ios/Toolbar/RouterToolbarHostView.swift +140 -0
- package/ios/Toolbar/RouterToolbarItemView.swift +171 -0
- package/ios/Toolbar/RouterToolbarModule.swift +102 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.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 +17 -14
- package/unstable-toolbar.d.ts +1 -0
- package/unstable-toolbar.js +1 -0
- package/build/layouts/stack-utils/utils.d.ts +0 -3
- package/build/layouts/stack-utils/utils.d.ts.map +0 -1
- package/build/layouts/stack-utils/utils.js +0 -8
- package/build/layouts/stack-utils/utils.js.map +0 -1
- package/build/native-tabs/utils/children.d.ts +0 -5
- package/build/native-tabs/utils/children.d.ts.map +0 -1
- package/build/native-tabs/utils/children.js +0 -15
- package/build/native-tabs/utils/children.js.map +0 -1
- package/ios/LinkPreview/LinkPreviewNativeNavigation.h +0 -50
- package/ios/LinkPreview/LinkPreviewNativeNavigation.mm +0 -164
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar.md5 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar.sha1 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar.sha256 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar.sha512 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar.md5 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar.sha1 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar.sha256 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar.sha512 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar.sha512} +0 -0
package/build/link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAEvD,eAAO,MAAM,IAAI,WA2BM,SAAS;;;;;;;CAY/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"}
|
package/build/link/Link.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.Redirect = exports.Link = void 0;
|
|
|
4
4
|
const ExpoLink_1 = require("./ExpoLink");
|
|
5
5
|
const elements_1 = require("./elements");
|
|
6
6
|
const href_1 = require("./href");
|
|
7
|
+
const link_apple_zoom_1 = require("./zoom/link-apple-zoom");
|
|
7
8
|
exports.Link = Object.assign(
|
|
8
9
|
/**
|
|
9
10
|
* Component that renders a link using [`href`](#href) to another route.
|
|
@@ -40,6 +41,7 @@ function Link(props) {
|
|
|
40
41
|
Trigger: elements_1.LinkTrigger,
|
|
41
42
|
Preview: elements_1.LinkPreview,
|
|
42
43
|
MenuAction: elements_1.LinkMenuAction,
|
|
44
|
+
AppleZoom: link_apple_zoom_1.LinkAppleZoom,
|
|
43
45
|
});
|
|
44
46
|
var Redirect_1 = require("./Redirect");
|
|
45
47
|
Object.defineProperty(exports, "Redirect", { enumerable: true, get: function () { return Redirect_1.Redirect; } });
|
package/build/link/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,yCAAgF;AAChF,iCAAqC;
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,yCAAgF;AAChF,iCAAqC;AAErC,4DAAuD;AAE1C,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;CACzB,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';\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 }\n);\n\nexport type LinkComponent = typeof Link;\n\nexport { LinkProps, WebAnchorProps };\nexport { Redirect, RedirectProps } from './Redirect';\n"]}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { Href } from '../types';
|
|
2
3
|
import { LinkProps } from './useLinkHooks';
|
|
3
|
-
|
|
4
|
+
interface LinkWithPreviewProps extends LinkProps {
|
|
5
|
+
hrefForPreviewNavigation: Href;
|
|
6
|
+
}
|
|
7
|
+
export declare function LinkWithPreview({ children, ...rest }: LinkWithPreviewProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
4
9
|
//# sourceMappingURL=LinkWithPreview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkWithPreview.d.ts","sourceRoot":"","sources":["../../src/link/LinkWithPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"LinkWithPreview.d.ts","sourceRoot":"","sources":["../../src/link/LinkWithPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAQpE,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,qBAyH1E"}
|
|
@@ -41,16 +41,18 @@ const hooks_1 = require("../hooks");
|
|
|
41
41
|
const BaseExpoRouterLink_1 = require("./BaseExpoRouterLink");
|
|
42
42
|
const InternalLinkPreviewContext_1 = require("./InternalLinkPreviewContext");
|
|
43
43
|
const elements_1 = require("./elements");
|
|
44
|
+
const href_1 = require("./href");
|
|
44
45
|
const LinkPreviewContext_1 = require("./preview/LinkPreviewContext");
|
|
45
46
|
const native_1 = require("./preview/native");
|
|
46
47
|
const useNextScreenId_1 = require("./preview/useNextScreenId");
|
|
48
|
+
const children_1 = require("../utils/children");
|
|
47
49
|
const url_1 = require("../utils/url");
|
|
48
50
|
const isPad = react_native_1.Platform.OS === 'ios' && react_native_1.Platform.isPad;
|
|
49
51
|
function LinkWithPreview({ children, ...rest }) {
|
|
50
52
|
const router = (0, hooks_1.useRouter)();
|
|
51
53
|
const { setOpenPreviewKey } = (0, LinkPreviewContext_1.useLinkPreviewContext)();
|
|
52
54
|
const [isCurrentPreviewOpen, setIsCurrenPreviewOpen] = (0, react_1.useState)(false);
|
|
53
|
-
const hrefWithoutQuery =
|
|
55
|
+
const hrefWithoutQuery = (0, href_1.resolveHref)(rest.hrefForPreviewNavigation).split('?')[0];
|
|
54
56
|
const prevHrefWithoutQuery = (0, react_1.useRef)(hrefWithoutQuery);
|
|
55
57
|
(0, react_1.useEffect)(() => {
|
|
56
58
|
if (isCurrentPreviewOpen) {
|
|
@@ -73,9 +75,9 @@ function LinkWithPreview({ children, ...rest }) {
|
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
}, [rest.href, rest.replace]);
|
|
76
|
-
const triggerElement = react_1.default.useMemo(() => getFirstChildOfType(children, elements_1.LinkTrigger), [children]);
|
|
77
|
-
const menuElement = react_1.default.useMemo(() => getFirstChildOfType(children, elements_1.LinkMenu), [children]);
|
|
78
|
-
const previewElement = react_1.default.useMemo(() => getFirstChildOfType(children, elements_1.LinkPreview), [children]);
|
|
78
|
+
const triggerElement = react_1.default.useMemo(() => (0, children_1.getFirstChildOfType)(children, elements_1.LinkTrigger), [children]);
|
|
79
|
+
const menuElement = react_1.default.useMemo(() => (0, children_1.getFirstChildOfType)(children, elements_1.LinkMenu), [children]);
|
|
80
|
+
const previewElement = react_1.default.useMemo(() => (0, children_1.getFirstChildOfType)(children, elements_1.LinkPreview), [children]);
|
|
79
81
|
if ((previewElement || menuElement) && !triggerElement) {
|
|
80
82
|
if (process.env.NODE_ENV !== 'production') {
|
|
81
83
|
throw new Error('When you use Link.Preview, you must use Link.Trigger to specify the trigger element.');
|
|
@@ -97,7 +99,7 @@ function LinkWithPreview({ children, ...rest }) {
|
|
|
97
99
|
return (<native_1.NativeLinkPreview nextScreenId={isPad ? undefined : nextScreenId} tabPath={isPad ? undefined : tabPathValue} onWillPreviewOpen={() => {
|
|
98
100
|
if (hasPreview) {
|
|
99
101
|
isPreviewTapped.current = false;
|
|
100
|
-
prefetch(rest.
|
|
102
|
+
prefetch(rest.hrefForPreviewNavigation);
|
|
101
103
|
setIsCurrenPreviewOpen(true);
|
|
102
104
|
}
|
|
103
105
|
}} onPreviewWillClose={() => {
|
|
@@ -111,22 +113,19 @@ function LinkWithPreview({ children, ...rest }) {
|
|
|
111
113
|
}
|
|
112
114
|
}} onPreviewDidClose={() => {
|
|
113
115
|
if (hasPreview && isPreviewTapped.current && isPad) {
|
|
114
|
-
router.navigate(rest.
|
|
116
|
+
router.navigate(rest.hrefForPreviewNavigation, { __internal__PreviewKey: nextScreenId });
|
|
115
117
|
}
|
|
116
118
|
}} onPreviewTapped={() => {
|
|
117
119
|
isPreviewTapped.current = true;
|
|
118
120
|
if (!isPad) {
|
|
119
|
-
router.navigate(rest.
|
|
121
|
+
router.navigate(rest.hrefForPreviewNavigation, { __internal__PreviewKey: nextScreenId });
|
|
120
122
|
}
|
|
121
123
|
}} style={{ display: 'contents' }} disableForceFlatten>
|
|
122
|
-
<InternalLinkPreviewContext_1.InternalLinkPreviewContext value={{ isVisible: isCurrentPreviewOpen, href: rest.
|
|
124
|
+
<InternalLinkPreviewContext_1.InternalLinkPreviewContext value={{ isVisible: isCurrentPreviewOpen, href: rest.hrefForPreviewNavigation }}>
|
|
123
125
|
<BaseExpoRouterLink_1.BaseExpoRouterLink {...rest} children={trigger} ref={rest.ref}/>
|
|
124
126
|
{preview}
|
|
125
127
|
{menuElement}
|
|
126
128
|
</InternalLinkPreviewContext_1.InternalLinkPreviewContext>
|
|
127
129
|
</native_1.NativeLinkPreview>);
|
|
128
130
|
}
|
|
129
|
-
function getFirstChildOfType(children, type) {
|
|
130
|
-
return react_1.default.Children.toArray(children).find((child) => (0, react_1.isValidElement)(child) && child.type === type);
|
|
131
|
-
}
|
|
132
131
|
//# sourceMappingURL=LinkWithPreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkWithPreview.js","sourceRoot":"","sources":["../../src/link/LinkWithPreview.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBb,
|
|
1
|
+
{"version":3,"file":"LinkWithPreview.js","sourceRoot":"","sources":["../../src/link/LinkWithPreview.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBb,0CAyHC;AA/ID,+CAAoE;AACpE,+CAAwC;AAExC,oCAAqC;AACrC,6DAA0D;AAC1D,6EAA0E;AAC1E,yCAAgE;AAChE,iCAAqC;AAErC,qEAAqE;AACrE,6CAAqD;AACrD,+DAA4D;AAE5D,gDAAwD;AACxD,sCAAoD;AAEpD,MAAM,KAAK,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,uBAAQ,CAAC,KAAK,CAAC;AAMtD,SAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAwB;IACzE,MAAM,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC3B,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAA,0CAAqB,GAAE,CAAC;IACtD,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAEvE,MAAM,gBAAgB,GAAG,IAAA,kBAAW,EAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,MAAM,oBAAoB,GAAG,IAAA,cAAM,EAAC,gBAAgB,CAAC,CAAC;IAEtD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,oBAAoB,EAAE,CAAC;YACzB,IAAI,oBAAoB,CAAC,OAAO,KAAK,gBAAgB,EAAE,CAAC;gBACtD,MAAM,IAAI,KAAK,CACb,iKAAiK,CAClK,CAAC;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,oBAAoB,CA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GAAG,CAAC,EAC/D;QAAA,CAAC,OAAO,CACR;QAAA,CAAC,WAAW,CACd;MAAA,EAAE,uDAA0B,CAC9B;IAAA,EAAE,0BAAiB,CAAC,CACrB,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { Platform } from 'react-native';\n\nimport { useRouter } from '../hooks';\nimport { BaseExpoRouterLink } from './BaseExpoRouterLink';\nimport { InternalLinkPreviewContext } from './InternalLinkPreviewContext';\nimport { LinkMenu, LinkPreview, LinkTrigger } from './elements';\nimport { resolveHref } from './href';\nimport type { Href } from '../types';\nimport { useLinkPreviewContext } from './preview/LinkPreviewContext';\nimport { NativeLinkPreview } from './preview/native';\nimport { useNextScreenId } from './preview/useNextScreenId';\nimport { LinkProps } from './useLinkHooks';\nimport { getFirstChildOfType } from '../utils/children';\nimport { shouldLinkExternally } from '../utils/url';\n\nconst isPad = Platform.OS === 'ios' && Platform.isPad;\n\ninterface LinkWithPreviewProps extends LinkProps {\n hrefForPreviewNavigation: Href;\n}\n\nexport function LinkWithPreview({ children, ...rest }: LinkWithPreviewProps) {\n const router = useRouter();\n const { setOpenPreviewKey } = useLinkPreviewContext();\n const [isCurrentPreviewOpen, setIsCurrenPreviewOpen] = useState(false);\n\n const hrefWithoutQuery = resolveHref(rest.hrefForPreviewNavigation).split('?')[0];\n const prevHrefWithoutQuery = useRef(hrefWithoutQuery);\n\n useEffect(() => {\n if (isCurrentPreviewOpen) {\n if (prevHrefWithoutQuery.current !== hrefWithoutQuery) {\n throw new Error(\n '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.'\n );\n }\n } else {\n prevHrefWithoutQuery.current = hrefWithoutQuery;\n }\n }, [hrefWithoutQuery]);\n\n const [{ nextScreenId, tabPath }, prefetch] = useNextScreenId();\n\n useEffect(() => {\n if (rest.replace) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Using replace links with preview is not supported');\n } else {\n console.warn('Using replace links with preview is not supported');\n }\n }\n }, [rest.href, rest.replace]);\n\n const triggerElement = React.useMemo(\n () => getFirstChildOfType(children, LinkTrigger),\n [children]\n );\n const menuElement = React.useMemo(() => getFirstChildOfType(children, LinkMenu), [children]);\n const previewElement = React.useMemo(\n () => getFirstChildOfType(children, LinkPreview),\n [children]\n );\n\n if ((previewElement || menuElement) && !triggerElement) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n 'When you use Link.Preview, you must use Link.Trigger to specify the trigger element.'\n );\n } else {\n console.warn(\n 'When you use Link.Preview, you must use Link.Trigger to specify the trigger element.'\n );\n }\n }\n\n const trigger = React.useMemo(\n () => triggerElement ?? <LinkTrigger>{children}</LinkTrigger>,\n [triggerElement, children]\n );\n\n const preview = React.useMemo(\n () => (shouldLinkExternally(String(rest.href)) || !previewElement ? null : previewElement),\n [previewElement, rest.href]\n );\n\n const isPreviewTapped = useRef(false);\n\n const tabPathValue = useMemo(\n () => ({\n path: tabPath,\n }),\n [tabPath]\n );\n\n const hasPreview = !!previewElement;\n\n if (rest.replace) {\n return <BaseExpoRouterLink children={children} {...rest} />;\n }\n\n return (\n <NativeLinkPreview\n nextScreenId={isPad ? undefined : nextScreenId}\n tabPath={isPad ? undefined : tabPathValue}\n onWillPreviewOpen={() => {\n if (hasPreview) {\n isPreviewTapped.current = false;\n prefetch(rest.hrefForPreviewNavigation);\n setIsCurrenPreviewOpen(true);\n }\n }}\n onPreviewWillClose={() => {\n if (hasPreview) {\n setIsCurrenPreviewOpen(false);\n // When preview was not tapped, then we need to enable the screen stack animation\n // Otherwise this will happen in StackNavigator, when new screen is opened\n if (!isPreviewTapped.current || isPad) {\n setOpenPreviewKey(undefined);\n }\n }\n }}\n onPreviewDidClose={() => {\n if (hasPreview && isPreviewTapped.current && isPad) {\n router.navigate(rest.hrefForPreviewNavigation, { __internal__PreviewKey: nextScreenId });\n }\n }}\n onPreviewTapped={() => {\n isPreviewTapped.current = true;\n if (!isPad) {\n router.navigate(rest.hrefForPreviewNavigation, { __internal__PreviewKey: nextScreenId });\n }\n }}\n style={{ display: 'contents' }}\n disableForceFlatten>\n <InternalLinkPreviewContext\n value={{ isVisible: isCurrentPreviewOpen, href: rest.hrefForPreviewNavigation }}>\n <BaseExpoRouterLink {...rest} children={trigger} ref={rest.ref} />\n {preview}\n {menuElement}\n </InternalLinkPreviewContext>\n </NativeLinkPreview>\n );\n}\n"]}
|
package/build/link/elements.d.ts
CHANGED
|
@@ -61,6 +61,10 @@ export interface LinkMenuProps {
|
|
|
61
61
|
*
|
|
62
62
|
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.
|
|
63
63
|
*/
|
|
64
|
+
palette?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated Use `palette` prop instead.
|
|
67
|
+
*/
|
|
64
68
|
displayAsPalette?: boolean;
|
|
65
69
|
/**
|
|
66
70
|
* If `true`, the menu will be displayed inline.
|
|
@@ -68,6 +72,10 @@ export interface LinkMenuProps {
|
|
|
68
72
|
*
|
|
69
73
|
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.
|
|
70
74
|
*/
|
|
75
|
+
inline?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use `inline` prop instead.
|
|
78
|
+
*/
|
|
71
79
|
displayInline?: boolean;
|
|
72
80
|
/**
|
|
73
81
|
* If `true`, the menu item will be displayed as destructive.
|
|
@@ -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":"AAGA,OAAO,KAAK,EAAE,EAIZ,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA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AKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,4BAwBlD;AAED,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,mSAYlD"}
|
package/build/link/elements.js
CHANGED
|
@@ -38,6 +38,7 @@ 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");
|
|
41
42
|
const react_1 = __importStar(require("react"));
|
|
42
43
|
const InternalLinkPreviewContext_1 = require("./InternalLinkPreviewContext");
|
|
43
44
|
const HrefPreview_1 = require("./preview/HrefPreview");
|
|
@@ -53,11 +54,12 @@ const Slot_1 = require("../ui/Slot");
|
|
|
53
54
|
* @platform ios
|
|
54
55
|
*/
|
|
55
56
|
function LinkMenuAction(props) {
|
|
57
|
+
const identifier = (0, react_1.useMemo)(() => (0, non_secure_1.nanoid)(), []);
|
|
56
58
|
if ((0, PreviewRouteContext_1.useIsPreview)() || process.env.EXPO_OS !== 'ios' || !(0, react_1.use)(InternalLinkPreviewContext_1.InternalLinkPreviewContext)) {
|
|
57
59
|
return null;
|
|
58
60
|
}
|
|
59
61
|
const { unstable_keepPresented, onPress, ...rest } = props;
|
|
60
|
-
return (<native_1.NativeLinkPreviewAction {...rest} onSelected={onPress} keepPresented={unstable_keepPresented}/>);
|
|
62
|
+
return (<native_1.NativeLinkPreviewAction {...rest} onSelected={onPress} keepPresented={unstable_keepPresented} identifier={identifier}/>);
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
63
65
|
* Groups context menu actions for a link.
|
|
@@ -78,11 +80,14 @@ function LinkMenuAction(props) {
|
|
|
78
80
|
* @platform ios
|
|
79
81
|
*/
|
|
80
82
|
const LinkMenu = (props) => {
|
|
83
|
+
const identifier = (0, react_1.useMemo)(() => (0, non_secure_1.nanoid)(), []);
|
|
81
84
|
if ((0, PreviewRouteContext_1.useIsPreview)() || process.env.EXPO_OS !== 'ios' || !(0, react_1.use)(InternalLinkPreviewContext_1.InternalLinkPreviewContext)) {
|
|
82
85
|
return null;
|
|
83
86
|
}
|
|
84
87
|
const children = react_1.default.Children.toArray(props.children).filter((child) => (0, react_1.isValidElement)(child) && (child.type === LinkMenuAction || child.type === exports.LinkMenu));
|
|
85
|
-
|
|
88
|
+
const displayAsPalette = props.palette ?? props.displayAsPalette;
|
|
89
|
+
const displayInline = props.inline ?? props.displayInline;
|
|
90
|
+
return (<native_1.NativeLinkPreviewAction {...props} displayAsPalette={displayAsPalette} displayInline={displayInline} title={props.title ?? ''} onSelected={() => { }} children={children} identifier={identifier}/>);
|
|
86
91
|
};
|
|
87
92
|
exports.LinkMenu = LinkMenu;
|
|
88
93
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDb,wCAYC;AA8HD,kCAwBC;AAuBD,kCAYC;AA5PD,+CAA8F;AAI9F,6EAA0E;AAC1E,uDAAoD;AACpD,uEAA6D;AAC7D,6CAAqF;AACrF,qCAAkC;AAuClC;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,KAA0B;IACvD,IAAI,IAAA,kCAAY,GAAE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,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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,OAAO,CAAC,WAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7B,CAAC","sourcesContent":["'use client';\n\nimport React, { isValidElement, use, type PropsWithChildren, type ReactElement } 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';\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 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 />\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 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 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: ReactElement<LinkMenuActionProps> | ReactElement<LinkMenuActionProps>[];\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 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 return (\n <NativeLinkPreviewAction\n {...props}\n title={props.title ?? ''}\n onSelected={() => {}}\n children={children}\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 type LinkTriggerProps = PropsWithChildren;\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(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 return <Slot {...props} />;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEb,wCAcC;AA4ID,kCAwBC;AAuBD,kCAYC;AAnRD,kDAA2C;AAC3C,+CAMe;AAIf,6EAA0E;AAC1E,uDAAoD;AACpD,uEAA6D;AAC7D,6CAAqF;AACrF,qCAAkC;AAuClC;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,mBAAM,GAAE,EAAE,EAAE,CAAC,CAAC;IAC/C,IAAI,IAAA,kCAAY,GAAE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,IAAA,WAAG,EAAC,uDAA0B,CAAC,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC3D,OAAO,CACL,CAAC,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,SAAgB,WAAW,CAAC,KAAuB;IACjD,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,OAAO,CAAC,WAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7B,CAAC","sourcesContent":["'use client';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport React, {\n isValidElement,\n use,\n useMemo,\n type PropsWithChildren,\n type ReactElement,\n} 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';\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: ReactElement<LinkMenuActionProps> | ReactElement<LinkMenuActionProps>[];\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 type LinkTriggerProps = PropsWithChildren;\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(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 return <Slot {...props} />;\n}\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
1
2
|
import { type ViewProps } from 'react-native';
|
|
2
3
|
export interface NativeLinkPreviewActionProps {
|
|
4
|
+
identifier: string;
|
|
3
5
|
title: string;
|
|
4
6
|
icon?: string;
|
|
5
7
|
children?: React.ReactNode;
|
|
@@ -38,4 +40,19 @@ export interface NativeLinkPreviewContentProps extends ViewProps {
|
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
42
|
export declare function NativeLinkPreviewContent(props: NativeLinkPreviewContentProps): import("react").JSX.Element | null;
|
|
43
|
+
export declare function LinkZoomTransitionEnabler(props: {
|
|
44
|
+
zoomTransitionSourceIdentifier: string;
|
|
45
|
+
preventInteractiveDismissal?: boolean;
|
|
46
|
+
}): import("react").JSX.Element | null;
|
|
47
|
+
interface LinkSourceAlignmentRect {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
}
|
|
53
|
+
export declare function LinkZoomTransitionSource(props: PropsWithChildren<{
|
|
54
|
+
identifier: string;
|
|
55
|
+
alignment?: LinkSourceAlignmentRect;
|
|
56
|
+
}>): import("react").JSX.Element | null;
|
|
57
|
+
export {};
|
|
41
58
|
//# sourceMappingURL=native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAMpE,MAAM,WAAW,4BAA4B;IAC3C,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;IAItB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IAKf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAKD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4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,KAAK,EAAE;IAC/C,8BAA8B,EAAE,MAAM,CAAC;IACvC,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,sCAWA;AAED,UAAU,uBAAuB;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAWD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,iBAAiB,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,uBAAuB,CAAA;CAAE,CAAC,sCAYtF"}
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.NativeLinkPreviewAction = NativeLinkPreviewAction;
|
|
5
5
|
exports.NativeLinkPreview = NativeLinkPreview;
|
|
6
6
|
exports.NativeLinkPreviewContent = NativeLinkPreviewContent;
|
|
7
|
+
exports.LinkZoomTransitionEnabler = LinkZoomTransitionEnabler;
|
|
8
|
+
exports.LinkZoomTransitionSource = LinkZoomTransitionSource;
|
|
7
9
|
const expo_1 = require("expo");
|
|
8
10
|
const react_native_1 = require("react-native");
|
|
9
11
|
const areNativeViewsAvailable = process.env.EXPO_OS === 'ios' && !react_native_1.Platform.isTV && global.RN$Bridgeless === true;
|
|
@@ -43,4 +45,24 @@ function NativeLinkPreviewContent(props) {
|
|
|
43
45
|
return <NativeLinkPreviewContentView {...props} style={style}/>;
|
|
44
46
|
}
|
|
45
47
|
// #endregion
|
|
48
|
+
// #region Zoom transition
|
|
49
|
+
const LinkZoomTransitionEnablerNativeView = areNativeViewsAvailable
|
|
50
|
+
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionEnabler')
|
|
51
|
+
: null;
|
|
52
|
+
function LinkZoomTransitionEnabler(props) {
|
|
53
|
+
if (!LinkZoomTransitionEnablerNativeView) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return (<LinkZoomTransitionEnablerNativeView {...props} disableForceFlatten style={{ display: 'contents' }}/>);
|
|
57
|
+
}
|
|
58
|
+
const LinkZoomTransitionSourceNativeView = areNativeViewsAvailable
|
|
59
|
+
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionSource')
|
|
60
|
+
: null;
|
|
61
|
+
function LinkZoomTransitionSource(props) {
|
|
62
|
+
if (!LinkZoomTransitionSourceNativeView) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return (<LinkZoomTransitionSourceNativeView {...props} disableForceFlatten style={{ display: 'contents' }}/>);
|
|
66
|
+
}
|
|
67
|
+
// #endregion
|
|
46
68
|
//# sourceMappingURL=native.js.map
|
|
@@ -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;;AAkCb,0DAKC;AA4BD,8CAKC;AAYD,4DAaC;AASD,8DAcC;AAkBD,4DAaC;AArJD,+BAAyC;AAEzC,+CAAoE;AAEpE,MAAM,uBAAuB,GAC3B,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,uBAAQ,CAAC,IAAI,IAAI,MAAM,CAAC,aAAa,KAAK,IAAI,CAAC;AAuBnF,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;IACzE,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,2BAA2B,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACpD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AAE,CAAC,EAC/B,CACH,CAAC;AACJ,CAAC;AASD,MAAM,kCAAkC,GAM7B,uBAAuB;IAChC,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,0BAA0B,CAAC;IAC9E,CAAC,CAAC,IAAI,CAAC;AACT,SAAgB,wBAAwB,CACtC,KAAqF;IAErF,IAAI,CAAC,kCAAkC,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,CAAC,kCAAkC,CACjC,IAAI,KAAK,CAAC,CACV,mBAAmB,CACnB,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 type { PropsWithChildren } from 'react';\nimport { Platform, StyleSheet, type ViewProps } from 'react-native';\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 // 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 onSelected: () => void;\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\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\ninterface LinkSourceAlignmentRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nconst LinkZoomTransitionSourceNativeView: React.ComponentType<\n ViewProps & {\n identifier: string;\n disableForceFlatten?: boolean;\n alignment?: LinkSourceAlignmentRect;\n }\n> | null = areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionSource')\n : null;\nexport function LinkZoomTransitionSource(\n props: PropsWithChildren<{ identifier: string; alignment?: LinkSourceAlignmentRect }>\n) {\n if (!LinkZoomTransitionSourceNativeView) {\n return null;\n }\n return (\n <LinkZoomTransitionSourceNativeView\n {...props}\n disableForceFlatten\n style={{ display: 'contents' }}\n />\n );\n}\n// #endregion\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';
|
|
2
|
+
export declare function enableZoomTransition(): void;
|
|
3
|
+
export declare function isZoomTransitionEnabled(): boolean;
|
|
4
|
+
export declare function ZoomTransitionEnabler(props: ZoomTransitionEnablerProps): null;
|
|
5
|
+
//# sourceMappingURL=ZoomTransitionEnabler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,oBAAoB,SAAK;AAEzC,wBAAgB,uBAAuB,YAEtC;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,QAEtE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';
|
|
2
|
+
export declare function enableZoomTransition(): void;
|
|
3
|
+
export declare function isZoomTransitionEnabled(): boolean;
|
|
4
|
+
export declare function ZoomTransitionEnabler({ route }: ZoomTransitionEnablerProps): import("react").JSX.Element | null;
|
|
5
|
+
//# sourceMappingURL=ZoomTransitionEnabler.ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AAahF,wBAAgB,oBAAoB,SAGnC;AAED,wBAAgB,uBAAuB,YAEtC;AAED,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE,0BAA0B,sCAmC1E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableZoomTransition = enableZoomTransition;
|
|
4
|
+
exports.isZoomTransitionEnabled = isZoomTransitionEnabled;
|
|
5
|
+
exports.ZoomTransitionEnabler = ZoomTransitionEnabler;
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const descriptors_context_1 = require("../../fork/native-stack/descriptors-context");
|
|
8
|
+
const navigationParams_1 = require("../../navigationParams");
|
|
9
|
+
const PreviewRouteContext_1 = require("../preview/PreviewRouteContext");
|
|
10
|
+
const native_1 = require("../preview/native");
|
|
11
|
+
let _isZoomTransitionEnabled = false;
|
|
12
|
+
function enableZoomTransition() {
|
|
13
|
+
console.warn('[expo-router] Zoom transition is an experimental feature. Use at your own risk.');
|
|
14
|
+
_isZoomTransitionEnabled = true;
|
|
15
|
+
}
|
|
16
|
+
function isZoomTransitionEnabled() {
|
|
17
|
+
return _isZoomTransitionEnabled;
|
|
18
|
+
}
|
|
19
|
+
function ZoomTransitionEnabler({ route }) {
|
|
20
|
+
const isPreview = (0, PreviewRouteContext_1.useIsPreview)();
|
|
21
|
+
if (isZoomTransitionEnabled() &&
|
|
22
|
+
!isPreview &&
|
|
23
|
+
route &&
|
|
24
|
+
typeof route === 'object' &&
|
|
25
|
+
'params' in route &&
|
|
26
|
+
typeof route.params === 'object' &&
|
|
27
|
+
'key' in route &&
|
|
28
|
+
typeof route.key === 'string') {
|
|
29
|
+
const params = route.params ?? {};
|
|
30
|
+
const internalParams = (0, navigationParams_1.getInternalExpoRouterParams)(params);
|
|
31
|
+
const zoomTransitionId = internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];
|
|
32
|
+
const zoomTransitionScreenId = internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME];
|
|
33
|
+
const isLinkPreviewNavigation = !!internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME];
|
|
34
|
+
const hasZoomTransition = !!zoomTransitionId && zoomTransitionScreenId === route.key && !isLinkPreviewNavigation;
|
|
35
|
+
if (hasZoomTransition && typeof zoomTransitionId === 'string') {
|
|
36
|
+
const descriptorsMap = (0, react_1.use)(descriptors_context_1.DescriptorsContext);
|
|
37
|
+
const currentDescriptor = descriptorsMap[route.key];
|
|
38
|
+
const preventInteractiveDismissal = currentDescriptor?.options?.gestureEnabled === false;
|
|
39
|
+
return (<native_1.LinkZoomTransitionEnabler zoomTransitionSourceIdentifier={zoomTransitionId} preventInteractiveDismissal={preventInteractiveDismissal}/>);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=ZoomTransitionEnabler.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomTransitionEnabler.ios.js","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.ios.tsx"],"names":[],"mappings":";;AAeA,oDAGC;AAED,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CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACpD,MAAM,2BAA2B,GAAG,iBAAiB,EAAE,OAAO,EAAE,cAAc,KAAK,KAAK,CAAC;YACzF,OAAO,CACL,CAAC,kCAAyB,CACxB,8BAA8B,CAAC,CAAC,gBAAgB,CAAC,CACjD,2BAA2B,CAAC,CAAC,2BAA2B,CAAC,EACzD,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { use } from 'react';\n\nimport type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';\nimport { DescriptorsContext } from '../../fork/native-stack/descriptors-context';\nimport {\n getInternalExpoRouterParams,\n INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME,\n} from '../../navigationParams';\nimport { useIsPreview } from '../preview/PreviewRouteContext';\nimport { LinkZoomTransitionEnabler } from '../preview/native';\n\nlet _isZoomTransitionEnabled = false;\n\nexport function enableZoomTransition() {\n console.warn('[expo-router] Zoom transition is an experimental feature. Use at your own risk.');\n _isZoomTransitionEnabled = true;\n}\n\nexport function isZoomTransitionEnabled() {\n return _isZoomTransitionEnabled;\n}\n\nexport function ZoomTransitionEnabler({ route }: ZoomTransitionEnablerProps) {\n const isPreview = useIsPreview();\n if (\n isZoomTransitionEnabled() &&\n !isPreview &&\n route &&\n typeof route === 'object' &&\n 'params' in route &&\n typeof route.params === 'object' &&\n 'key' in route &&\n typeof route.key === 'string'\n ) {\n const params = route.params ?? {};\n const internalParams = getInternalExpoRouterParams(params);\n const zoomTransitionId =\n internalParams[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];\n const zoomTransitionScreenId =\n internalParams[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME];\n const isLinkPreviewNavigation =\n !!internalParams[INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME];\n const hasZoomTransition =\n !!zoomTransitionId && zoomTransitionScreenId === route.key && !isLinkPreviewNavigation;\n if (hasZoomTransition && typeof zoomTransitionId === 'string') {\n const descriptorsMap = use(DescriptorsContext);\n const currentDescriptor = descriptorsMap[route.key];\n const preventInteractiveDismissal = currentDescriptor?.options?.gestureEnabled === false;\n return (\n <LinkZoomTransitionEnabler\n zoomTransitionSourceIdentifier={zoomTransitionId}\n preventInteractiveDismissal={preventInteractiveDismissal}\n />\n );\n }\n }\n return null;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableZoomTransition = enableZoomTransition;
|
|
4
|
+
exports.isZoomTransitionEnabled = isZoomTransitionEnabled;
|
|
5
|
+
exports.ZoomTransitionEnabler = ZoomTransitionEnabler;
|
|
6
|
+
function enableZoomTransition() { }
|
|
7
|
+
function isZoomTransitionEnabled() {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
function ZoomTransitionEnabler(props) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ZoomTransitionEnabler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomTransitionEnabler.js","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.tsx"],"names":[],"mappings":";;AAEA,oDAAyC;AAEzC,0DAEC;AAED,sDAEC;AARD,SAAgB,oBAAoB,KAAI,CAAC;AAEzC,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 enableZoomTransition() {}\n\nexport function isZoomTransitionEnabled() {\n return false;\n}\n\nexport function ZoomTransitionEnabler(props: ZoomTransitionEnablerProps) {\n return null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
interface LinkAppleZoomProps extends PropsWithChildren {
|
|
3
|
+
/**
|
|
4
|
+
* Defines the rectangle used for the zoom transition's alignment. This rectangle is specified in the zoomed screen's coordinate space.
|
|
5
|
+
*
|
|
6
|
+
* @platform ios 18+
|
|
7
|
+
*/
|
|
8
|
+
alignmentRect?: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* When this component is used inside a Link, [zoom transition](https://developer.apple.com/documentation/uikit/enhancing-your-app-with-fluid-transitions?language=objc)
|
|
17
|
+
* will be used when navigating to the link's href.
|
|
18
|
+
*
|
|
19
|
+
* @platform ios 18+
|
|
20
|
+
*/
|
|
21
|
+
export declare function LinkAppleZoom(props: LinkAppleZoomProps): import("react").JSX.Element;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=link-apple-zoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,UAAU,kBAAmB,SAAQ,iBAAiB;IACpD;;;;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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.LinkAppleZoom = LinkAppleZoom;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ZoomTransitionEnabler_ios_1 = require("./ZoomTransitionEnabler.ios");
|
|
7
|
+
const zoom_transition_context_1 = require("./zoom-transition-context");
|
|
8
|
+
const Slot_1 = require("../../ui/Slot");
|
|
9
|
+
const native_1 = require("../preview/native");
|
|
10
|
+
/**
|
|
11
|
+
* When this component is used inside a Link, [zoom transition](https://developer.apple.com/documentation/uikit/enhancing-your-app-with-fluid-transitions?language=objc)
|
|
12
|
+
* will be used when navigating to the link's href.
|
|
13
|
+
*
|
|
14
|
+
* @platform ios 18+
|
|
15
|
+
*/
|
|
16
|
+
function LinkAppleZoom(props) {
|
|
17
|
+
if (!(0, ZoomTransitionEnabler_ios_1.isZoomTransitionEnabled)()) {
|
|
18
|
+
return <Slot_1.Slot {...props}/>;
|
|
19
|
+
}
|
|
20
|
+
return <LinkAppleZoomImpl {...props}/>;
|
|
21
|
+
}
|
|
22
|
+
function LinkAppleZoomImpl({ children, alignmentRect, ...rest }) {
|
|
23
|
+
const value = (0, react_1.use)(zoom_transition_context_1.ZoomTransitionSourceContext);
|
|
24
|
+
if (!value) {
|
|
25
|
+
throw new Error('[expo-router] Link.ZoomTransitionSource must be used within a Link');
|
|
26
|
+
}
|
|
27
|
+
const { identifier, addSource, removeSource } = value;
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
addSource();
|
|
30
|
+
return removeSource;
|
|
31
|
+
}, [addSource, removeSource]);
|
|
32
|
+
if (react_1.Children.count(children) > 1) {
|
|
33
|
+
console.warn('[expo-router] Link.ZoomTransitionSource only accepts a single child component. Please wrap multiple children in a View or another container component.');
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return (<native_1.LinkZoomTransitionSource identifier={identifier} alignment={alignmentRect}>
|
|
37
|
+
<Slot_1.Slot {...rest}>{children}</Slot_1.Slot>
|
|
38
|
+
</native_1.LinkZoomTransitionSource>);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=link-apple-zoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,2EAAsE;AACtE,uEAAwE;AACxE,wCAAqC;AACrC,8CAA6D;AAgB7D;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAyB;IACrD,IAAI,CAAC,IAAA,mDAAuB,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,IAAI,gBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,CACV,wJAAwJ,CACzJ,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,CAAC,iCAAwB,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,CACzE;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.ios';\nimport { ZoomTransitionSourceContext } from './zoom-transition-context';\nimport { Slot } from '../../ui/Slot';\nimport { LinkZoomTransitionSource } from '../preview/native';\n\ninterface 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 if (Children.count(children) > 1) {\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 return null;\n }\n\n return (\n <LinkZoomTransitionSource identifier={identifier} alignment={alignmentRect}>\n <Slot {...rest}>{children}</Slot>\n </LinkZoomTransitionSource>\n );\n}\n"]}
|