expo-router 7.0.0-canary-20260114-d8e19f5 → 7.0.0-canary-20260120-bb71700
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-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +7 -2
- package/build/global-state/routing.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/loaders/utils.d.ts +5 -2
- package/build/loaders/utils.d.ts.map +1 -1
- package/build/loaders/utils.js +8 -5
- package/build/loaders/utils.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 +6 -9
- package/build/native-tabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/appearance.d.ts +7 -7
- package/build/native-tabs/appearance.d.ts.map +1 -1
- package/build/native-tabs/appearance.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 +9 -3
- 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 +2 -2
- package/build/native-tabs/utils/bottomAccessory.d.ts.map +1 -1
- package/build/native-tabs/utils/bottomAccessory.js.map +1 -1
- package/build/native-tabs/utils/icon.d.ts +4 -2
- 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/split-view/elements.js +3 -3
- package/build/split-view/elements.js.map +1 -1
- package/build/split-view/index.d.ts +1 -1
- package/build/split-view/index.d.ts.map +1 -1
- package/build/split-view/index.js.map +1 -1
- package/build/split-view/split-view.d.ts +3 -3
- package/build/split-view/split-view.d.ts.map +1 -1
- package/build/split-view/split-view.js +4 -4
- package/build/split-view/split-view.js.map +1 -1
- 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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700-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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700-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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700-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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700-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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700-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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.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-20260120-bb71700/expo.modules.router-7.0.0-canary-20260120-bb71700.aar.sha512} +0 -0
|
@@ -1,38 +1,23 @@
|
|
|
1
1
|
import type { NativeStackHeaderItemMenu, NativeStackHeaderItemMenuAction } from '@react-navigation/native-stack';
|
|
2
|
+
import type { ImageRef } from 'expo-image';
|
|
2
3
|
import { type ReactNode } from 'react';
|
|
3
4
|
import type { ImageSourcePropType } from 'react-native';
|
|
4
5
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
5
|
-
import { type StackHeaderItemSharedProps } from '
|
|
6
|
-
export interface
|
|
6
|
+
import { type StackHeaderItemSharedProps } from '../shared';
|
|
7
|
+
export interface StackToolbarMenuProps {
|
|
7
8
|
accessibilityLabel?: string;
|
|
8
9
|
accessibilityHint?: string;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* Menu content - can include icons, labels, badges and menu actions.
|
|
11
12
|
*
|
|
12
13
|
* @example
|
|
13
14
|
* ```tsx
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* </Stack.Header.Menu>
|
|
15
|
+
* <Stack.Toolbar.Menu>
|
|
16
|
+
* <Stack.Toolbar.Icon sfSymbol="ellipsis.circle" />
|
|
17
|
+
* <Stack.Toolbar.Label>Options</Stack.Toolbar.Label>
|
|
18
|
+
* <Stack.Toolbar.MenuAction onPress={() => {}}>Action 1</Stack.Toolbar.MenuAction>
|
|
19
|
+
* </Stack.Toolbar.Menu>
|
|
20
20
|
* ```
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* import { Stack } from 'expo-router';
|
|
25
|
-
*
|
|
26
|
-
* ...
|
|
27
|
-
* <Stack.Header.Menu>
|
|
28
|
-
* <Stack.Header.Icon sf="star.fill" />
|
|
29
|
-
* <Stack.Header.Label>As components</Stack.Header.Label>
|
|
30
|
-
* <Stack.Header.Badge>3</Stack.Header.Badge>
|
|
31
|
-
* <Stack.Header.MenuAction>Action 1</Stack.Header.MenuAction>
|
|
32
|
-
* </Stack.Header.Menu>
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* **Note**: When icon is used, the label will not be shown and will be used for accessibility purposes only.
|
|
36
21
|
*/
|
|
37
22
|
children?: ReactNode;
|
|
38
23
|
/**
|
|
@@ -42,6 +27,12 @@ export interface StackHeaderMenuProps {
|
|
|
42
27
|
*/
|
|
43
28
|
destructive?: boolean;
|
|
44
29
|
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Image to display for the menu item.
|
|
32
|
+
*
|
|
33
|
+
* > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.
|
|
34
|
+
*/
|
|
35
|
+
image?: ImageRef;
|
|
45
36
|
/**
|
|
46
37
|
* Whether to hide the shared background.
|
|
47
38
|
*
|
|
@@ -66,7 +57,7 @@ export interface StackHeaderMenuProps {
|
|
|
66
57
|
* If `true`, the menu will be displayed inline.
|
|
67
58
|
* This means that the menu will not be collapsed
|
|
68
59
|
*
|
|
69
|
-
* > **Note
|
|
60
|
+
* > **Note**: Inline menus are only supported in submenus.
|
|
70
61
|
*
|
|
71
62
|
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.
|
|
72
63
|
*/
|
|
@@ -104,12 +95,20 @@ export interface StackHeaderMenuProps {
|
|
|
104
95
|
* @default 'plain'
|
|
105
96
|
*/
|
|
106
97
|
variant?: StackHeaderItemSharedProps['variant'];
|
|
98
|
+
/**
|
|
99
|
+
* The preferred size of the menu elements.
|
|
100
|
+
*
|
|
101
|
+
* > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.
|
|
102
|
+
*
|
|
103
|
+
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/preferredelementsize) for more information.
|
|
104
|
+
*
|
|
105
|
+
* @platform iOS 16.0+
|
|
106
|
+
*/
|
|
107
|
+
elementSize?: 'auto' | 'small' | 'medium' | 'large';
|
|
107
108
|
}
|
|
108
109
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* Use as `Stack.Header.Menu` to provide top-level menus on iOS header bars.
|
|
112
|
-
* It accepts `Stack.Header.MenuAction` and nested `Stack.Header.Menu`
|
|
110
|
+
* Use as `Stack.Toolbar.Menu` to provide menus in iOS toolbar.
|
|
111
|
+
* It accepts `Stack.Toolbar.MenuAction` and nested `Stack.Toolbar.Menu`
|
|
113
112
|
* elements. Menu can be configured using both component props and child
|
|
114
113
|
* elements.
|
|
115
114
|
*
|
|
@@ -118,58 +117,17 @@ export interface StackHeaderMenuProps {
|
|
|
118
117
|
* import { Stack } from 'expo-router';
|
|
119
118
|
* import { Alert } from 'react-native';
|
|
120
119
|
*
|
|
121
|
-
* export default function
|
|
120
|
+
* export default function Page() {
|
|
122
121
|
* return (
|
|
123
122
|
* <>
|
|
123
|
+
* <Stack.Toolbar placement="right">
|
|
124
|
+
* <Stack.Toolbar.Menu icon="ellipsis.circle">
|
|
125
|
+
* <Stack.Toolbar.MenuAction onPress={() => Alert.alert('Action pressed!')}>
|
|
126
|
+
* Action 1
|
|
127
|
+
* </Stack.Toolbar.MenuAction>
|
|
128
|
+
* </Stack.Toolbar.Menu>
|
|
129
|
+
* </Stack.Toolbar>
|
|
124
130
|
* <ScreenContent />
|
|
125
|
-
* <Stack.Screen>
|
|
126
|
-
* <Stack.Header>
|
|
127
|
-
* <Stack.Header.Right>
|
|
128
|
-
* <Stack.Header.Menu>
|
|
129
|
-
* <Stack.Header.Label>Menu</Stack.Header.Label>
|
|
130
|
-
* <Stack.Header.Icon sf="ellipsis.circle" />
|
|
131
|
-
* <Stack.Header.MenuAction onPress={() => Alert.alert('Action 1 pressed!')}>
|
|
132
|
-
* Action 1
|
|
133
|
-
* </Stack.Header.MenuAction>
|
|
134
|
-
* <Stack.Header.MenuAction isOn icon="star.fill">
|
|
135
|
-
* Action 2
|
|
136
|
-
* </Stack.Header.MenuAction>
|
|
137
|
-
* <Stack.Header.Menu inline>
|
|
138
|
-
* <Stack.Header.MenuAction isOn>Sub Action</Stack.Header.MenuAction>
|
|
139
|
-
* </Stack.Header.Menu>
|
|
140
|
-
* </Stack.Header.Menu>
|
|
141
|
-
* </Stack.Header.Right>
|
|
142
|
-
* </Stack.Header>
|
|
143
|
-
* </Stack.Screen>
|
|
144
|
-
* </>
|
|
145
|
-
* );
|
|
146
|
-
* }
|
|
147
|
-
* ```
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```tsx
|
|
151
|
-
* import { Stack } from 'expo-router';
|
|
152
|
-
* import { Text } from 'react-native';
|
|
153
|
-
*
|
|
154
|
-
* export default function Screen() {
|
|
155
|
-
* return (
|
|
156
|
-
* <>
|
|
157
|
-
* <ScreenContent />
|
|
158
|
-
* <Stack.Screen>
|
|
159
|
-
* <Stack.Header>
|
|
160
|
-
* <Stack.Header.Left>
|
|
161
|
-
* <Stack.Header.Menu>
|
|
162
|
-
* <Stack.Header.MenuAction onPress={() => Alert.alert('Action 1 pressed!')}>
|
|
163
|
-
* Action 1
|
|
164
|
-
* </Stack.Header.MenuAction>
|
|
165
|
-
* <Stack.Header.Menu inline palette title="Icons">
|
|
166
|
-
* <Stack.Header.MenuAction isOn icon="star.fill" />
|
|
167
|
-
* <Stack.Header.MenuAction icon="heart.fill" />
|
|
168
|
-
* </Stack.Header.Menu>
|
|
169
|
-
* </Stack.Header.Menu>
|
|
170
|
-
* </Stack.Header.Left>
|
|
171
|
-
* </Stack.Header>
|
|
172
|
-
* </Stack.Screen>
|
|
173
131
|
* </>
|
|
174
132
|
* );
|
|
175
133
|
* }
|
|
@@ -179,9 +137,9 @@ export interface StackHeaderMenuProps {
|
|
|
179
137
|
*
|
|
180
138
|
* @platform ios
|
|
181
139
|
*/
|
|
182
|
-
export declare const
|
|
183
|
-
export declare function
|
|
184
|
-
export interface
|
|
140
|
+
export declare const StackToolbarMenu: React.FC<StackToolbarMenuProps>;
|
|
141
|
+
export declare function convertStackToolbarMenuPropsToRNHeaderItem(props: StackToolbarMenuProps): NativeStackHeaderItemMenu | undefined;
|
|
142
|
+
export interface StackToolbarMenuActionProps {
|
|
185
143
|
/**
|
|
186
144
|
* Can be an Icon, Label or string title.
|
|
187
145
|
*/
|
|
@@ -193,6 +151,12 @@ export interface StackHeaderMenuActionProps {
|
|
|
193
151
|
*/
|
|
194
152
|
disabled?: boolean;
|
|
195
153
|
icon?: SFSymbol | ImageSourcePropType;
|
|
154
|
+
/**
|
|
155
|
+
* Image to display for the menu action.
|
|
156
|
+
*
|
|
157
|
+
* > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.
|
|
158
|
+
*/
|
|
159
|
+
image?: ImageRef;
|
|
196
160
|
/**
|
|
197
161
|
* If `true`, the menu item will be displayed as destructive.
|
|
198
162
|
*
|
|
@@ -226,42 +190,30 @@ export interface StackHeaderMenuActionProps {
|
|
|
226
190
|
hidden?: boolean;
|
|
227
191
|
}
|
|
228
192
|
/**
|
|
229
|
-
* An action item for a `Stack.
|
|
193
|
+
* An action item for a `Stack.Toolbar.Menu`.
|
|
230
194
|
*
|
|
231
195
|
* @example
|
|
232
196
|
* ```tsx
|
|
233
|
-
* import
|
|
234
|
-
* import { Alert } from 'react-native';
|
|
235
|
-
* import { Stack, Label, Icon } from 'expo-router';
|
|
197
|
+
* import { Stack } from 'expo-router';
|
|
236
198
|
*
|
|
237
|
-
* export default function
|
|
199
|
+
* export default function Page() {
|
|
238
200
|
* return (
|
|
239
201
|
* <>
|
|
202
|
+
* <Stack.Toolbar placement="right">
|
|
203
|
+
* <Stack.Toolbar.Menu icon="ellipsis.circle">
|
|
204
|
+
* <Stack.Toolbar.MenuAction onPress={() => alert('Action pressed!')}>
|
|
205
|
+
* Action 1
|
|
206
|
+
* </Stack.Toolbar.MenuAction>
|
|
207
|
+
* </Stack.Toolbar.Menu>
|
|
208
|
+
* </Stack.Toolbar>
|
|
240
209
|
* <ScreenContent />
|
|
241
|
-
* <Stack.Screen>
|
|
242
|
-
* <Stack.Header>
|
|
243
|
-
* <Stack.Header.Right>
|
|
244
|
-
* <Stack.Header.Menu icon="ellipsis.circle">
|
|
245
|
-
* <Stack.Header.MenuAction onPress={() => Alert.alert('Action 1 pressed!')}>
|
|
246
|
-
* Action 1
|
|
247
|
-
* </Stack.Header.MenuAction>
|
|
248
|
-
* <Stack.Header.MenuAction isOn onPress={() => Alert.alert('Action 2 pressed!')}>
|
|
249
|
-
* <Label>Action 2</Label>
|
|
250
|
-
* <Icon sf="star.fill" />
|
|
251
|
-
* </Stack.Header.MenuAction>
|
|
252
|
-
* </Stack.Header.Menu>
|
|
253
|
-
* </Stack.Header.Right>
|
|
254
|
-
* </Stack.Header>
|
|
255
|
-
* </Stack.Screen>
|
|
256
210
|
* </>
|
|
257
211
|
* );
|
|
258
212
|
* }
|
|
259
213
|
* ```
|
|
260
214
|
*
|
|
261
|
-
* @see [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/menus) for more information about menus on iOS.
|
|
262
|
-
*
|
|
263
215
|
* @platform ios
|
|
264
216
|
*/
|
|
265
|
-
export declare const
|
|
266
|
-
export declare function
|
|
267
|
-
//# sourceMappingURL=
|
|
217
|
+
export declare const StackToolbarMenuAction: React.FC<StackToolbarMenuActionProps>;
|
|
218
|
+
export declare function convertStackToolbarMenuActionPropsToRNHeaderItem(props: StackToolbarMenuActionProps): NativeStackHeaderItemMenuAction;
|
|
219
|
+
//# sourceMappingURL=StackToolbarMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackToolbarMenu.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,yBAAyB,EACzB,+BAA+B,EAEhC,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,qBAAqB;IACpC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,WAAW,C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AC,EAAE,QAAQ,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAUxE,CAAC;AAEF,wBAAgB,gDAAgD,CAC9D,KAAK,EAAE,2BAA2B,GACjC,+BAA+B,CAyBjC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.StackToolbarMenuAction = exports.StackToolbarMenu = void 0;
|
|
5
|
+
exports.convertStackToolbarMenuPropsToRNHeaderItem = convertStackToolbarMenuPropsToRNHeaderItem;
|
|
6
|
+
exports.convertStackToolbarMenuActionPropsToRNHeaderItem = convertStackToolbarMenuActionPropsToRNHeaderItem;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const bottom_toolbar_native_elements_1 = require("./bottom-toolbar-native-elements");
|
|
9
|
+
const context_1 = require("./context");
|
|
10
|
+
const primitives_1 = require("../../../primitives");
|
|
11
|
+
const children_1 = require("../../../utils/children");
|
|
12
|
+
const shared_1 = require("../shared");
|
|
13
|
+
/**
|
|
14
|
+
* Use as `Stack.Toolbar.Menu` to provide menus in iOS toolbar.
|
|
15
|
+
* It accepts `Stack.Toolbar.MenuAction` and nested `Stack.Toolbar.Menu`
|
|
16
|
+
* elements. Menu can be configured using both component props and child
|
|
17
|
+
* elements.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import { Stack } from 'expo-router';
|
|
22
|
+
* import { Alert } from 'react-native';
|
|
23
|
+
*
|
|
24
|
+
* export default function Page() {
|
|
25
|
+
* return (
|
|
26
|
+
* <>
|
|
27
|
+
* <Stack.Toolbar placement="right">
|
|
28
|
+
* <Stack.Toolbar.Menu icon="ellipsis.circle">
|
|
29
|
+
* <Stack.Toolbar.MenuAction onPress={() => Alert.alert('Action pressed!')}>
|
|
30
|
+
* Action 1
|
|
31
|
+
* </Stack.Toolbar.MenuAction>
|
|
32
|
+
* </Stack.Toolbar.Menu>
|
|
33
|
+
* </Stack.Toolbar>
|
|
34
|
+
* <ScreenContent />
|
|
35
|
+
* </>
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @see [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/menus) for more information about menus on iOS.
|
|
41
|
+
*
|
|
42
|
+
* @platform ios
|
|
43
|
+
*/
|
|
44
|
+
const StackToolbarMenu = ({ children, ...props }) => {
|
|
45
|
+
const placement = (0, context_1.useToolbarPlacement)();
|
|
46
|
+
const allowedChildren = (0, react_1.useMemo)(() => placement === 'bottom'
|
|
47
|
+
? [exports.StackToolbarMenu, exports.StackToolbarMenuAction, bottom_toolbar_native_elements_1.NativeToolbarMenu, bottom_toolbar_native_elements_1.NativeToolbarMenuAction]
|
|
48
|
+
: [exports.StackToolbarMenu, exports.StackToolbarMenuAction], [placement]);
|
|
49
|
+
const validChildren = (0, react_1.useMemo)(() => (0, children_1.filterAllowedChildrenElements)(children, allowedChildren), [children, allowedChildren]);
|
|
50
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
51
|
+
const allChildren = react_1.Children.toArray(children);
|
|
52
|
+
if (allChildren.length !== validChildren.length) {
|
|
53
|
+
throw new Error(`Stack.Toolbar.Menu only accepts Stack.Toolbar.Menu and Stack.Toolbar.MenuAction as its children.`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (placement === 'bottom') {
|
|
57
|
+
// TODO(@ubax): Handle image loading using useImage in a follow-up PR.
|
|
58
|
+
return <bottom_toolbar_native_elements_1.NativeToolbarMenu {...props} image={props.image} children={validChildren}/>;
|
|
59
|
+
}
|
|
60
|
+
return <primitives_1.Menu {...props} children={validChildren}/>;
|
|
61
|
+
};
|
|
62
|
+
exports.StackToolbarMenu = StackToolbarMenu;
|
|
63
|
+
function convertStackToolbarMenuPropsToRNHeaderItem(props) {
|
|
64
|
+
if (props.hidden) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const { title, ...rest } = props;
|
|
68
|
+
const actions = react_1.Children.toArray(props.children).filter((child) => (0, children_1.isChildOfType)(child, exports.StackToolbarMenuAction) || (0, children_1.isChildOfType)(child, exports.StackToolbarMenu));
|
|
69
|
+
const item = {
|
|
70
|
+
...(0, shared_1.convertStackHeaderSharedPropsToRNSharedHeaderItem)(rest),
|
|
71
|
+
type: 'menu',
|
|
72
|
+
menu: {
|
|
73
|
+
items: actions
|
|
74
|
+
.map((action) => {
|
|
75
|
+
if ((0, children_1.isChildOfType)(action, exports.StackToolbarMenu)) {
|
|
76
|
+
return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);
|
|
77
|
+
}
|
|
78
|
+
return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);
|
|
79
|
+
})
|
|
80
|
+
.filter((i) => !!i),
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
if (title) {
|
|
84
|
+
item.menu.title = title;
|
|
85
|
+
}
|
|
86
|
+
return item;
|
|
87
|
+
}
|
|
88
|
+
function convertStackToolbarSubmenuMenuPropsToRNHeaderItem(props) {
|
|
89
|
+
if (props.hidden) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const sharedProps = (0, shared_1.convertStackHeaderSharedPropsToRNSharedHeaderItem)(props);
|
|
93
|
+
const actions = react_1.Children.toArray(props.children).filter((child) => (0, children_1.isChildOfType)(child, exports.StackToolbarMenuAction) || (0, children_1.isChildOfType)(child, exports.StackToolbarMenu));
|
|
94
|
+
// TODO: Remove Pick<HeaderBarButtonItemSubmenu> when this PR is merged and released in react-navigation:
|
|
95
|
+
// https://github.com/react-navigation/react-navigation/pull/12895
|
|
96
|
+
const item = {
|
|
97
|
+
type: 'submenu',
|
|
98
|
+
items: actions
|
|
99
|
+
.map((action) => {
|
|
100
|
+
if ((0, children_1.isChildOfType)(action, exports.StackToolbarMenu)) {
|
|
101
|
+
return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);
|
|
102
|
+
}
|
|
103
|
+
return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);
|
|
104
|
+
})
|
|
105
|
+
.filter((i) => !!i),
|
|
106
|
+
label: sharedProps.label || props.title || '',
|
|
107
|
+
};
|
|
108
|
+
if (props.inline !== undefined) {
|
|
109
|
+
item.displayInline = props.inline;
|
|
110
|
+
}
|
|
111
|
+
if (props.palette !== undefined) {
|
|
112
|
+
item.displayAsPalette = props.palette;
|
|
113
|
+
}
|
|
114
|
+
if (props.destructive !== undefined) {
|
|
115
|
+
item.destructive = props.destructive;
|
|
116
|
+
}
|
|
117
|
+
// TODO: Add elementSize to react-native-screens
|
|
118
|
+
if (sharedProps.icon) {
|
|
119
|
+
// Only SF Symbols are supported in submenu icons
|
|
120
|
+
// TODO(@ubax): Add support for other images in react-native-screens
|
|
121
|
+
if (sharedProps.icon.type === 'sfSymbol') {
|
|
122
|
+
item.icon = sharedProps.icon;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
console.warn('When Icon is used inside Stack.Toolbar.Menu used as a submenu, only sfSymbol icons are supported. This is a limitation of React Native Screens.');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return item;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* An action item for a `Stack.Toolbar.Menu`.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```tsx
|
|
135
|
+
* import { Stack } from 'expo-router';
|
|
136
|
+
*
|
|
137
|
+
* export default function Page() {
|
|
138
|
+
* return (
|
|
139
|
+
* <>
|
|
140
|
+
* <Stack.Toolbar placement="right">
|
|
141
|
+
* <Stack.Toolbar.Menu icon="ellipsis.circle">
|
|
142
|
+
* <Stack.Toolbar.MenuAction onPress={() => alert('Action pressed!')}>
|
|
143
|
+
* Action 1
|
|
144
|
+
* </Stack.Toolbar.MenuAction>
|
|
145
|
+
* </Stack.Toolbar.Menu>
|
|
146
|
+
* </Stack.Toolbar>
|
|
147
|
+
* <ScreenContent />
|
|
148
|
+
* </>
|
|
149
|
+
* );
|
|
150
|
+
* }
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
* @platform ios
|
|
154
|
+
*/
|
|
155
|
+
const StackToolbarMenuAction = (props) => {
|
|
156
|
+
const placement = (0, context_1.useToolbarPlacement)();
|
|
157
|
+
if (placement === 'bottom') {
|
|
158
|
+
// TODO(@ubax): Handle image loading using useImage in a follow-up PR.
|
|
159
|
+
const icon = typeof props.icon === 'string' ? props.icon : undefined;
|
|
160
|
+
return <bottom_toolbar_native_elements_1.NativeToolbarMenuAction {...props} icon={icon} image={props.image}/>;
|
|
161
|
+
}
|
|
162
|
+
return <primitives_1.MenuAction {...props}/>;
|
|
163
|
+
};
|
|
164
|
+
exports.StackToolbarMenuAction = StackToolbarMenuAction;
|
|
165
|
+
function convertStackToolbarMenuActionPropsToRNHeaderItem(props) {
|
|
166
|
+
const { children, isOn, unstable_keepPresented, icon, ...rest } = props;
|
|
167
|
+
const sharedProps = (0, shared_1.convertStackHeaderSharedPropsToRNSharedHeaderItem)(props);
|
|
168
|
+
const item = {
|
|
169
|
+
...rest,
|
|
170
|
+
type: 'action',
|
|
171
|
+
label: sharedProps.label,
|
|
172
|
+
state: isOn ? 'on' : 'off',
|
|
173
|
+
onPress: props.onPress ?? (() => { }),
|
|
174
|
+
};
|
|
175
|
+
if (unstable_keepPresented !== undefined) {
|
|
176
|
+
item.keepsMenuPresented = unstable_keepPresented;
|
|
177
|
+
}
|
|
178
|
+
if (sharedProps.icon) {
|
|
179
|
+
// Only SF Symbols are supported in submenu icons
|
|
180
|
+
// TODO(@ubax): Add support for other images in react-native-screens
|
|
181
|
+
if (sharedProps.icon.type === 'sfSymbol') {
|
|
182
|
+
item.icon = sharedProps.icon;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
console.warn('When Icon is used inside Stack.Toolbar.MenuAction, only sfSymbol icons are supported. This is a limitation of React Native Screens.');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return item;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=StackToolbarMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackToolbarMenu.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarMenu.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA8Lb,gGA8BC;AAiJD,4GA2BC;AAjYD,iCAA0D;AAK1D,qFAA8F;AAC9F,uCAAgD;AAChD,oDAAuD;AACvD,sDAAuF;AACvF,sCAGmB;AA2GnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACI,MAAM,gBAAgB,GAAoC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC1F,MAAM,SAAS,GAAG,IAAA,6BAAmB,GAAE,CAAC;IAExC,MAAM,eAAe,GAAG,IAAA,eAAO,EAC7B,GAAG,EAAE,CACH,SAAS,KAAK,QAAQ;QACpB,CAAC,CAAC,CAAC,wBAAgB,EAAE,8BAAsB,EAAE,kDAAiB,EAAE,wDAAuB,CAAC;QACxF,CAAC,CAAC,CAAC,wBAAgB,EAAE,8BAAsB,CAAC,EAChD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,MAAM,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ent":["'use client';\nimport type {\n NativeStackHeaderItemMenu,\n NativeStackHeaderItemMenuAction,\n NativeStackHeaderItemMenuSubmenu,\n} from '@react-navigation/native-stack';\nimport type { ImageRef } from 'expo-image';\nimport { Children, useMemo, type ReactNode } from 'react';\nimport type { ImageSourcePropType } from 'react-native';\nimport type { HeaderBarButtonItemSubmenu } from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { NativeToolbarMenu, NativeToolbarMenuAction } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\nimport { Menu, MenuAction } from '../../../primitives';\nimport { filterAllowedChildrenElements, isChildOfType } from '../../../utils/children';\nimport {\n convertStackHeaderSharedPropsToRNSharedHeaderItem,\n type StackHeaderItemSharedProps,\n} from '../shared';\n\nexport interface StackToolbarMenuProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /**\n * Menu content - can include icons, labels, badges and menu actions.\n *\n * @example\n * ```tsx\n * <Stack.Toolbar.Menu>\n * <Stack.Toolbar.Icon sfSymbol=\"ellipsis.circle\" />\n * <Stack.Toolbar.Label>Options</Stack.Toolbar.Label>\n * <Stack.Toolbar.MenuAction onPress={() => {}}>Action 1</Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * ```\n */\n children?: ReactNode;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n disabled?: boolean;\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display for the menu item.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n */\n image?: ImageRef;\n /**\n * Whether to hide the shared background.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground) for more information.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n /**\n * Whether the menu should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Icon for the menu item.\n *\n * Can be an SF Symbol name or an image source.\n */\n icon?: StackHeaderItemSharedProps['icon'];\n /**\n * If `true`, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * > **Note**: Inline menus are only supported in submenus.\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 * If `true`, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * > **Note**: Palette menus are only supported in submenus.\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 * Whether to separate the background of this item from other header items.\n *\n * @default false\n */\n separateBackground?: boolean;\n /**\n * Style for the label of the header item.\n */\n style?: StackHeaderItemSharedProps['style'];\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 * Optional title to show on top of the menu.\n */\n title?: string;\n /**\n * @default 'plain'\n */\n variant?: StackHeaderItemSharedProps['variant'];\n // TODO(@ubax): Add elementSize support in react-native-screens for header menus.\n /**\n * The preferred size of the menu elements.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/preferredelementsize) for more information.\n *\n * @platform iOS 16.0+\n */\n elementSize?: 'auto' | 'small' | 'medium' | 'large';\n}\n\n/**\n * Use as `Stack.Toolbar.Menu` to provide menus in iOS toolbar.\n * It accepts `Stack.Toolbar.MenuAction` and nested `Stack.Toolbar.Menu`\n * elements. Menu can be configured using both component props and child\n * elements.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n * import { Alert } from 'react-native';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"right\">\n * <Stack.Toolbar.Menu icon=\"ellipsis.circle\">\n * <Stack.Toolbar.MenuAction onPress={() => Alert.alert('Action pressed!')}>\n * Action 1\n * </Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @see [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/menus) for more information about menus on iOS.\n *\n * @platform ios\n */\nexport const StackToolbarMenu: React.FC<StackToolbarMenuProps> = ({ children, ...props }) => {\n const placement = useToolbarPlacement();\n\n const allowedChildren = useMemo(\n () =>\n placement === 'bottom'\n ? [StackToolbarMenu, StackToolbarMenuAction, NativeToolbarMenu, NativeToolbarMenuAction]\n : [StackToolbarMenu, StackToolbarMenuAction],\n [placement]\n );\n\n const validChildren = useMemo(\n () => filterAllowedChildrenElements(children, allowedChildren),\n [children, allowedChildren]\n );\n\n if (process.env.NODE_ENV !== 'production') {\n const allChildren = Children.toArray(children);\n if (allChildren.length !== validChildren.length) {\n throw new Error(\n `Stack.Toolbar.Menu only accepts Stack.Toolbar.Menu and Stack.Toolbar.MenuAction as its children.`\n );\n }\n }\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n return <NativeToolbarMenu {...props} image={props.image} children={validChildren} />;\n }\n\n return <Menu {...props} children={validChildren} />;\n};\n\nexport function convertStackToolbarMenuPropsToRNHeaderItem(\n props: StackToolbarMenuProps\n): NativeStackHeaderItemMenu | undefined {\n if (props.hidden) {\n return undefined;\n }\n const { title, ...rest } = props;\n const actions = Children.toArray(props.children).filter(\n (child) =>\n isChildOfType(child, StackToolbarMenuAction) || isChildOfType(child, StackToolbarMenu)\n );\n const item: NativeStackHeaderItemMenu = {\n ...convertStackHeaderSharedPropsToRNSharedHeaderItem(rest),\n type: 'menu',\n menu: {\n items: actions\n .map((action) => {\n if (isChildOfType(action, StackToolbarMenu)) {\n return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);\n }\n return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);\n })\n .filter((i) => !!i),\n },\n };\n if (title) {\n item.menu.title = title;\n }\n\n return item;\n}\n\nfunction convertStackToolbarSubmenuMenuPropsToRNHeaderItem(\n props: StackToolbarMenuProps\n): NativeStackHeaderItemMenuSubmenu | undefined {\n if (props.hidden) {\n return undefined;\n }\n const sharedProps = convertStackHeaderSharedPropsToRNSharedHeaderItem(props);\n const actions = Children.toArray(props.children).filter(\n (child) =>\n isChildOfType(child, StackToolbarMenuAction) || isChildOfType(child, StackToolbarMenu)\n );\n\n // TODO: Remove Pick<HeaderBarButtonItemSubmenu> when this PR is merged and released in react-navigation:\n // https://github.com/react-navigation/react-navigation/pull/12895\n const item: NativeStackHeaderItemMenuSubmenu &\n Pick<HeaderBarButtonItemSubmenu, 'displayAsPalette' | 'displayInline' | 'destructive'> = {\n type: 'submenu',\n items: actions\n .map((action) => {\n if (isChildOfType(action, StackToolbarMenu)) {\n return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);\n }\n return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);\n })\n .filter((i) => !!i),\n label: sharedProps.label || props.title || '',\n };\n\n if (props.inline !== undefined) {\n item.displayInline = props.inline;\n }\n if (props.palette !== undefined) {\n item.displayAsPalette = props.palette;\n }\n if (props.destructive !== undefined) {\n item.destructive = props.destructive;\n }\n // TODO: Add elementSize to react-native-screens\n\n if (sharedProps.icon) {\n // Only SF Symbols are supported in submenu icons\n // TODO(@ubax): Add support for other images in react-native-screens\n if (sharedProps.icon.type === 'sfSymbol') {\n item.icon = sharedProps.icon;\n } else {\n console.warn(\n 'When Icon is used inside Stack.Toolbar.Menu used as a submenu, only sfSymbol icons are supported. This is a limitation of React Native Screens.'\n );\n }\n }\n\n return item;\n}\n\nexport interface StackToolbarMenuActionProps {\n /**\n * Can be an Icon, Label or string title.\n */\n children?: ReactNode;\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 icon?: SFSymbol | ImageSourcePropType;\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display for the menu action.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n */\n image?: ImageRef;\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 * An elaborated title that explains the purpose of the action.\n */\n discoverabilityLabel?: string;\n /**\n * An optional subtitle for the menu item.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.\n */\n subtitle?: string;\n hidden?: boolean;\n}\n\n/**\n * An action item for a `Stack.Toolbar.Menu`.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"right\">\n * <Stack.Toolbar.Menu icon=\"ellipsis.circle\">\n * <Stack.Toolbar.MenuAction onPress={() => alert('Action pressed!')}>\n * Action 1\n * </Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const StackToolbarMenuAction: React.FC<StackToolbarMenuActionProps> = (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 <NativeToolbarMenuAction {...props} icon={icon} image={props.image} />;\n }\n\n return <MenuAction {...props} />;\n};\n\nexport function convertStackToolbarMenuActionPropsToRNHeaderItem(\n props: StackToolbarMenuActionProps\n): NativeStackHeaderItemMenuAction {\n const { children, isOn, unstable_keepPresented, icon, ...rest } = props;\n const sharedProps = convertStackHeaderSharedPropsToRNSharedHeaderItem(props);\n const item: NativeStackHeaderItemMenuAction = {\n ...rest,\n type: 'action',\n label: sharedProps.label,\n state: isOn ? 'on' : 'off',\n onPress: props.onPress ?? (() => {}),\n };\n if (unstable_keepPresented !== undefined) {\n item.keepsMenuPresented = unstable_keepPresented;\n }\n if (sharedProps.icon) {\n // Only SF Symbols are supported in submenu icons\n // TODO(@ubax): Add support for other images in react-native-screens\n if (sharedProps.icon.type === 'sfSymbol') {\n item.icon = sharedProps.icon;\n } else {\n console.warn(\n 'When Icon is used inside Stack.Toolbar.MenuAction, only sfSymbol icons are supported. This is a limitation of React Native Screens.'\n );\n }\n }\n return item;\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface StackToolbarSearchBarSlotProps {
|
|
2
|
+
/**
|
|
3
|
+
* Whether the search bar slot should be hidden.
|
|
4
|
+
*
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to hide the shared background.
|
|
10
|
+
*
|
|
11
|
+
* @platform iOS 26+
|
|
12
|
+
*/
|
|
13
|
+
hidesSharedBackground?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether this search bar slot shares background with adjacent items.
|
|
16
|
+
*
|
|
17
|
+
* @platform iOS 26+
|
|
18
|
+
*/
|
|
19
|
+
sharesBackground?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A search bar slot for the bottom toolbar. This reserves space for the search bar
|
|
23
|
+
* in the toolbar and allows positioning it among other toolbar items.
|
|
24
|
+
*
|
|
25
|
+
* This component is only available in bottom placement (`<Stack.Toolbar>` or `<Stack.Toolbar placement="bottom">`).
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import { Stack } from 'expo-router';
|
|
30
|
+
*
|
|
31
|
+
* export default function Page() {
|
|
32
|
+
* return (
|
|
33
|
+
* <>
|
|
34
|
+
* <Stack.Toolbar>
|
|
35
|
+
* <Stack.Toolbar.Button icon="folder" />
|
|
36
|
+
* <Stack.Toolbar.SearchBarSlot />
|
|
37
|
+
* <Stack.Toolbar.Button icon="ellipsis.circle" />
|
|
38
|
+
* </Stack.Toolbar>
|
|
39
|
+
* <ScreenContent />
|
|
40
|
+
* </>
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @platform iOS 26+
|
|
46
|
+
*/
|
|
47
|
+
export declare const StackToolbarSearchBarSlot: React.FC<StackToolbarSearchBarSlotProps>;
|
|
48
|
+
//# sourceMappingURL=StackToolbarSearchBarSlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackToolbarSearchBarSlot.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CAa9E,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.StackToolbarSearchBarSlot = void 0;
|
|
5
|
+
const bottom_toolbar_native_elements_1 = require("./bottom-toolbar-native-elements");
|
|
6
|
+
const context_1 = require("./context");
|
|
7
|
+
/**
|
|
8
|
+
* A search bar slot for the bottom toolbar. This reserves space for the search bar
|
|
9
|
+
* in the toolbar and allows positioning it among other toolbar items.
|
|
10
|
+
*
|
|
11
|
+
* This component is only available in bottom placement (`<Stack.Toolbar>` or `<Stack.Toolbar placement="bottom">`).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { Stack } from 'expo-router';
|
|
16
|
+
*
|
|
17
|
+
* export default function Page() {
|
|
18
|
+
* return (
|
|
19
|
+
* <>
|
|
20
|
+
* <Stack.Toolbar>
|
|
21
|
+
* <Stack.Toolbar.Button icon="folder" />
|
|
22
|
+
* <Stack.Toolbar.SearchBarSlot />
|
|
23
|
+
* <Stack.Toolbar.Button icon="ellipsis.circle" />
|
|
24
|
+
* </Stack.Toolbar>
|
|
25
|
+
* <ScreenContent />
|
|
26
|
+
* </>
|
|
27
|
+
* );
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @platform iOS 26+
|
|
32
|
+
*/
|
|
33
|
+
const StackToolbarSearchBarSlot = (props) => {
|
|
34
|
+
const placement = (0, context_1.useToolbarPlacement)();
|
|
35
|
+
if (placement !== 'bottom') {
|
|
36
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
37
|
+
console.warn('Stack.Toolbar.SearchBarSlot is only available in Bottom placement. It will not render in Left or Right placement.');
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return <bottom_toolbar_native_elements_1.NativeToolbarSearchBarSlot {...props}/>;
|
|
42
|
+
};
|
|
43
|
+
exports.StackToolbarSearchBarSlot = StackToolbarSearchBarSlot;
|
|
44
|
+
//# sourceMappingURL=StackToolbarSearchBarSlot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackToolbarSearchBarSlot.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarSearchBarSlot.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,qFAA8E;AAC9E,uCAAgD;AAuBhD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACI,MAAM,yBAAyB,GAA6C,CAAC,KAAK,EAAE,EAAE;IAC3F,MAAM,SAAS,GAAG,IAAA,6BAAmB,GAAE,CAAC;IAExC,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,OAAO,CAAC,IAAI,CACV,mHAAmH,CACpH,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,2DAA0B,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnD,CAAC,CAAC;AAbW,QAAA,yBAAyB,6BAapC","sourcesContent":["'use client';\nimport { NativeToolbarSearchBarSlot } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\n\nexport interface StackToolbarSearchBarSlotProps {\n /**\n * Whether the search bar slot 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 * Whether this search bar slot shares background with adjacent items.\n *\n * @platform iOS 26+\n */\n sharesBackground?: boolean;\n}\n\n/**\n * A search bar slot for the bottom toolbar. This reserves space for the search bar\n * in the toolbar and allows positioning it among other toolbar items.\n *\n * This component is only available in bottom placement (`<Stack.Toolbar>` or `<Stack.Toolbar placement=\"bottom\">`).\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar>\n * <Stack.Toolbar.Button icon=\"folder\" />\n * <Stack.Toolbar.SearchBarSlot />\n * <Stack.Toolbar.Button icon=\"ellipsis.circle\" />\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform iOS 26+\n */\nexport const StackToolbarSearchBarSlot: React.FC<StackToolbarSearchBarSlotProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement !== 'bottom') {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Stack.Toolbar.SearchBarSlot is only available in Bottom placement. It will not render in Left or Right placement.'\n );\n }\n return null;\n }\n\n return <NativeToolbarSearchBarSlot {...props} />;\n};\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { NativeStackHeaderItemSpacing } from '@react-navigation/native-stack';
|
|
2
|
+
export interface StackToolbarSpacerProps {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the spacer should be hidden.
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
hidden?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The width of the spacing element.
|
|
11
|
+
*
|
|
12
|
+
* In Left/Right placements, width is required.
|
|
13
|
+
* In Bottom placement, if width is not provided, the spacer will be flexible
|
|
14
|
+
* and expand to fill available space.
|
|
15
|
+
*/
|
|
16
|
+
width?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to hide the shared background.
|
|
19
|
+
*
|
|
20
|
+
* Only available in bottom placement.
|
|
21
|
+
*
|
|
22
|
+
* @platform iOS 26+
|
|
23
|
+
*/
|
|
24
|
+
hidesSharedBackground?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether this spacer shares background with adjacent items.
|
|
27
|
+
*
|
|
28
|
+
* Only available in bottom placement.
|
|
29
|
+
*
|
|
30
|
+
* @platform iOS 26+
|
|
31
|
+
*/
|
|
32
|
+
sharesBackground?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A spacing helper used inside `Stack.Toolbar` to create empty space between toolbar items.
|
|
36
|
+
*
|
|
37
|
+
* In left/right placements, width is required.
|
|
38
|
+
* In bottom placement, if width is not provided, creates a flexible spacer that expands to fill space.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* import { Stack } from 'expo-router';
|
|
43
|
+
*
|
|
44
|
+
* export default function Page() {
|
|
45
|
+
* return (
|
|
46
|
+
* <>
|
|
47
|
+
* <Stack.Toolbar placement="left">
|
|
48
|
+
* <Stack.Toolbar.Button icon="arrow.left" />
|
|
49
|
+
* <Stack.Toolbar.Spacer width={8} />
|
|
50
|
+
* <Stack.Toolbar.Button icon="arrow.right" />
|
|
51
|
+
* </Stack.Toolbar>
|
|
52
|
+
* <ScreenContent />
|
|
53
|
+
* </>
|
|
54
|
+
* );
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* import { Stack } from 'expo-router';
|
|
61
|
+
*
|
|
62
|
+
* export default function Page() {
|
|
63
|
+
* return (
|
|
64
|
+
* <>
|
|
65
|
+
* <Stack.Toolbar>
|
|
66
|
+
* <Stack.Toolbar.Spacer />
|
|
67
|
+
* <Stack.Toolbar.Button icon="search" />
|
|
68
|
+
* <Stack.Toolbar.Spacer />
|
|
69
|
+
* </Stack.Toolbar>
|
|
70
|
+
* <ScreenContent />
|
|
71
|
+
* </>
|
|
72
|
+
* );
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @platform ios
|
|
77
|
+
*/
|
|
78
|
+
export declare const StackToolbarSpacer: React.FC<StackToolbarSpacerProps>;
|
|
79
|
+
export declare function convertStackToolbarSpacerPropsToRNHeaderItem(props: StackToolbarSpacerProps): NativeStackHeaderItemSpacing | undefined;
|
|
80
|
+
//# sourceMappingURL=StackToolbarSpacer.d.ts.map
|