expo-router 7.0.0-canary-20260114-d8e19f5 → 7.0.0-canary-20260119-70f7c28
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/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +2 -0
- package/build/ExpoRoot.js.map +1 -1
- package/build/global.d.ts +29 -0
- package/build/global.d.ts.map +1 -0
- package/build/global.js +3 -0
- package/build/global.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/layouts/Stack.d.ts.map +1 -1
- package/build/layouts/Stack.js +3 -0
- package/build/layouts/Stack.js.map +1 -1
- package/build/layouts/Stack.web.js +1 -0
- package/build/layouts/Stack.web.js.map +1 -1
- package/build/layouts/StackClient.d.ts +13 -14
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +3 -2
- package/build/layouts/StackClient.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderComponent.d.ts +12 -23
- package/build/layouts/stack-utils/StackHeaderComponent.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderComponent.js +15 -55
- package/build/layouts/stack-utils/StackHeaderComponent.js.map +1 -1
- package/build/layouts/stack-utils/StackScreen.d.ts +5 -0
- package/build/layouts/stack-utils/StackScreen.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackScreen.js +34 -7
- package/build/layouts/stack-utils/StackScreen.js.map +1 -1
- package/build/layouts/stack-utils/StackSearchBar.d.ts +28 -0
- package/build/layouts/stack-utils/StackSearchBar.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackSearchBar.js +29 -0
- package/build/layouts/stack-utils/StackSearchBar.js.map +1 -1
- package/build/layouts/stack-utils/common-primitives.d.ts +6 -6
- package/build/layouts/stack-utils/common-primitives.d.ts.map +1 -1
- package/build/layouts/stack-utils/common-primitives.js +4 -4
- package/build/layouts/stack-utils/common-primitives.js.map +1 -1
- package/build/layouts/stack-utils/index.d.ts +4 -23
- package/build/layouts/stack-utils/index.d.ts.map +1 -1
- package/build/layouts/stack-utils/index.js +18 -35
- package/build/layouts/stack-utils/index.js.map +1 -1
- package/build/layouts/stack-utils/screen/StackScreenBackButton.d.ts +68 -0
- package/build/layouts/stack-utils/screen/StackScreenBackButton.d.ts.map +1 -0
- package/build/layouts/stack-utils/screen/StackScreenBackButton.js +58 -0
- package/build/layouts/stack-utils/screen/StackScreenBackButton.js.map +1 -0
- package/build/layouts/stack-utils/screen/StackScreenTitle.d.ts +58 -0
- package/build/layouts/stack-utils/screen/StackScreenTitle.d.ts.map +1 -0
- package/build/layouts/stack-utils/screen/StackScreenTitle.js +75 -0
- package/build/layouts/stack-utils/screen/StackScreenTitle.js.map +1 -0
- package/build/layouts/stack-utils/screen/index.d.ts +3 -0
- package/build/layouts/stack-utils/screen/index.d.ts.map +1 -0
- package/build/layouts/stack-utils/screen/index.js +10 -0
- package/build/layouts/stack-utils/screen/index.js.map +1 -0
- package/build/layouts/stack-utils/shared.js +3 -3
- package/build/layouts/stack-utils/shared.js.map +1 -1
- package/build/layouts/stack-utils/toolbar/StackToolbar.d.ts +3 -0
- package/build/layouts/stack-utils/toolbar/StackToolbar.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbar.js +24 -0
- package/build/layouts/stack-utils/toolbar/StackToolbar.js.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarButton.d.ts +144 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarButton.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarButton.js +68 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarButton.js.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarClient.d.ts +104 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarClient.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarClient.js +214 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarClient.js.map +1 -0
- package/build/layouts/stack-utils/{StackHeaderMenu.d.ts → toolbar/StackToolbarMenu.d.ts} +58 -106
- package/build/layouts/stack-utils/toolbar/StackToolbarMenu.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarMenu.js +190 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarMenu.js.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.d.ts +48 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.js +44 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.js.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.d.ts +80 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.js +77 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.js.map +1 -0
- package/build/layouts/stack-utils/{StackHeaderView.d.ts → toolbar/StackToolbarView.d.ts} +21 -17
- package/build/layouts/stack-utils/toolbar/StackToolbarView.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarView.js +61 -0
- package/build/layouts/stack-utils/toolbar/StackToolbarView.js.map +1 -0
- package/build/layouts/stack-utils/toolbar/bottom-toolbar-native-elements.d.ts +93 -0
- package/build/layouts/stack-utils/toolbar/bottom-toolbar-native-elements.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/bottom-toolbar-native-elements.js +89 -0
- package/build/layouts/stack-utils/toolbar/bottom-toolbar-native-elements.js.map +1 -0
- package/build/layouts/stack-utils/toolbar/context.d.ts +9 -0
- package/build/layouts/stack-utils/toolbar/context.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/context.js +16 -0
- package/build/layouts/stack-utils/toolbar/context.js.map +1 -0
- package/build/layouts/stack-utils/toolbar/index.d.ts +10 -0
- package/build/layouts/stack-utils/toolbar/index.d.ts.map +1 -0
- package/build/layouts/stack-utils/toolbar/index.js +23 -0
- package/build/layouts/stack-utils/toolbar/index.js.map +1 -0
- package/build/link/LinkWithPreview.d.ts.map +1 -1
- package/build/link/LinkWithPreview.js +8 -5
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/NativeMenuContext.d.ts +5 -0
- package/build/link/NativeMenuContext.d.ts.map +1 -0
- package/build/link/NativeMenuContext.js +9 -0
- package/build/link/NativeMenuContext.js.map +1 -0
- package/build/link/elements.d.ts +41 -0
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +3 -2
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +2 -0
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js +3 -1
- package/build/link/preview/native.js.map +1 -1
- package/build/native-tabs/NativeBottomTabsNavigator.d.ts +1 -1
- package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabsNavigator.js +2 -1
- package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -1
- package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeTabTrigger.js +6 -4
- package/build/native-tabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeTabsView.js +0 -3
- package/build/native-tabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/common/elements.d.ts +10 -0
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/native-tabs/types.d.ts +6 -0
- package/build/native-tabs/types.d.ts.map +1 -1
- package/build/native-tabs/types.js.map +1 -1
- package/build/native-tabs/utils/icon.d.ts +2 -0
- package/build/native-tabs/utils/icon.d.ts.map +1 -1
- package/build/native-tabs/utils/icon.js +3 -0
- package/build/native-tabs/utils/icon.js.map +1 -1
- package/build/navigationEvents/index.d.ts +7 -24
- package/build/navigationEvents/index.d.ts.map +1 -1
- package/build/navigationEvents/index.js +47 -12
- package/build/navigationEvents/index.js.map +1 -1
- package/build/navigationEvents/types.d.ts +23 -0
- package/build/navigationEvents/types.d.ts.map +1 -0
- package/build/navigationEvents/types.js +3 -0
- package/build/navigationEvents/types.js.map +1 -0
- package/build/navigationEvents/utils.d.ts +9 -0
- package/build/navigationEvents/utils.d.ts.map +1 -0
- package/build/navigationEvents/utils.js +25 -0
- package/build/navigationEvents/utils.js.map +1 -0
- package/build/primitives/types.d.ts +6 -6
- package/build/primitives/types.d.ts.map +1 -1
- package/build/primitives/types.js.map +1 -1
- package/build/screensFeatureFlags.d.ts +2 -0
- package/build/screensFeatureFlags.d.ts.map +1 -0
- package/build/screensFeatureFlags.js +20 -0
- package/build/screensFeatureFlags.js.map +1 -0
- package/build/toolbar/native.types.d.ts +0 -14
- package/build/toolbar/native.types.d.ts.map +1 -1
- package/build/toolbar/native.types.js.map +1 -1
- package/build/ui/TabRouter.d.ts +14 -2
- package/build/ui/TabRouter.d.ts.map +1 -1
- package/build/ui/TabRouter.js +34 -4
- package/build/ui/TabRouter.js.map +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +30 -15
- package/build/useScreens.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/LinkPreview/LinkPreviewNativeActionView.swift +18 -2
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +3 -0
- package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +2 -2
- package/ios/LinkPreview/LinkZoomTransition.swift +2 -2
- package/ios/Toolbar/RouterToolbarHostView.swift +68 -43
- package/ios/Toolbar/RouterToolbarItemView.swift +89 -21
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.module → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.pom → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.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 +11 -13
- package/plugin/build/index.js +1 -1
- package/plugin/options.json +5 -0
- package/plugin/src/index.ts +1 -1
- package/build/layouts/stack-utils/StackHeaderBackButton.d.ts +0 -14
- package/build/layouts/stack-utils/StackHeaderBackButton.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderBackButton.js +0 -19
- package/build/layouts/stack-utils/StackHeaderBackButton.js.map +0 -1
- package/build/layouts/stack-utils/StackHeaderButton.d.ts +0 -114
- package/build/layouts/stack-utils/StackHeaderButton.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderButton.js +0 -49
- package/build/layouts/stack-utils/StackHeaderButton.js.map +0 -1
- package/build/layouts/stack-utils/StackHeaderLeftRight.d.ts +0 -119
- package/build/layouts/stack-utils/StackHeaderLeftRight.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderLeftRight.js +0 -206
- package/build/layouts/stack-utils/StackHeaderLeftRight.js.map +0 -1
- package/build/layouts/stack-utils/StackHeaderMenu.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderMenu.js +0 -214
- package/build/layouts/stack-utils/StackHeaderMenu.js.map +0 -1
- package/build/layouts/stack-utils/StackHeaderSpacer.d.ts +0 -46
- package/build/layouts/stack-utils/StackHeaderSpacer.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderSpacer.js +0 -44
- package/build/layouts/stack-utils/StackHeaderSpacer.js.map +0 -1
- package/build/layouts/stack-utils/StackHeaderTitle.d.ts +0 -22
- package/build/layouts/stack-utils/StackHeaderTitle.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderTitle.js +0 -36
- package/build/layouts/stack-utils/StackHeaderTitle.js.map +0 -1
- package/build/layouts/stack-utils/StackHeaderView.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderView.js +0 -56
- package/build/layouts/stack-utils/StackHeaderView.js.map +0 -1
- package/build/toolbar/elements.d.ts +0 -417
- package/build/toolbar/elements.d.ts.map +0 -1
- package/build/toolbar/elements.js +0 -188
- package/build/toolbar/elements.js.map +0 -1
- package/build/toolbar/index.d.ts +0 -42
- package/build/toolbar/index.d.ts.map +0 -1
- package/build/toolbar/index.js +0 -49
- package/build/toolbar/index.js.map +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.pom.sha512 +0 -1
- package/unstable-toolbar.d.ts +0 -1
- package/unstable-toolbar.js +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5-sources.jar → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5-sources.jar.md5 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5-sources.jar.sha1 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5-sources.jar.sha256 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5-sources.jar.sha512 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.aar → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.aar.md5 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.aar.sha1 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.aar.sha256 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260114-d8e19f5/expo.modules.router-7.0.0-canary-20260114-d8e19f5.aar.sha512 → 7.0.0-canary-20260119-70f7c28/expo.modules.router-7.0.0-canary-20260119-70f7c28.aar.sha512} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StackScreenBackButton = StackScreenBackButton;
|
|
4
|
+
exports.appendStackScreenBackButtonPropsToOptions = appendStackScreenBackButtonPropsToOptions;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const Screen_1 = require("../../../views/Screen");
|
|
7
|
+
/**
|
|
8
|
+
* Component to configure the back button.
|
|
9
|
+
*
|
|
10
|
+
* Can be used inside Stack.Screen in a layout or directly inside a screen component.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { Stack } from 'expo-router';
|
|
15
|
+
*
|
|
16
|
+
* export default function Layout() {
|
|
17
|
+
* return (
|
|
18
|
+
* <Stack>
|
|
19
|
+
* <Stack.Screen name="detail">
|
|
20
|
+
* <Stack.Screen.BackButton displayMode="minimal">Back</Stack.Screen.BackButton>
|
|
21
|
+
* </Stack.Screen>
|
|
22
|
+
* </Stack>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import { Stack } from 'expo-router';
|
|
30
|
+
*
|
|
31
|
+
* export default function Page() {
|
|
32
|
+
* return (
|
|
33
|
+
* <>
|
|
34
|
+
* <Stack.Screen.BackButton hidden />
|
|
35
|
+
* <ScreenContent />
|
|
36
|
+
* </>
|
|
37
|
+
* );
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @platform ios
|
|
42
|
+
*/
|
|
43
|
+
function StackScreenBackButton(props) {
|
|
44
|
+
const updatedOptions = (0, react_1.useMemo)(() => appendStackScreenBackButtonPropsToOptions({}, props), [props]);
|
|
45
|
+
return <Screen_1.Screen options={updatedOptions}/>;
|
|
46
|
+
}
|
|
47
|
+
function appendStackScreenBackButtonPropsToOptions(options, props) {
|
|
48
|
+
return {
|
|
49
|
+
...options,
|
|
50
|
+
headerBackTitle: props.children,
|
|
51
|
+
headerBackTitleStyle: props.style,
|
|
52
|
+
headerBackImageSource: props.src,
|
|
53
|
+
headerBackButtonDisplayMode: props.displayMode,
|
|
54
|
+
headerBackButtonMenuEnabled: props.withMenu,
|
|
55
|
+
headerBackVisible: !props.hidden,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=StackScreenBackButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackScreenBackButton.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/StackScreenBackButton.tsx"],"names":[],"mappings":";;AAsEA,sDAMC;AAED,8FAaC;AA1FD,iCAAgC;AAIhC,kDAA+C;AA6B/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,SAAgB,qBAAqB,CAAC,KAAiC;IACrE,MAAM,cAAc,GAAG,IAAA,eAAO,EAC5B,GAAG,EAAE,CAAC,yCAAyC,CAAC,EAAE,EAAE,KAAK,CAAC,EAC1D,CAAC,KAAK,CAAC,CACR,CAAC;IACF,OAAO,CAAC,eAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,EAAG,CAAC;AAC7C,CAAC;AAED,SAAgB,yCAAyC,CACvD,OAAqC,EACrC,KAAiC;IAEjC,OAAO;QACL,GAAG,OAAO;QACV,eAAe,EAAE,KAAK,CAAC,QAAQ;QAC/B,oBAAoB,EAAE,KAAK,CAAC,KAAK;QACjC,qBAAqB,EAAE,KAAK,CAAC,GAAG;QAChC,2BAA2B,EAAE,KAAK,CAAC,WAAW;QAC9C,2BAA2B,EAAE,KAAK,CAAC,QAAQ;QAC3C,iBAAiB,EAAE,CAAC,KAAK,CAAC,MAAM;KACjC,CAAC;AACJ,CAAC","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport { useMemo } from 'react';\nimport type { ImageSourcePropType } from 'react-native';\nimport type { ScreenStackHeaderConfigProps } from 'react-native-screens';\n\nimport { Screen } from '../../../views/Screen';\n\nexport interface StackScreenBackButtonProps {\n /**\n * The title to display for the back button.\n */\n children?: string;\n /**\n * Style for the back button title.\n */\n style?: NativeStackNavigationOptions['headerBackTitleStyle'];\n /**\n * Whether to show a context menu when long pressing the back button.\n */\n withMenu?: boolean;\n /**\n * The display mode for the back button.\n */\n displayMode?: ScreenStackHeaderConfigProps['backButtonDisplayMode'];\n /**\n * Whether to hide the back button.\n */\n hidden?: boolean;\n /**\n * Custom image source for the back button.\n */\n src?: ImageSourcePropType;\n}\n\n/**\n * Component to configure the back button.\n *\n * Can be used inside Stack.Screen in a layout or directly inside a screen component.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Layout() {\n * return (\n * <Stack>\n * <Stack.Screen name=\"detail\">\n * <Stack.Screen.BackButton displayMode=\"minimal\">Back</Stack.Screen.BackButton>\n * </Stack.Screen>\n * </Stack>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Screen.BackButton hidden />\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport function StackScreenBackButton(props: StackScreenBackButtonProps) {\n const updatedOptions = useMemo(\n () => appendStackScreenBackButtonPropsToOptions({}, props),\n [props]\n );\n return <Screen options={updatedOptions} />;\n}\n\nexport function appendStackScreenBackButtonPropsToOptions(\n options: NativeStackNavigationOptions,\n props: StackScreenBackButtonProps\n): NativeStackNavigationOptions {\n return {\n ...options,\n headerBackTitle: props.children,\n headerBackTitleStyle: props.style,\n headerBackImageSource: props.src,\n headerBackButtonDisplayMode: props.displayMode,\n headerBackButtonMenuEnabled: props.withMenu,\n headerBackVisible: !props.hidden,\n };\n}\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
|
2
|
+
import { type StyleProp, type TextStyle } from 'react-native';
|
|
3
|
+
export type StackScreenTitleProps = {
|
|
4
|
+
children?: string;
|
|
5
|
+
style?: StyleProp<{
|
|
6
|
+
fontFamily?: TextStyle['fontFamily'];
|
|
7
|
+
fontSize?: TextStyle['fontSize'];
|
|
8
|
+
fontWeight?: Exclude<TextStyle['fontWeight'], number>;
|
|
9
|
+
color?: string;
|
|
10
|
+
textAlign?: 'left' | 'center';
|
|
11
|
+
}>;
|
|
12
|
+
largeStyle?: StyleProp<{
|
|
13
|
+
fontFamily?: TextStyle['fontFamily'];
|
|
14
|
+
fontSize?: TextStyle['fontSize'];
|
|
15
|
+
fontWeight?: Exclude<TextStyle['fontWeight'], number>;
|
|
16
|
+
color?: string;
|
|
17
|
+
}>;
|
|
18
|
+
large?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Component to set the screen title.
|
|
22
|
+
*
|
|
23
|
+
* Can be used inside Stack.Screen in a layout or directly inside a screen component.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { Stack } from 'expo-router';
|
|
28
|
+
*
|
|
29
|
+
* export default function Layout() {
|
|
30
|
+
* return (
|
|
31
|
+
* <Stack>
|
|
32
|
+
* <Stack.Screen name="index">
|
|
33
|
+
* <Stack.Screen.Title large>Home</Stack.Screen.Title>
|
|
34
|
+
* </Stack.Screen>
|
|
35
|
+
* </Stack>
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* import { Stack } from 'expo-router';
|
|
43
|
+
*
|
|
44
|
+
* export default function Page() {
|
|
45
|
+
* return (
|
|
46
|
+
* <>
|
|
47
|
+
* <Stack.Screen.Title>My Page</Stack.Screen.Title>
|
|
48
|
+
* <ScreenContent />
|
|
49
|
+
* </>
|
|
50
|
+
* );
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @platform ios
|
|
55
|
+
*/
|
|
56
|
+
export declare function StackScreenTitle(props: StackScreenTitleProps): import("react").JSX.Element;
|
|
57
|
+
export declare function appendStackScreenTitlePropsToOptions(options: NativeStackNavigationOptions, props: StackScreenTitleProps): NativeStackNavigationOptions;
|
|
58
|
+
//# sourceMappingURL=StackScreenTitle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackScreenTitle.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/StackScreenTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAK1E,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;QAChB,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;QACrC,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;QACjC,UAAU,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;QAGtD,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;KAC/B,CAAC,CAAC;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;QACrB,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;QACrC,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;QACjC,UAAU,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;QAGtD,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,+BAG5D;AAED,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,4BAA4B,EACrC,KAAK,EAAE,qBAAqB,GAC3B,4BAA4B,CA0B9B"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StackScreenTitle = StackScreenTitle;
|
|
4
|
+
exports.appendStackScreenTitlePropsToOptions = appendStackScreenTitlePropsToOptions;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const style_1 = require("../../../utils/style");
|
|
8
|
+
const Screen_1 = require("../../../views/Screen");
|
|
9
|
+
/**
|
|
10
|
+
* Component to set the screen title.
|
|
11
|
+
*
|
|
12
|
+
* Can be used inside Stack.Screen in a layout or directly inside a screen component.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { Stack } from 'expo-router';
|
|
17
|
+
*
|
|
18
|
+
* export default function Layout() {
|
|
19
|
+
* return (
|
|
20
|
+
* <Stack>
|
|
21
|
+
* <Stack.Screen name="index">
|
|
22
|
+
* <Stack.Screen.Title large>Home</Stack.Screen.Title>
|
|
23
|
+
* </Stack.Screen>
|
|
24
|
+
* </Stack>
|
|
25
|
+
* );
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* import { Stack } from 'expo-router';
|
|
32
|
+
*
|
|
33
|
+
* export default function Page() {
|
|
34
|
+
* return (
|
|
35
|
+
* <>
|
|
36
|
+
* <Stack.Screen.Title>My Page</Stack.Screen.Title>
|
|
37
|
+
* <ScreenContent />
|
|
38
|
+
* </>
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @platform ios
|
|
44
|
+
*/
|
|
45
|
+
function StackScreenTitle(props) {
|
|
46
|
+
const updatedOptions = (0, react_1.useMemo)(() => appendStackScreenTitlePropsToOptions({}, props), [props]);
|
|
47
|
+
return <Screen_1.Screen options={updatedOptions}/>;
|
|
48
|
+
}
|
|
49
|
+
function appendStackScreenTitlePropsToOptions(options, props) {
|
|
50
|
+
const flattenedStyle = react_native_1.StyleSheet.flatten(props.style);
|
|
51
|
+
const flattenedLargeStyle = react_native_1.StyleSheet.flatten(props.largeStyle);
|
|
52
|
+
return {
|
|
53
|
+
...options,
|
|
54
|
+
title: props.children,
|
|
55
|
+
headerLargeTitle: props.large,
|
|
56
|
+
headerTitleAlign: flattenedStyle?.textAlign,
|
|
57
|
+
headerTitleStyle: {
|
|
58
|
+
...flattenedStyle,
|
|
59
|
+
...(flattenedStyle?.fontWeight
|
|
60
|
+
? {
|
|
61
|
+
fontWeight: (0, style_1.convertFontWeightToStringFontWeight)(flattenedStyle?.fontWeight),
|
|
62
|
+
}
|
|
63
|
+
: {}),
|
|
64
|
+
},
|
|
65
|
+
headerLargeTitleStyle: {
|
|
66
|
+
...flattenedLargeStyle,
|
|
67
|
+
...(flattenedLargeStyle?.fontWeight
|
|
68
|
+
? {
|
|
69
|
+
fontWeight: (0, style_1.convertFontWeightToStringFontWeight)(flattenedLargeStyle?.fontWeight),
|
|
70
|
+
}
|
|
71
|
+
: {}),
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=StackScreenTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackScreenTitle.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/StackScreenTitle.tsx"],"names":[],"mappings":";;AAiEA,4CAGC;AAED,oFA6BC;AAlGD,iCAAgC;AAChC,+CAA0E;AAE1E,gDAA2E;AAC3E,kDAA+C;AAwB/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,cAAc,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,oCAAoC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/F,OAAO,CAAC,eAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,EAAG,CAAC;AAC7C,CAAC;AAED,SAAgB,oCAAoC,CAClD,OAAqC,EACrC,KAA4B;IAE5B,MAAM,cAAc,GAAG,yBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,mBAAmB,GAAG,yBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAEjE,OAAO;QACL,GAAG,OAAO;QACV,KAAK,EAAE,KAAK,CAAC,QAAQ;QACrB,gBAAgB,EAAE,KAAK,CAAC,KAAK;QAC7B,gBAAgB,EAAE,cAAc,EAAE,SAAS;QAC3C,gBAAgB,EAAE;YAChB,GAAG,cAAc;YACjB,GAAG,CAAC,cAAc,EAAE,UAAU;gBAC5B,CAAC,CAAC;oBACE,UAAU,EAAE,IAAA,2CAAmC,EAAC,cAAc,EAAE,UAAU,CAAC;iBAC5E;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;QACD,qBAAqB,EAAE;YACrB,GAAG,mBAAmB;YACtB,GAAG,CAAC,mBAAmB,EAAE,UAAU;gBACjC,CAAC,CAAC;oBACE,UAAU,EAAE,IAAA,2CAAmC,EAAC,mBAAmB,EAAE,UAAU,CAAC;iBACjF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport { useMemo } from 'react';\nimport { StyleSheet, type StyleProp, type TextStyle } from 'react-native';\n\nimport { convertFontWeightToStringFontWeight } from '../../../utils/style';\nimport { Screen } from '../../../views/Screen';\n\nexport type StackScreenTitleProps = {\n children?: string;\n style?: StyleProp<{\n fontFamily?: TextStyle['fontFamily'];\n fontSize?: TextStyle['fontSize'];\n fontWeight?: Exclude<TextStyle['fontWeight'], number>;\n // TODO(@ubax): This should be ColorValue, but react-navigation types\n // currently only accept string for color props. In RN v8 we can change this to ColorValue.\n color?: string;\n textAlign?: 'left' | 'center';\n }>;\n largeStyle?: StyleProp<{\n fontFamily?: TextStyle['fontFamily'];\n fontSize?: TextStyle['fontSize'];\n fontWeight?: Exclude<TextStyle['fontWeight'], number>;\n // TODO(@ubax): This should be ColorValue, but react-navigation types\n // currently only accept string for color props. In RN v8 we can change this to ColorValue.\n color?: string;\n }>;\n large?: boolean;\n};\n\n/**\n * Component to set the screen title.\n *\n * Can be used inside Stack.Screen in a layout or directly inside a screen component.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Layout() {\n * return (\n * <Stack>\n * <Stack.Screen name=\"index\">\n * <Stack.Screen.Title large>Home</Stack.Screen.Title>\n * </Stack.Screen>\n * </Stack>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Screen.Title>My Page</Stack.Screen.Title>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport function StackScreenTitle(props: StackScreenTitleProps) {\n const updatedOptions = useMemo(() => appendStackScreenTitlePropsToOptions({}, props), [props]);\n return <Screen options={updatedOptions} />;\n}\n\nexport function appendStackScreenTitlePropsToOptions(\n options: NativeStackNavigationOptions,\n props: StackScreenTitleProps\n): NativeStackNavigationOptions {\n const flattenedStyle = StyleSheet.flatten(props.style);\n const flattenedLargeStyle = StyleSheet.flatten(props.largeStyle);\n\n return {\n ...options,\n title: props.children,\n headerLargeTitle: props.large,\n headerTitleAlign: flattenedStyle?.textAlign,\n headerTitleStyle: {\n ...flattenedStyle,\n ...(flattenedStyle?.fontWeight\n ? {\n fontWeight: convertFontWeightToStringFontWeight(flattenedStyle?.fontWeight),\n }\n : {}),\n },\n headerLargeTitleStyle: {\n ...flattenedLargeStyle,\n ...(flattenedLargeStyle?.fontWeight\n ? {\n fontWeight: convertFontWeightToStringFontWeight(flattenedLargeStyle?.fontWeight),\n }\n : {}),\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { StackScreenTitle, appendStackScreenTitlePropsToOptions, type StackScreenTitleProps, } from './StackScreenTitle';
|
|
2
|
+
export { StackScreenBackButton, appendStackScreenBackButtonPropsToOptions, type StackScreenBackButtonProps, } from './StackScreenBackButton';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oCAAoC,EACpC,KAAK,qBAAqB,GAC3B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,EACrB,yCAAyC,EACzC,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appendStackScreenBackButtonPropsToOptions = exports.StackScreenBackButton = exports.appendStackScreenTitlePropsToOptions = exports.StackScreenTitle = void 0;
|
|
4
|
+
var StackScreenTitle_1 = require("./StackScreenTitle");
|
|
5
|
+
Object.defineProperty(exports, "StackScreenTitle", { enumerable: true, get: function () { return StackScreenTitle_1.StackScreenTitle; } });
|
|
6
|
+
Object.defineProperty(exports, "appendStackScreenTitlePropsToOptions", { enumerable: true, get: function () { return StackScreenTitle_1.appendStackScreenTitlePropsToOptions; } });
|
|
7
|
+
var StackScreenBackButton_1 = require("./StackScreenBackButton");
|
|
8
|
+
Object.defineProperty(exports, "StackScreenBackButton", { enumerable: true, get: function () { return StackScreenBackButton_1.StackScreenBackButton; } });
|
|
9
|
+
Object.defineProperty(exports, "appendStackScreenBackButtonPropsToOptions", { enumerable: true, get: function () { return StackScreenBackButton_1.appendStackScreenBackButtonPropsToOptions; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/index.tsx"],"names":[],"mappings":";;;AAAA,uDAI4B;AAH1B,oHAAA,gBAAgB,OAAA;AAChB,wIAAA,oCAAoC,OAAA;AAItC,iEAIiC;AAH/B,8HAAA,qBAAqB,OAAA;AACrB,kJAAA,yCAAyC,OAAA","sourcesContent":["export {\n StackScreenTitle,\n appendStackScreenTitlePropsToOptions,\n type StackScreenTitleProps,\n} from './StackScreenTitle';\n\nexport {\n StackScreenBackButton,\n appendStackScreenBackButtonPropsToOptions,\n type StackScreenBackButtonProps,\n} from './StackScreenBackButton';\n"]}
|
|
@@ -10,14 +10,14 @@ function convertStackHeaderSharedPropsToRNSharedHeaderItem(props) {
|
|
|
10
10
|
const stringChildren = react_1.Children.toArray(children)
|
|
11
11
|
.filter((child) => typeof child === 'string')
|
|
12
12
|
.join('');
|
|
13
|
-
const label = (0, children_1.getFirstChildOfType)(children, common_primitives_1.
|
|
13
|
+
const label = (0, children_1.getFirstChildOfType)(children, common_primitives_1.StackToolbarLabel);
|
|
14
14
|
const iconPropConvertedToIcon = props.icon
|
|
15
15
|
? typeof props.icon === 'string'
|
|
16
16
|
? { sf: props.icon }
|
|
17
17
|
: { src: props.icon }
|
|
18
18
|
: undefined;
|
|
19
|
-
const iconComponentProps = (0, children_1.getFirstChildOfType)(children, common_primitives_1.
|
|
20
|
-
const badgeComponent = (0, children_1.getFirstChildOfType)(children, common_primitives_1.
|
|
19
|
+
const iconComponentProps = (0, children_1.getFirstChildOfType)(children, common_primitives_1.StackToolbarIcon)?.props ?? iconPropConvertedToIcon;
|
|
20
|
+
const badgeComponent = (0, children_1.getFirstChildOfType)(children, common_primitives_1.StackToolbarBadge);
|
|
21
21
|
const rnsIcon = (() => {
|
|
22
22
|
if (!iconComponentProps) {
|
|
23
23
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/layouts/stack-utils/shared.ts"],"names":[],"mappings":";;AA2CA,8GAqDC;AA/FD,iCAAiD;AAIjD,
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/layouts/stack-utils/shared.ts"],"names":[],"mappings":";;AA2CA,8GAqDC;AA/FD,iCAAiD;AAIjD,2DAA6F;AAC7F,mDAA2D;AAC3D,2CAAsF;AAoCtF,SAAgB,iDAAiD,CAC/D,KAAiC;IAEjC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACrE,MAAM,cAAc,GAAG,gBAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC9C,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;SAC5C,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,MAAM,KAAK,GAAG,IAAA,8BAAmB,EAAC,QAAQ,EAAE,qCAAiB,CAAC,CAAC;IAC/D,MAAM,uBAAuB,GAAG,KAAK,CAAC,IAAI;QACxC,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAC9B,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE;YACpB,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE;QACvB,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,kBAAkB,GACtB,IAAA,8BAAmB,EAAC,QAAQ,EAAE,oCAAgB,CAAC,EAAE,KAAK,IAAI,uBAAuB,CAAC;IACpF,MAAM,cAAc,GAAG,IAAA,8BAAmB,EAAC,QAAQ,EAAE,qCAAiB,CAAC,CAAC;IACxE,MAAM,OAAO,GAAwC,CAAC,GAAG,EAAE;QACzD,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,KAAK,IAAI,kBAAkB,EAAE,CAAC;YAChC,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,kBAAkB,CAAC,GAAG;aAC/B,CAAC;QACJ,CAAC;QACD,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,kBAAkB,CAAC,EAAE;SAC5B,CAAC;IACJ,CAAC,CAAC,EAAE,CAAC;IACL,MAAM,IAAI,GAAuB;QAC/B,GAAG,IAAI;QACP,KAAK,EAAE,KAAK,EAAE,KAAK,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 { StackToolbarBadge, StackToolbarIcon, StackToolbarLabel } 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, StackToolbarLabel);\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, StackToolbarIcon)?.props ?? iconPropConvertedToIcon;\n const badgeComponent = getFirstChildOfType(children, StackToolbarBadge);\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackToolbar.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbar.tsx"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAiBhD,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StackToolbar = void 0;
|
|
7
|
+
const StackToolbarButton_1 = require("./StackToolbarButton");
|
|
8
|
+
const StackToolbarClient_1 = __importDefault(require("./StackToolbarClient"));
|
|
9
|
+
exports.StackToolbar = StackToolbarClient_1.default;
|
|
10
|
+
const StackToolbarMenu_1 = require("./StackToolbarMenu");
|
|
11
|
+
const StackToolbarSearchBarSlot_1 = require("./StackToolbarSearchBarSlot");
|
|
12
|
+
const StackToolbarSpacer_1 = require("./StackToolbarSpacer");
|
|
13
|
+
const StackToolbarView_1 = require("./StackToolbarView");
|
|
14
|
+
const common_primitives_1 = require("../common-primitives");
|
|
15
|
+
StackToolbarClient_1.default.Button = StackToolbarButton_1.StackToolbarButton;
|
|
16
|
+
StackToolbarClient_1.default.Menu = StackToolbarMenu_1.StackToolbarMenu;
|
|
17
|
+
StackToolbarClient_1.default.MenuAction = StackToolbarMenu_1.StackToolbarMenuAction;
|
|
18
|
+
StackToolbarClient_1.default.SearchBarSlot = StackToolbarSearchBarSlot_1.StackToolbarSearchBarSlot;
|
|
19
|
+
StackToolbarClient_1.default.Spacer = StackToolbarSpacer_1.StackToolbarSpacer;
|
|
20
|
+
StackToolbarClient_1.default.View = StackToolbarView_1.StackToolbarView;
|
|
21
|
+
StackToolbarClient_1.default.Label = common_primitives_1.StackToolbarLabel;
|
|
22
|
+
StackToolbarClient_1.default.Icon = common_primitives_1.StackToolbarIcon;
|
|
23
|
+
StackToolbarClient_1.default.Badge = common_primitives_1.StackToolbarBadge;
|
|
24
|
+
//# sourceMappingURL=StackToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackToolbar.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbar.tsx"],"names":[],"mappings":";;;;;;AAAA,6DAA0D;AAC1D,8EAAgD;AAiBvC,uBAjBF,4BAAY,CAiBE;AAhBrB,yDAA8E;AAC9E,2EAAwE;AACxE,6DAA0D;AAC1D,yDAAsD;AACtD,4DAA8F;AAE9F,4BAAY,CAAC,MAAM,GAAG,uCAAkB,CAAC;AACzC,4BAAY,CAAC,IAAI,GAAG,mCAAgB,CAAC;AACrC,4BAAY,CAAC,UAAU,GAAG,yCAAsB,CAAC;AACjD,4BAAY,CAAC,aAAa,GAAG,qDAAyB,CAAC;AACvD,4BAAY,CAAC,MAAM,GAAG,uCAAkB,CAAC;AACzC,4BAAY,CAAC,IAAI,GAAG,mCAAgB,CAAC;AACrC,4BAAY,CAAC,KAAK,GAAG,qCAAiB,CAAC;AACvC,4BAAY,CAAC,IAAI,GAAG,oCAAgB,CAAC;AACrC,4BAAY,CAAC,KAAK,GAAG,qCAAiB,CAAC","sourcesContent":["import { StackToolbarButton } from './StackToolbarButton';\nimport StackToolbar from './StackToolbarClient';\nimport { StackToolbarMenu, StackToolbarMenuAction } from './StackToolbarMenu';\nimport { StackToolbarSearchBarSlot } from './StackToolbarSearchBarSlot';\nimport { StackToolbarSpacer } from './StackToolbarSpacer';\nimport { StackToolbarView } from './StackToolbarView';\nimport { StackToolbarBadge, StackToolbarIcon, StackToolbarLabel } from '../common-primitives';\n\nStackToolbar.Button = StackToolbarButton;\nStackToolbar.Menu = StackToolbarMenu;\nStackToolbar.MenuAction = StackToolbarMenuAction;\nStackToolbar.SearchBarSlot = StackToolbarSearchBarSlot;\nStackToolbar.Spacer = StackToolbarSpacer;\nStackToolbar.View = StackToolbarView;\nStackToolbar.Label = StackToolbarLabel;\nStackToolbar.Icon = StackToolbarIcon;\nStackToolbar.Badge = StackToolbarBadge;\n\nexport { StackToolbar };\n"]}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { NativeStackHeaderItemButton } from '@react-navigation/native-stack';
|
|
2
|
+
import type { ImageRef } from 'expo-image';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import type { StyleProp, TextStyle } from 'react-native';
|
|
5
|
+
import { type StackHeaderItemSharedProps } from '../shared';
|
|
6
|
+
export interface StackToolbarButtonProps {
|
|
7
|
+
accessibilityLabel?: string;
|
|
8
|
+
accessibilityHint?: string;
|
|
9
|
+
/**
|
|
10
|
+
* There are two ways to specify the content of the button:
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { Stack } from 'expo-router';
|
|
15
|
+
*
|
|
16
|
+
* export default function Page() {
|
|
17
|
+
* return (
|
|
18
|
+
* <>
|
|
19
|
+
* <Stack.Toolbar placement="left">
|
|
20
|
+
* <Stack.Toolbar.Button icon="star.fill">As text passed as children</Stack.Toolbar.Button>
|
|
21
|
+
* </Stack.Toolbar>
|
|
22
|
+
* <ScreenContent />
|
|
23
|
+
* </>
|
|
24
|
+
* );
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* import { Stack } from 'expo-router';
|
|
31
|
+
*
|
|
32
|
+
* export default function Page() {
|
|
33
|
+
* return (
|
|
34
|
+
* <>
|
|
35
|
+
* <Stack.Toolbar placement="left">
|
|
36
|
+
* <Stack.Toolbar.Button>
|
|
37
|
+
* <Stack.Toolbar.Icon sf="star.fill" />
|
|
38
|
+
* <Stack.Toolbar.Label>As components</Stack.Toolbar.Label>
|
|
39
|
+
* <Stack.Toolbar.Badge>3</Stack.Toolbar.Badge>
|
|
40
|
+
* </Stack.Toolbar.Button>
|
|
41
|
+
* </Stack.Toolbar>
|
|
42
|
+
* <ScreenContent />
|
|
43
|
+
* </>
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* > **Note**: When icon is used, the label will not be shown and will be used for accessibility purposes only. Badge is only supported in left/right placements, not in bottom (iOS toolbar limitation).
|
|
49
|
+
*/
|
|
50
|
+
children?: ReactNode;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the button should be hidden.
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
hidden?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to hide the shared background.
|
|
60
|
+
*
|
|
61
|
+
* @platform iOS 26+
|
|
62
|
+
*/
|
|
63
|
+
hidesSharedBackground?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Icon to display in the button.
|
|
66
|
+
*
|
|
67
|
+
* Can be a string representing an SFSymbol or an image source.
|
|
68
|
+
*/
|
|
69
|
+
icon?: StackHeaderItemSharedProps['icon'];
|
|
70
|
+
/**
|
|
71
|
+
* Image to display in the button.
|
|
72
|
+
*
|
|
73
|
+
* > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.
|
|
74
|
+
*/
|
|
75
|
+
image?: ImageRef;
|
|
76
|
+
onPress?: () => void;
|
|
77
|
+
/**
|
|
78
|
+
* Whether to separate the background of this item from other header items.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
separateBackground?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Whether the button is in a selected state
|
|
85
|
+
*
|
|
86
|
+
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected) for more information
|
|
87
|
+
*/
|
|
88
|
+
selected?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Style for the label of the header item.
|
|
91
|
+
*/
|
|
92
|
+
style?: StyleProp<TextStyle>;
|
|
93
|
+
/**
|
|
94
|
+
* The tint color to apply to the button item
|
|
95
|
+
*
|
|
96
|
+
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor) for more information.
|
|
97
|
+
*/
|
|
98
|
+
tintColor?: StackHeaderItemSharedProps['tintColor'];
|
|
99
|
+
/**
|
|
100
|
+
* @default 'plain'
|
|
101
|
+
*/
|
|
102
|
+
variant?: StackHeaderItemSharedProps['variant'];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A button used inside `Stack.Toolbar`.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* import { Stack } from 'expo-router';
|
|
110
|
+
*
|
|
111
|
+
* export default function Layout() {
|
|
112
|
+
* return (
|
|
113
|
+
* <Stack>
|
|
114
|
+
* <Stack.Screen name="index">
|
|
115
|
+
* <Stack.Toolbar placement="left">
|
|
116
|
+
* <Stack.Toolbar.Button icon="arrow.left.circle" onPress={() => alert('Left pressed')} />
|
|
117
|
+
* </Stack.Toolbar>
|
|
118
|
+
* </Stack.Screen>
|
|
119
|
+
* </Stack>
|
|
120
|
+
* );
|
|
121
|
+
* }
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* import { Stack } from 'expo-router';
|
|
127
|
+
*
|
|
128
|
+
* export default function Page() {
|
|
129
|
+
* return (
|
|
130
|
+
* <>
|
|
131
|
+
* <Stack.Toolbar placement="left">
|
|
132
|
+
* <Stack.Toolbar.Button icon="arrow.left.circle" onPress={() => alert('Left pressed')} />
|
|
133
|
+
* </Stack.Toolbar>
|
|
134
|
+
* <ScreenContent />
|
|
135
|
+
* </>
|
|
136
|
+
* );
|
|
137
|
+
* }
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @platform ios
|
|
141
|
+
*/
|
|
142
|
+
export declare const StackToolbarButton: React.FC<StackToolbarButtonProps>;
|
|
143
|
+
export declare function convertStackToolbarButtonPropsToRNHeaderItem(props: StackToolbarButtonProps): NativeStackHeaderItemButton | undefined;
|
|
144
|
+
//# sourceMappingURL=StackToolbarButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackToolbarButton.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzD,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,uBAAuB;IACtC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,IAAI,CAAC,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAE1C;;;;OAIG;IACH,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,0BAA0B,CAAC,WAAW,CAAC,CAAC;IACpD;;OAEG;IACH,OAAO,CAAC,EAAE,0BAA0B,CAAC,SAAS,CAAC,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAUhE,CAAC;AAEF,wBAAgB,4CAA4C,CAC1D,KAAK,EAAE,uBAAuB,GAC7B,2BAA2B,GAAG,SAAS,CAWzC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.StackToolbarButton = void 0;
|
|
5
|
+
exports.convertStackToolbarButtonPropsToRNHeaderItem = convertStackToolbarButtonPropsToRNHeaderItem;
|
|
6
|
+
const bottom_toolbar_native_elements_1 = require("./bottom-toolbar-native-elements");
|
|
7
|
+
const context_1 = require("./context");
|
|
8
|
+
const shared_1 = require("../shared");
|
|
9
|
+
/**
|
|
10
|
+
* A button used inside `Stack.Toolbar`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { Stack } from 'expo-router';
|
|
15
|
+
*
|
|
16
|
+
* export default function Layout() {
|
|
17
|
+
* return (
|
|
18
|
+
* <Stack>
|
|
19
|
+
* <Stack.Screen name="index">
|
|
20
|
+
* <Stack.Toolbar placement="left">
|
|
21
|
+
* <Stack.Toolbar.Button icon="arrow.left.circle" onPress={() => alert('Left pressed')} />
|
|
22
|
+
* </Stack.Toolbar>
|
|
23
|
+
* </Stack.Screen>
|
|
24
|
+
* </Stack>
|
|
25
|
+
* );
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* import { Stack } from 'expo-router';
|
|
32
|
+
*
|
|
33
|
+
* export default function Page() {
|
|
34
|
+
* return (
|
|
35
|
+
* <>
|
|
36
|
+
* <Stack.Toolbar placement="left">
|
|
37
|
+
* <Stack.Toolbar.Button icon="arrow.left.circle" onPress={() => alert('Left pressed')} />
|
|
38
|
+
* </Stack.Toolbar>
|
|
39
|
+
* <ScreenContent />
|
|
40
|
+
* </>
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @platform ios
|
|
46
|
+
*/
|
|
47
|
+
const StackToolbarButton = (props) => {
|
|
48
|
+
const placement = (0, context_1.useToolbarPlacement)();
|
|
49
|
+
if (placement === 'bottom') {
|
|
50
|
+
// TODO(@ubax): Handle image loading using useImage in a follow-up PR.
|
|
51
|
+
const icon = typeof props.icon === 'string' ? props.icon : undefined;
|
|
52
|
+
return <bottom_toolbar_native_elements_1.NativeToolbarButton {...props} icon={icon} image={props.image}/>;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
};
|
|
56
|
+
exports.StackToolbarButton = StackToolbarButton;
|
|
57
|
+
function convertStackToolbarButtonPropsToRNHeaderItem(props) {
|
|
58
|
+
if (props.hidden) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
...(0, shared_1.convertStackHeaderSharedPropsToRNSharedHeaderItem)(props),
|
|
63
|
+
type: 'button',
|
|
64
|
+
onPress: props.onPress ?? (() => { }),
|
|
65
|
+
selected: !!props.selected,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=StackToolbarButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackToolbarButton.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarButton.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAmKb,oGAaC;AA1KD,qFAAuE;AACvE,uCAAgD;AAChD,sCAGmB;AAsGnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACI,MAAM,kBAAkB,GAAsC,CAAC,KAAK,EAAE,EAAE;IAC7E,MAAM,SAAS,GAAG,IAAA,6BAAmB,GAAE,CAAC;IAExC,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,sEAAsE;QACtE,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACrE,OAAO,CAAC,oDAAmB,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAG,CAAC;IAC5E,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B;AAEF,SAAgB,4CAA4C,CAC1D,KAA8B;IAE9B,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,GAAG,IAAA,0DAAiD,EAAC,KAAK,CAAC;QAC3D,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;QACpC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport type { NativeStackHeaderItemButton } from '@react-navigation/native-stack';\nimport type { ImageRef } from 'expo-image';\nimport type { ReactNode } from 'react';\nimport type { StyleProp, TextStyle } from 'react-native';\n\nimport { NativeToolbarButton } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\nimport {\n convertStackHeaderSharedPropsToRNSharedHeaderItem,\n type StackHeaderItemSharedProps,\n} from '../shared';\n\nexport interface StackToolbarButtonProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /**\n * There are two ways to specify the content of the button:\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"star.fill\">As text passed as children</Stack.Toolbar.Button>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button>\n * <Stack.Toolbar.Icon sf=\"star.fill\" />\n * <Stack.Toolbar.Label>As components</Stack.Toolbar.Label>\n * <Stack.Toolbar.Badge>3</Stack.Toolbar.Badge>\n * </Stack.Toolbar.Button>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * > **Note**: When icon is used, the label will not be shown and will be used for accessibility purposes only. Badge is only supported in left/right placements, not in bottom (iOS toolbar limitation).\n */\n children?: ReactNode;\n disabled?: boolean;\n /**\n * Whether the button should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether to hide the shared background.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n /**\n * Icon to display in the button.\n *\n * Can be a string representing an SFSymbol or an image source.\n */\n icon?: StackHeaderItemSharedProps['icon'];\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display in the button.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n */\n image?: ImageRef;\n onPress?: () => void;\n /**\n * Whether to separate the background of this item from other header items.\n *\n * @default false\n */\n separateBackground?: boolean;\n /**\n * Whether the button is in a selected state\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected) for more information\n */\n selected?: boolean;\n /**\n * Style for the label of the header item.\n */\n style?: StyleProp<TextStyle>;\n /**\n * The tint color to apply to the button item\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor) for more information.\n */\n tintColor?: StackHeaderItemSharedProps['tintColor'];\n /**\n * @default 'plain'\n */\n variant?: StackHeaderItemSharedProps['variant'];\n}\n\n/**\n * A button used inside `Stack.Toolbar`.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Layout() {\n * return (\n * <Stack>\n * <Stack.Screen name=\"index\">\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"arrow.left.circle\" onPress={() => alert('Left pressed')} />\n * </Stack.Toolbar>\n * </Stack.Screen>\n * </Stack>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"arrow.left.circle\" onPress={() => alert('Left pressed')} />\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const StackToolbarButton: React.FC<StackToolbarButtonProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n const icon = typeof props.icon === 'string' ? props.icon : undefined;\n return <NativeToolbarButton {...props} icon={icon} image={props.image} />;\n }\n\n return null;\n};\n\nexport function convertStackToolbarButtonPropsToRNHeaderItem(\n props: StackToolbarButtonProps\n): NativeStackHeaderItemButton | undefined {\n if (props.hidden) {\n return undefined;\n }\n\n return {\n ...convertStackHeaderSharedPropsToRNSharedHeaderItem(props),\n type: 'button',\n onPress: props.onPress ?? (() => {}),\n selected: !!props.selected,\n };\n}\n"]}
|