expo-router 7.0.0-canary-20251230-fc48ddc → 7.0.0-canary-20260113-0ce2b9c
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/Route.d.ts +3 -5
- package/build/Route.d.ts.map +1 -1
- package/build/Route.js +2 -2
- package/build/Route.js.map +1 -1
- package/build/exports.d.ts +3 -0
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js +3 -1
- package/build/exports.js.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.d.ts.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.js +9 -0
- package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
- package/build/getRoutesCore.d.ts +2 -0
- package/build/getRoutesCore.d.ts.map +1 -1
- package/build/getRoutesCore.js.map +1 -1
- package/build/internal/utils.d.ts +1 -1
- package/build/internal/utils.d.ts.map +1 -1
- package/build/internal/utils.js +2 -2
- package/build/internal/utils.js.map +1 -1
- package/build/layouts/StackClient.d.ts +2 -2
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +1 -0
- package/build/layouts/StackClient.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderComponent.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderComponent.js +3 -3
- package/build/layouts/stack-utils/StackHeaderComponent.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderMenu.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderMenu.js +1 -0
- package/build/layouts/stack-utils/StackHeaderMenu.js.map +1 -1
- package/build/layouts/stack-utils/StackSearchBar.d.ts +7 -0
- package/build/layouts/stack-utils/StackSearchBar.d.ts.map +1 -0
- package/build/layouts/stack-utils/StackSearchBar.js +19 -0
- package/build/layouts/stack-utils/StackSearchBar.js.map +1 -0
- package/build/layouts/stack-utils/index.d.ts +2 -3
- package/build/layouts/stack-utils/index.d.ts.map +1 -1
- package/build/layouts/stack-utils/index.js +3 -4
- package/build/layouts/stack-utils/index.js.map +1 -1
- package/build/link/elements.d.ts +13 -1
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +1 -1
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +8 -1
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js +0 -2
- package/build/link/preview/native.js.map +1 -1
- package/build/link/zoom/ZoomTransitionEnabler.d.ts +1 -1
- package/build/link/zoom/ZoomTransitionEnabler.d.ts.map +1 -1
- package/build/link/zoom/ZoomTransitionEnabler.ios.d.ts +1 -1
- package/build/link/zoom/ZoomTransitionEnabler.ios.d.ts.map +1 -1
- package/build/link/zoom/ZoomTransitionEnabler.ios.js +9 -12
- package/build/link/zoom/ZoomTransitionEnabler.ios.js.map +1 -1
- package/build/link/zoom/ZoomTransitionEnabler.js +2 -2
- package/build/link/zoom/ZoomTransitionEnabler.js.map +1 -1
- package/build/link/zoom/usePreventZoomTransitionDismissal.d.ts +36 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.d.ts.map +1 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.ios.d.ts +3 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.ios.d.ts.map +1 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.ios.js +60 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.ios.js.map +1 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.js +41 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.js.map +1 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.types.d.ts +14 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.types.d.ts.map +1 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.types.js +3 -0
- package/build/link/zoom/usePreventZoomTransitionDismissal.types.js.map +1 -0
- package/build/link/zoom/zoom-transition-context-providers.ios.d.ts.map +1 -1
- package/build/link/zoom/zoom-transition-context-providers.ios.js +6 -1
- package/build/link/zoom/zoom-transition-context-providers.ios.js.map +1 -1
- package/build/link/zoom/zoom-transition-context.d.ts +25 -0
- package/build/link/zoom/zoom-transition-context.d.ts.map +1 -1
- package/build/link/zoom/zoom-transition-context.js +1 -0
- package/build/link/zoom/zoom-transition-context.js.map +1 -1
- package/build/native-tabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeTabsView.js +21 -2
- package/build/native-tabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/common/elements.d.ts +8 -0
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/navigationParams.d.ts +20 -0
- package/build/navigationParams.d.ts.map +1 -1
- package/build/navigationParams.js +10 -1
- package/build/navigationParams.js.map +1 -1
- package/build/toolbar/elements.d.ts +81 -3
- package/build/toolbar/elements.d.ts.map +1 -1
- package/build/toolbar/elements.js +40 -6
- package/build/toolbar/elements.js.map +1 -1
- package/build/toolbar/index.d.ts +6 -5
- package/build/toolbar/index.d.ts.map +1 -1
- package/build/toolbar/index.js +5 -3
- package/build/toolbar/index.js.map +1 -1
- package/build/toolbar/native.ios.d.ts.map +1 -1
- package/build/toolbar/native.ios.js +3 -1
- package/build/toolbar/native.ios.js.map +1 -1
- package/build/toolbar/native.types.d.ts +17 -1
- package/build/toolbar/native.types.d.ts.map +1 -1
- package/build/toolbar/native.types.js.map +1 -1
- package/build/ui/Slot.d.ts.map +1 -1
- package/build/ui/Slot.js +44 -1
- package/build/ui/Slot.js.map +1 -1
- package/build/useScreens.d.ts +9 -2
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +7 -5
- package/build/useScreens.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/LinkPreview/LinkPreviewNativeActionView.swift +7 -0
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +37 -3
- package/ios/LinkPreview/LinkZoomTransition.swift +13 -3
- package/ios/Toolbar/RouterToolbarHostView.swift +1 -1
- package/ios/Toolbar/RouterToolbarItemView.swift +35 -4
- package/ios/Toolbar/RouterToolbarModule.swift +4 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.module → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.pom → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.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 -10
- package/plugin/build/index.d.ts +2 -0
- package/plugin/options.json +5 -0
- package/plugin/src/index.ts +2 -0
- package/build/layouts/stack-utils/StackHeaderSearchBar.d.ts +0 -7
- package/build/layouts/stack-utils/StackHeaderSearchBar.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderSearchBar.js +0 -16
- package/build/layouts/stack-utils/StackHeaderSearchBar.js.map +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc-sources.jar → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc-sources.jar.md5 → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc-sources.jar.sha1 → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc-sources.jar.sha256 → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc-sources.jar.sha512 → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.aar → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.aar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.aar.md5 → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.aar.sha1 → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.aar.sha256 → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251230-fc48ddc/expo.modules.router-7.0.0-canary-20251230-fc48ddc.aar.sha512 → 7.0.0-canary-20260113-0ce2b9c/expo.modules.router-7.0.0-canary-20260113-0ce2b9c.aar.sha512} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToolbarHost = exports.ToolbarView = exports.ToolbarSpacer = exports.ToolbarButton = exports.ToolbarMenuAction = exports.ToolbarMenu = void 0;
|
|
3
|
+
exports.ToolbarHost = exports.ToolbarView = exports.ToolbarSearchBarPreferredSlot = exports.ToolbarSpacer = exports.ToolbarButton = exports.ToolbarMenuAction = exports.ToolbarMenu = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
6
|
const native_1 = require("./native");
|
|
@@ -24,7 +24,7 @@ const children_1 = require("../utils/children");
|
|
|
24
24
|
*
|
|
25
25
|
* @platform ios
|
|
26
26
|
*/
|
|
27
|
-
const ToolbarMenu = ({ accessibilityHint, accessibilityLabel, separateBackground, hidesSharedBackground, palette, inline, hidden, subtitle, title, destructive, children, icon, tintColor, variant, style, }) => {
|
|
27
|
+
const ToolbarMenu = ({ accessibilityHint, accessibilityLabel, separateBackground, hidesSharedBackground, palette, inline, hidden, subtitle, title, destructive, children, icon, tintColor, variant, style, elementSize, }) => {
|
|
28
28
|
const identifier = (0, react_1.useId)();
|
|
29
29
|
const validChildren = react_1.Children.toArray(children).filter((child) => (0, react_1.isValidElement)(child) && (child.type === exports.ToolbarMenuAction || child.type === exports.ToolbarMenu));
|
|
30
30
|
const label = (0, children_1.getFirstChildOfType)(children, primitives_1.Label);
|
|
@@ -34,7 +34,7 @@ const ToolbarMenu = ({ accessibilityHint, accessibilityLabel, separateBackground
|
|
|
34
34
|
(iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);
|
|
35
35
|
const sf = typeof computedIcon === 'string' ? computedIcon : undefined;
|
|
36
36
|
const titleStyle = react_native_1.StyleSheet.flatten(style);
|
|
37
|
-
return (<native_2.NativeLinkPreviewAction sharesBackground={!separateBackground} hidesSharedBackground={hidesSharedBackground} hidden={hidden} icon={sf} destructive={destructive} subtitle={subtitle} accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint} displayAsPalette={palette} displayInline={inline} tintColor={tintColor} titleStyle={titleStyle} barButtonItemStyle={variant === 'done' ? 'prominent' : variant} title={computedTitle} onSelected={() => { }} children={validChildren} identifier={identifier}/>);
|
|
37
|
+
return (<native_2.NativeLinkPreviewAction sharesBackground={!separateBackground} hidesSharedBackground={hidesSharedBackground} hidden={hidden} icon={sf} destructive={destructive} subtitle={subtitle} accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint} displayAsPalette={palette} displayInline={inline} preferredElementSize={elementSize} tintColor={tintColor} titleStyle={titleStyle} barButtonItemStyle={variant === 'done' ? 'prominent' : variant} title={computedTitle} onSelected={() => { }} children={validChildren} identifier={identifier}/>);
|
|
38
38
|
};
|
|
39
39
|
exports.ToolbarMenu = ToolbarMenu;
|
|
40
40
|
/**
|
|
@@ -83,7 +83,7 @@ const ToolbarButton = (props) => {
|
|
|
83
83
|
const icon = props.icon ??
|
|
84
84
|
(iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);
|
|
85
85
|
const sf = typeof icon === 'string' ? icon : undefined;
|
|
86
|
-
return (<native_1.RouterToolbarItem accessibilityHint={props.accessibilityHint} accessibilityLabel={props.accessibilityLabel} barButtonItemStyle={props.variant === 'done' ? 'prominent' : props.variant} disabled={props.disabled} hidden={props.hidden} hidesSharedBackground={props.hidesSharedBackground} identifier={id} onSelected={props.onPress} possibleTitles={props.possibleTitles} selected={props.selected} sharesBackground={!props.separateBackground} systemImageName={sf} title={label} tintColor={props.tintColor} titleStyle={react_native_1.StyleSheet.flatten(props.style)}/>);
|
|
86
|
+
return (<native_1.RouterToolbarItem accessibilityHint={props.accessibilityHint} accessibilityLabel={props.accessibilityLabel} barButtonItemStyle={props.variant === 'done' ? 'prominent' : props.variant} disabled={props.disabled} hidden={props.hidden} hidesSharedBackground={props.hidesSharedBackground} identifier={id} image={props.image} onSelected={props.onPress} possibleTitles={props.possibleTitles} selected={props.selected} sharesBackground={!props.separateBackground} systemImageName={sf} title={label} tintColor={props.tintColor} titleStyle={react_native_1.StyleSheet.flatten(props.style)}/>);
|
|
87
87
|
};
|
|
88
88
|
exports.ToolbarButton = ToolbarButton;
|
|
89
89
|
/**
|
|
@@ -110,6 +110,40 @@ const ToolbarSpacer = (props) => {
|
|
|
110
110
|
return (<native_1.RouterToolbarItem hidesSharedBackground={props.hidesSharedBackground} hidden={props.hidden} identifier={id} sharesBackground={props.sharesBackground} type={props.width ? 'fixedSpacer' : 'fluidSpacer'} width={props.width}/>);
|
|
111
111
|
};
|
|
112
112
|
exports.ToolbarSpacer = ToolbarSpacer;
|
|
113
|
+
/**
|
|
114
|
+
* Declares the position of a search bar within the toolbar.
|
|
115
|
+
* It should only be used as a child of `Toolbar`.
|
|
116
|
+
*
|
|
117
|
+
* > **Note**: On iOS 26+, this component specifies where in the toolbar the search bar
|
|
118
|
+
* > (configured via `Stack.SearchBar`) should appear. On iOS 18 and earlier, the search bar
|
|
119
|
+
* > will be shown in the header instead.
|
|
120
|
+
*
|
|
121
|
+
* > **Important**: You must use `Stack.SearchBar` to configure and display the actual
|
|
122
|
+
* > search bar. This component only declares its position in the toolbar.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* <Stack.SearchBar placeholder="Search..." />
|
|
127
|
+
* <Toolbar>
|
|
128
|
+
* <Toolbar.SearchBarPreferredSlot />
|
|
129
|
+
* <Toolbar.Spacer />
|
|
130
|
+
* <Toolbar.Button icon="mic" />
|
|
131
|
+
* </Toolbar>
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @platform ios 26+
|
|
135
|
+
*/
|
|
136
|
+
const ToolbarSearchBarPreferredSlot = ({ hidesSharedBackground, hidden, sharesBackground, }) => {
|
|
137
|
+
const id = (0, react_1.useId)();
|
|
138
|
+
if (process.env.EXPO_OS !== 'ios' || parseInt(String(react_native_1.Platform.Version).split('.')[0], 10) < 26) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
if (hidden) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
return (<native_1.RouterToolbarItem hidesSharedBackground={hidesSharedBackground} identifier={id} sharesBackground={sharesBackground} type="searchBar"/>);
|
|
145
|
+
};
|
|
146
|
+
exports.ToolbarSearchBarPreferredSlot = ToolbarSearchBarPreferredSlot;
|
|
113
147
|
/**
|
|
114
148
|
* A custom view component for the toolbar that can contain any React elements.
|
|
115
149
|
* Useful for embedding custom components.
|
|
@@ -127,8 +161,8 @@ exports.ToolbarSpacer = ToolbarSpacer;
|
|
|
127
161
|
* placeholderTextColor={Color.ios.placeholderText}
|
|
128
162
|
* />
|
|
129
163
|
* </Toolbar.View>
|
|
130
|
-
* <Toolbar.View separateBackground
|
|
131
|
-
* <Pressable onPress={handlePress}>
|
|
164
|
+
* <Toolbar.View separateBackground>
|
|
165
|
+
* <Pressable style={{ width: 32, height: 32 }} onPress={handlePress}>
|
|
132
166
|
* <SymbolView name="plus" size={22} />
|
|
133
167
|
* </Pressable>
|
|
134
168
|
* </Toolbar.View>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/toolbar/elements.tsx"],"names":[],"mappings":";;;AAAA,iCAAwE;AACxE,+CAA2E;AAG3E,qCAAgE;AAChE,mFAAgF;AAChF,+CAA4E;AAC5E,mDAAiE;AACjE,8CAA4C;AAC5C,gDAAwD;AAyFxD;;;;;;;;;;;;;;GAcG;AACI,MAAM,WAAW,GAA+B,CAAC,EACtD,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,OAAO,EACP,MAAM,EACN,MAAM,EACN,QAAQ,EACR,KAAK,EACL,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,OAAO,EACP,KAAK,GACN,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,IAAA,aAAK,GAAE,CAAC;IAC3B,MAAM,aAAa,GAAG,gBAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CACrD,CAAC,KAAK,EAAE,EAAE,CACR,IAAA,sBAAc,EAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,yBAAiB,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAW,CAAC,CAC5F,CAAC;IACF,MAAM,KAAK,GAAG,IAAA,8BAAmB,EAAC,QAAQ,EAAE,kBAAK,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,IAAA,8BAAmB,EAAC,QAAQ,EAAE,iBAAI,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,KAAK,IAAI,KAAK,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC3D,MAAM,YAAY,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MAAM,EACN,qBAAqB,EACrB,kBAAkB,GACD,EAAE,EAAE;IACrB,MAAM,EAAE,GAAG,IAAA,aAAK,GAAE,CAAC;IACnB,OAAO,CACL,CAAC,0BAAiB,CAChB,qBAAqB,CAAC,CAAC,qBAAqB,CAAC,CAC7C,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,UAAU,CAAC,CAAC,EAAE,CAAC,CACf,gBAAgB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CACtC;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,0BAAiB,CAAC,CACrB,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,WAAW,eAgBtB;AAMK,MAAM,WAAW,GAAG,CAAC,KAAmB,EAAE,EAAE;IACjD,uEAAuE;IACvE,OAAO,CACL,CAAC,uDAA0B,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAChE;MAAA,CAAC,0BAAiB,CAAC,IAAI,KAAK,CAAC,EAC/B;IAAA,EAAE,uDAA0B,CAAC,CAC9B,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,WAAW,eAOtB","sourcesContent":["import { Children, isValidElement, useId, type ReactNode } from 'react';\nimport { StyleSheet, type ColorValue, type StyleProp } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { RouterToolbarHost, RouterToolbarItem } from './native';\nimport { InternalLinkPreviewContext } from '../link/InternalLinkPreviewContext';\nimport { LinkMenuAction, type LinkMenuActionProps } from '../link/elements';\nimport { NativeLinkPreviewAction } from '../link/preview/native';\nimport { Icon, Label } from '../primitives';\nimport { getFirstChildOfType } from '../utils/children';\nimport type { BasicTextStyle } from '../utils/font';\n\nexport interface ToolbarMenuProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n children?: React.ReactNode;\n /**\n * An optional subtitle for the menu. Does not appear on `inline` menus.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.\n */\n subtitle?: string;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive) for more information.\n */\n destructive?: boolean;\n disabled?: boolean;\n hidden?: boolean;\n /**\n * Whether to hide the shared background when `sharesBackground` is enabled.\n *\n * Only available for root level menus.\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 * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: SFSymbol;\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 * > **Note**: Text buttons cannot share the background.\n *\n * This prop reverses the native behavior of `sharesBackground`.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground) for more information.\n *\n * @default false\n *\n * @platform iOS 26+\n */\n separateBackground?: boolean;\n /**\n * Style for the label of the header item.\n */\n style?: StyleProp<BasicTextStyle>;\n /**\n * The title of the menu item\n */\n title?: string;\n\n /**\n * Tint color for the menu icon and text.\n */\n tintColor?: ColorValue;\n\n /**\n * Controls the visual style of the menu when represented as a bar button.\n *\n * @default 'plain'\n */\n variant?: 'plain' | 'done' | 'prominent';\n}\n\n/**\n * Adds a context menu for to a toolbar.\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Menu title=\"Options\">\n * <Toolbar.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Toolbar.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Toolbar.Menu>\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarMenu: React.FC<ToolbarMenuProps> = ({\n accessibilityHint,\n accessibilityLabel,\n separateBackground,\n hidesSharedBackground,\n palette,\n inline,\n hidden,\n subtitle,\n title,\n destructive,\n children,\n icon,\n tintColor,\n variant,\n style,\n}) => {\n const identifier = useId();\n const validChildren = Children.toArray(children).filter(\n (child) =>\n isValidElement(child) && (child.type === ToolbarMenuAction || child.type === ToolbarMenu)\n );\n const label = getFirstChildOfType(children, Label);\n const iconComponent = getFirstChildOfType(children, Icon);\n\n const computedTitle = title ?? label?.props.children ?? '';\n const computedIcon =\n icon ??\n (iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);\n const sf = typeof computedIcon === 'string' ? computedIcon : undefined;\n const titleStyle = StyleSheet.flatten(style);\n return (\n <NativeLinkPreviewAction\n sharesBackground={!separateBackground}\n hidesSharedBackground={hidesSharedBackground}\n hidden={hidden}\n icon={sf}\n destructive={destructive}\n subtitle={subtitle}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n displayAsPalette={palette}\n displayInline={inline}\n tintColor={tintColor}\n titleStyle={titleStyle}\n barButtonItemStyle={variant === 'done' ? 'prominent' : variant}\n title={computedTitle}\n onSelected={() => {}}\n children={validChildren}\n identifier={identifier}\n />\n );\n};\n\nexport type ToolbarMenuActionProps = LinkMenuActionProps;\n\n/**\n * A single action item within a toolbar menu.\n *\n * For available props, see [`LinkMenuActionProps`](./router/#linkmenuactionprops).\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Menu title=\"Options\">\n * <Toolbar.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Toolbar.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Toolbar.Menu>\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarMenuAction = LinkMenuAction;\n\nexport interface ToolbarButtonProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /**\n * The text label for the button.\n *\n * > **Note**: When icon is used, the label will not be shown and will be used for accessibility purposes only.\n *\n * @example\n * ```tsx\n * import { Toolbar } from 'expo-router/unstable-toolbar';\n *\n * ...\n * <Toolbar.Button>This is button label</Toolbar.Button>\n * ```\n */\n children?: ReactNode;\n disabled?: boolean;\n\n /**\n * Whether the button should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n\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 // TODO: support ImageSourcePropType icons in addition to SFSymbols\n /**\n * The name of the SF Symbol to display as the button icon.\n * For a list of available symbols, see [SF Symbols](https://developer.apple.com/sf-symbols/).\n */\n icon?: SFSymbol;\n\n /**\n * Callback function when the button is pressed.\n */\n onPress?: () => void;\n\n /**\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/possibletitles) for more information.\n */\n possibleTitles?: string[];\n\n /**\n * Whether the button is in a selected state\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected) for more information.\n */\n selected?: boolean;\n\n /**\n * Whether to separate the background of this item from other header items.\n *\n * > **Note**: Text buttons cannot share the background.\n *\n * This prop reverses the native behavior of `sharesBackground`.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground) for more information.\n *\n * @default false\n *\n * @platform iOS 26+\n */\n separateBackground?: boolean;\n\n /**\n * Style for the label of the header item.\n */\n style?: StyleProp<BasicTextStyle>;\n\n /**\n * Tint color for the button icon and text.\n */\n tintColor?: ColorValue;\n\n /**\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/style-swift.enum) for more information.\n *\n * @default 'plain'\n */\n variant?: 'plain' | 'done' | 'prominent';\n}\n\n// As noted in https://sebvidal.com/blog/whats-new-in-uikit-26/?utm_source=chatgpt.com#:~:text=It%27s%20worth%20noting%20that%2C%20at%20the%20time%20of%20writing%2C%20bar%20button%20badges%20are%20only%20supported%20in%20navigation%20bars%20%2D%20not%20tool%20bars.\n// currently badges are not supported in toolbars, and only in navigation bars.\n// Therefore, there is no badge support in ToolbarButton\n/**\n * A button component for use in the toolbar.\n * It should only be used as a child of `Toolbar`.\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Button icon=\"magnifyingglass\" tintColor={Color.ios.placeholderText} />\n * <Toolbar.Button>Text Button</Toolbar.Button>\n * <Toolbar.Button hidden={!isSearchFocused} icon=\"xmark\" onPress={handleClear} />\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarButton = (props: ToolbarButtonProps) => {\n const id = useId();\n const areChildrenString = typeof props.children === 'string';\n const label = areChildrenString\n ? (props.children as string)\n : getFirstChildOfType(props.children, Label)?.props.children;\n const iconComponent =\n !props.icon && !areChildrenString ? getFirstChildOfType(props.children, Icon) : undefined;\n const icon =\n props.icon ??\n (iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);\n const sf = typeof icon === 'string' ? icon : undefined;\n return (\n <RouterToolbarItem\n accessibilityHint={props.accessibilityHint}\n accessibilityLabel={props.accessibilityLabel}\n barButtonItemStyle={props.variant === 'done' ? 'prominent' : props.variant}\n disabled={props.disabled}\n hidden={props.hidden}\n hidesSharedBackground={props.hidesSharedBackground}\n identifier={id}\n onSelected={props.onPress}\n possibleTitles={props.possibleTitles}\n selected={props.selected}\n sharesBackground={!props.separateBackground}\n systemImageName={sf}\n title={label}\n tintColor={props.tintColor}\n titleStyle={StyleSheet.flatten(props.style)}\n />\n );\n};\n\nexport type ToolbarSpacerProps = {\n /**\n * Whether to hide the shared background when `sharesBackground` is enabled.\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 spacer should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether the spacer shares the background with adjacent toolbar items.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground) for more information.\n *\n * @platform iOS 26+\n * @default false\n */\n sharesBackground?: boolean;\n /**\n * By default, the spacer is flexible and expands to fill available space.\n * If a width is provided, it creates a [fixed-width spacer](https://developer.apple.com/documentation/uikit/uibarbuttonitem/fixedspace(_:)).\n */\n width?: number;\n};\n\n/**\n * A spacer component for the toolbar.\n * Without a width, it creates a flexible spacer that expands to fill available space.\n * With a width, it creates a fixed-width spacer.\n * It should only be used as a child of `Toolbar`.\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Spacer />\n * <Toolbar.Button icon=\"magnifyingglass\" />\n * <Toolbar.Spacer width={20} />\n * <Toolbar.Button icon=\"mic\" />\n * <Toolbar.Spacer />\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarSpacer = (props: ToolbarSpacerProps) => {\n const id = useId();\n return (\n <RouterToolbarItem\n hidesSharedBackground={props.hidesSharedBackground}\n hidden={props.hidden}\n identifier={id}\n sharesBackground={props.sharesBackground}\n type={props.width ? 'fixedSpacer' : 'fluidSpacer'}\n width={props.width}\n />\n );\n};\n\n/**\n * Props for the ToolbarView component.\n *\n * @platform ios\n */\nexport interface ToolbarViewProps {\n /**\n * React elements to render inside the toolbar view.\n */\n children: React.ReactNode;\n /**\n * Whether the view should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether to hide the shared background when `sharesBackground` is enabled.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground) for more information.\n *\n * @platform iOS 18+\n */\n hidesSharedBackground?: boolean;\n /**\n * Whether to separate the background of this item from other header items.\n *\n * This prop reverses the native behavior of `sharesBackground`.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground) for more information.\n *\n * @default false\n *\n * @platform iOS 26+\n */\n separateBackground?: boolean;\n}\n\n/**\n * A custom view component for the toolbar that can contain any React elements.\n * Useful for embedding custom components.\n * It should only be used as a child of `Toolbar`.\n *\n * The items within the view will be absolutely positioned, so flexbox styles will not work as expected.\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Spacer />\n * <Toolbar.View>\n * <TextInput\n * placeholder=\"Search\"\n * placeholderTextColor={Color.ios.placeholderText}\n * />\n * </Toolbar.View>\n * <Toolbar.View separateBackground style={{ width: 32, height: 32 }}>\n * <Pressable onPress={handlePress}>\n * <SymbolView name=\"plus\" size={22} />\n * </Pressable>\n * </Toolbar.View>\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarView = ({\n children,\n hidden,\n hidesSharedBackground,\n separateBackground,\n}: ToolbarViewProps) => {\n const id = useId();\n return (\n <RouterToolbarItem\n hidesSharedBackground={hidesSharedBackground}\n hidden={hidden}\n identifier={id}\n sharesBackground={!separateBackground}>\n {children}\n </RouterToolbarItem>\n );\n};\n\nexport interface ToolbarProps {\n children?: React.ReactNode;\n}\n\nexport const ToolbarHost = (props: ToolbarProps) => {\n // TODO: Replace InternalLinkPreviewContext with a more generic context\n return (\n <InternalLinkPreviewContext value={{ isVisible: false, href: '' }}>\n <RouterToolbarHost {...props} />\n </InternalLinkPreviewContext>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/toolbar/elements.tsx"],"names":[],"mappings":";;;AACA,iCAAwE;AACxE,+CAAqF;AAGrF,qCAAgE;AAChE,mFAAgF;AAChF,+CAA4E;AAC5E,mDAAiE;AACjE,8CAA4C;AAC5C,gDAAwD;AAmGxD;;;;;;;;;;;;;;GAcG;AACI,MAAM,WAAW,GAA+B,CAAC,EACtD,iBAAiB,EACjB,kBAAkB,EAClB,kBAA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BAAqB,CAAC,CAAC,qBAAqB,CAAC,CAC7C,UAAU,CAAC,CAAC,EAAE,CAAC,CACf,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,IAAI,CAAC,WAAW,EAChB,CACH,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,6BAA6B,iCAoBxC;AAwCF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACI,MAAM,WAAW,GAAG,CAAC,EAC1B,QAAQ,EACR,MAAM,EACN,qBAAqB,EACrB,kBAAkB,GACD,EAAE,EAAE;IACrB,MAAM,EAAE,GAAG,IAAA,aAAK,GAAE,CAAC;IACnB,OAAO,CACL,CAAC,0BAAiB,CAChB,qBAAqB,CAAC,CAAC,qBAAqB,CAAC,CAC7C,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,UAAU,CAAC,CAAC,EAAE,CAAC,CACf,gBAAgB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CACtC;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,0BAAiB,CAAC,CACrB,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,WAAW,eAgBtB;AAMK,MAAM,WAAW,GAAG,CAAC,KAAmB,EAAE,EAAE;IACjD,uEAAuE;IACvE,OAAO,CACL,CAAC,uDAA0B,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAChE;MAAA,CAAC,0BAAiB,CAAC,IAAI,KAAK,CAAC,EAC/B;IAAA,EAAE,uDAA0B,CAAC,CAC9B,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,WAAW,eAOtB","sourcesContent":["import type { ImageRef } from 'expo-image';\nimport { Children, isValidElement, useId, type ReactNode } from 'react';\nimport { Platform, StyleSheet, type ColorValue, type StyleProp } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { RouterToolbarHost, RouterToolbarItem } from './native';\nimport { InternalLinkPreviewContext } from '../link/InternalLinkPreviewContext';\nimport { LinkMenuAction, type LinkMenuActionProps } from '../link/elements';\nimport { NativeLinkPreviewAction } from '../link/preview/native';\nimport { Icon, Label } from '../primitives';\nimport { getFirstChildOfType } from '../utils/children';\nimport type { BasicTextStyle } from '../utils/font';\n\nexport interface ToolbarMenuProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n children?: React.ReactNode;\n /**\n * An optional subtitle for the menu. Does not appear on `inline` menus.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.\n */\n subtitle?: string;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive) for more information.\n */\n destructive?: boolean;\n disabled?: boolean;\n hidden?: boolean;\n /**\n * Whether to hide the shared background when `sharesBackground` is enabled.\n *\n * Only available for root level menus.\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 * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: SFSymbol;\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 * The `elementSize` property is ignored when palette is used, all items will be `elementSize=\"small\"`. Use `elementSize=\"medium\"` instead of `palette` to display actions with titles horizontally.\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 * > **Note**: Text buttons cannot share the background.\n *\n * This prop reverses the native behavior of `sharesBackground`.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground) for more information.\n *\n * @default false\n *\n * @platform iOS 26+\n */\n separateBackground?: boolean;\n /**\n * Style for the label of the header item.\n */\n style?: StyleProp<BasicTextStyle>;\n /**\n * The title of the menu item\n */\n title?: string;\n\n /**\n * Tint color for the menu icon and text.\n */\n tintColor?: ColorValue;\n\n /**\n * Controls the visual style of the menu when represented as a bar button.\n *\n * @default 'plain'\n */\n variant?: 'plain' | 'done' | 'prominent';\n /**\n * The preferred size of the menu elements.\n * `elementSize` property is ignored when `palette` is used.\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 * Adds a context menu for to a toolbar.\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Menu title=\"Options\">\n * <Toolbar.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Toolbar.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Toolbar.Menu>\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarMenu: React.FC<ToolbarMenuProps> = ({\n accessibilityHint,\n accessibilityLabel,\n separateBackground,\n hidesSharedBackground,\n palette,\n inline,\n hidden,\n subtitle,\n title,\n destructive,\n children,\n icon,\n tintColor,\n variant,\n style,\n elementSize,\n}) => {\n const identifier = useId();\n const validChildren = Children.toArray(children).filter(\n (child) =>\n isValidElement(child) && (child.type === ToolbarMenuAction || child.type === ToolbarMenu)\n );\n const label = getFirstChildOfType(children, Label);\n const iconComponent = getFirstChildOfType(children, Icon);\n\n const computedTitle = title ?? label?.props.children ?? '';\n const computedIcon =\n icon ??\n (iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);\n const sf = typeof computedIcon === 'string' ? computedIcon : undefined;\n const titleStyle = StyleSheet.flatten(style);\n return (\n <NativeLinkPreviewAction\n sharesBackground={!separateBackground}\n hidesSharedBackground={hidesSharedBackground}\n hidden={hidden}\n icon={sf}\n destructive={destructive}\n subtitle={subtitle}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n displayAsPalette={palette}\n displayInline={inline}\n preferredElementSize={elementSize}\n tintColor={tintColor}\n titleStyle={titleStyle}\n barButtonItemStyle={variant === 'done' ? 'prominent' : variant}\n title={computedTitle}\n onSelected={() => {}}\n children={validChildren}\n identifier={identifier}\n />\n );\n};\n\nexport type ToolbarMenuActionProps = LinkMenuActionProps;\n\n/**\n * A single action item within a toolbar menu.\n *\n * For available props, see [`LinkMenuActionProps`](./router/#linkmenuactionprops).\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Menu title=\"Options\">\n * <Toolbar.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Toolbar.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Toolbar.Menu>\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarMenuAction = LinkMenuAction;\n\nexport interface ToolbarButtonProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /**\n * The text label for the button.\n *\n * > **Note**: When icon is used, the label will not be shown and will be used for accessibility purposes only.\n *\n * @example\n * ```tsx\n * import { Toolbar } from 'expo-router/unstable-toolbar';\n *\n * ...\n * <Toolbar.Button>This is button label</Toolbar.Button>\n * ```\n */\n children?: ReactNode;\n disabled?: boolean;\n\n /**\n * Whether the button should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n\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 // TODO: support ImageSourcePropType icons in addition to SFSymbols\n /**\n * The name of the SF Symbol to display as the button icon.\n * For a list of available symbols, see [SF Symbols](https://developer.apple.com/sf-symbols/).\n */\n icon?: SFSymbol;\n\n /**\n * Custom image loaded using expo-image's `useImage` hook.\n * Takes priority over `icon` (SF Symbol) when both are provided.\n *\n * @example\n * ```tsx\n * import { useImage } from 'expo-image';\n * import { Toolbar } from 'expo-router/unstable-toolbar';\n *\n * const customIcon = useImage('https://example.com/icon.png', {\n * maxWidth: 44,\n * maxHeight: 44,\n * });\n *\n * <Toolbar.Button image={customIcon} onPress={() => {}} />\n * ```\n */\n image?: ImageRef | null;\n\n /**\n * Callback function when the button is pressed.\n */\n onPress?: () => void;\n\n /**\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/possibletitles) for more information.\n */\n possibleTitles?: string[];\n\n /**\n * Whether the button is in a selected state\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected) for more information.\n */\n selected?: boolean;\n\n /**\n * Whether to separate the background of this item from other header items.\n *\n * > **Note**: Text buttons cannot share the background.\n *\n * This prop reverses the native behavior of `sharesBackground`.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground) for more information.\n *\n * @default false\n *\n * @platform iOS 26+\n */\n separateBackground?: boolean;\n\n /**\n * Style for the label of the header item.\n */\n style?: StyleProp<BasicTextStyle>;\n\n /**\n * Tint color for the button icon and text.\n */\n tintColor?: ColorValue;\n\n /**\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/style-swift.enum) for more information.\n *\n * @default 'plain'\n */\n variant?: 'plain' | 'done' | 'prominent';\n}\n\n// As noted in https://sebvidal.com/blog/whats-new-in-uikit-26/?utm_source=chatgpt.com#:~:text=It%27s%20worth%20noting%20that%2C%20at%20the%20time%20of%20writing%2C%20bar%20button%20badges%20are%20only%20supported%20in%20navigation%20bars%20%2D%20not%20tool%20bars.\n// currently badges are not supported in toolbars, and only in navigation bars.\n// Therefore, there is no badge support in ToolbarButton\n/**\n * A button component for use in the toolbar.\n * It should only be used as a child of `Toolbar`.\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Button icon=\"magnifyingglass\" tintColor={Color.ios.placeholderText} />\n * <Toolbar.Button>Text Button</Toolbar.Button>\n * <Toolbar.Button hidden={!isSearchFocused} icon=\"xmark\" onPress={handleClear} />\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarButton = (props: ToolbarButtonProps) => {\n const id = useId();\n const areChildrenString = typeof props.children === 'string';\n const label = areChildrenString\n ? (props.children as string)\n : getFirstChildOfType(props.children, Label)?.props.children;\n const iconComponent =\n !props.icon && !areChildrenString ? getFirstChildOfType(props.children, Icon) : undefined;\n const icon =\n props.icon ??\n (iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);\n const sf = typeof icon === 'string' ? icon : undefined;\n return (\n <RouterToolbarItem\n accessibilityHint={props.accessibilityHint}\n accessibilityLabel={props.accessibilityLabel}\n barButtonItemStyle={props.variant === 'done' ? 'prominent' : props.variant}\n disabled={props.disabled}\n hidden={props.hidden}\n hidesSharedBackground={props.hidesSharedBackground}\n identifier={id}\n image={props.image}\n onSelected={props.onPress}\n possibleTitles={props.possibleTitles}\n selected={props.selected}\n sharesBackground={!props.separateBackground}\n systemImageName={sf}\n title={label}\n tintColor={props.tintColor}\n titleStyle={StyleSheet.flatten(props.style)}\n />\n );\n};\n\nexport type ToolbarSpacerProps = {\n /**\n * Whether to hide the shared background when `sharesBackground` is enabled.\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 spacer should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether the spacer shares the background with adjacent toolbar items.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground) for more information.\n *\n * @platform iOS 26+\n * @default false\n */\n sharesBackground?: boolean;\n /**\n * By default, the spacer is flexible and expands to fill available space.\n * If a width is provided, it creates a [fixed-width spacer](https://developer.apple.com/documentation/uikit/uibarbuttonitem/fixedspace(_:)).\n */\n width?: number;\n};\n\n/**\n * A spacer component for the toolbar.\n * Without a width, it creates a flexible spacer that expands to fill available space.\n * With a width, it creates a fixed-width spacer.\n * It should only be used as a child of `Toolbar`.\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Spacer />\n * <Toolbar.Button icon=\"magnifyingglass\" />\n * <Toolbar.Spacer width={20} />\n * <Toolbar.Button icon=\"mic\" />\n * <Toolbar.Spacer />\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarSpacer = (props: ToolbarSpacerProps) => {\n const id = useId();\n return (\n <RouterToolbarItem\n hidesSharedBackground={props.hidesSharedBackground}\n hidden={props.hidden}\n identifier={id}\n sharesBackground={props.sharesBackground}\n type={props.width ? 'fixedSpacer' : 'fluidSpacer'}\n width={props.width}\n />\n );\n};\n\nexport interface ToolbarSearchBarPreferredSlotProps {\n /**\n * Whether to hide the shared background when `sharesBackground` is enabled.\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 search bar placed in the toolbar should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether the search bar shares the background with adjacent toolbar items.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground) for more information.\n *\n * @platform iOS 26+\n * @default false\n */\n sharesBackground?: boolean;\n}\n\n/**\n * Declares the position of a search bar within the toolbar.\n * It should only be used as a child of `Toolbar`.\n *\n * > **Note**: On iOS 26+, this component specifies where in the toolbar the search bar\n * > (configured via `Stack.SearchBar`) should appear. On iOS 18 and earlier, the search bar\n * > will be shown in the header instead.\n *\n * > **Important**: You must use `Stack.SearchBar` to configure and display the actual\n * > search bar. This component only declares its position in the toolbar.\n *\n * @example\n * ```tsx\n * <Stack.SearchBar placeholder=\"Search...\" />\n * <Toolbar>\n * <Toolbar.SearchBarPreferredSlot />\n * <Toolbar.Spacer />\n * <Toolbar.Button icon=\"mic\" />\n * </Toolbar>\n * ```\n *\n * @platform ios 26+\n */\nexport const ToolbarSearchBarPreferredSlot = ({\n hidesSharedBackground,\n hidden,\n sharesBackground,\n}: ToolbarSearchBarPreferredSlotProps) => {\n const id = useId();\n if (process.env.EXPO_OS !== 'ios' || parseInt(String(Platform.Version).split('.')[0], 10) < 26) {\n return null;\n }\n if (hidden) {\n return null;\n }\n return (\n <RouterToolbarItem\n hidesSharedBackground={hidesSharedBackground}\n identifier={id}\n sharesBackground={sharesBackground}\n type=\"searchBar\"\n />\n );\n};\n\n/**\n * Props for the ToolbarView component.\n *\n * @platform ios\n */\nexport interface ToolbarViewProps {\n /**\n * React elements to render inside the toolbar view.\n */\n children: React.ReactNode;\n /**\n * Whether the view should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether to hide the shared background when `sharesBackground` is enabled.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground) for more information.\n *\n * @platform iOS 18+\n */\n hidesSharedBackground?: boolean;\n /**\n * Whether to separate the background of this item from other header items.\n *\n * This prop reverses the native behavior of `sharesBackground`.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground) for more information.\n *\n * @default false\n *\n * @platform iOS 26+\n */\n separateBackground?: boolean;\n}\n\n/**\n * A custom view component for the toolbar that can contain any React elements.\n * Useful for embedding custom components.\n * It should only be used as a child of `Toolbar`.\n *\n * The items within the view will be absolutely positioned, so flexbox styles will not work as expected.\n *\n * @example\n * ```tsx\n * <Toolbar>\n * <Toolbar.Spacer />\n * <Toolbar.View>\n * <TextInput\n * placeholder=\"Search\"\n * placeholderTextColor={Color.ios.placeholderText}\n * />\n * </Toolbar.View>\n * <Toolbar.View separateBackground>\n * <Pressable style={{ width: 32, height: 32 }} onPress={handlePress}>\n * <SymbolView name=\"plus\" size={22} />\n * </Pressable>\n * </Toolbar.View>\n * </Toolbar>\n * ```\n *\n * @platform ios\n */\nexport const ToolbarView = ({\n children,\n hidden,\n hidesSharedBackground,\n separateBackground,\n}: ToolbarViewProps) => {\n const id = useId();\n return (\n <RouterToolbarItem\n hidesSharedBackground={hidesSharedBackground}\n hidden={hidden}\n identifier={id}\n sharesBackground={!separateBackground}>\n {children}\n </RouterToolbarItem>\n );\n};\n\nexport interface ToolbarProps {\n children?: React.ReactNode;\n}\n\nexport const ToolbarHost = (props: ToolbarProps) => {\n // TODO: Replace InternalLinkPreviewContext with a more generic context\n return (\n <InternalLinkPreviewContext value={{ isVisible: false, href: '' }}>\n <RouterToolbarHost {...props} />\n </InternalLinkPreviewContext>\n );\n};\n"]}
|
package/build/toolbar/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolbarMenu, ToolbarMenuAction, ToolbarButton, ToolbarSpacer, ToolbarView } from './elements';
|
|
1
|
+
import { ToolbarMenu, ToolbarMenuAction, ToolbarButton, ToolbarSpacer, ToolbarSearchBarPreferredSlot, ToolbarView } from './elements';
|
|
2
2
|
/**
|
|
3
3
|
* A component that provides a [bottom toolbar](https://developer.apple.com/design/human-interface-guidelines/toolbars).
|
|
4
4
|
*
|
|
@@ -13,8 +13,8 @@ import { ToolbarMenu, ToolbarMenuAction, ToolbarButton, ToolbarSpacer, ToolbarVi
|
|
|
13
13
|
* <Toolbar>
|
|
14
14
|
* <Toolbar.Spacer />
|
|
15
15
|
* <Toolbar.Button icon="magnifyingglass" tintColor={Color.ios.placeholderText} />
|
|
16
|
-
* <Toolbar.View
|
|
17
|
-
* <TextInput placeholder="Search" />
|
|
16
|
+
* <Toolbar.View>
|
|
17
|
+
* <TextInput style={{ width: 200 }} placeholder="Search" />
|
|
18
18
|
* </Toolbar.View>
|
|
19
19
|
* <Toolbar.Menu icon="ellipsis">
|
|
20
20
|
* <Toolbar.MenuAction icon="mail" title="Send email" onPress={() => {}} />
|
|
@@ -34,8 +34,9 @@ export declare const Toolbar: ((props: import("./elements").ToolbarProps) => imp
|
|
|
34
34
|
MenuAction: typeof import("..").LinkMenuAction;
|
|
35
35
|
Button: (props: import("./elements").ToolbarButtonProps) => import("react").JSX.Element;
|
|
36
36
|
Spacer: (props: import("./elements").ToolbarSpacerProps) => import("react").JSX.Element;
|
|
37
|
+
SearchBarPreferredSlot: ({ hidesSharedBackground, hidden, sharesBackground, }: import("./elements").ToolbarSearchBarPreferredSlotProps) => import("react").JSX.Element | null;
|
|
37
38
|
View: ({ children, hidden, hidesSharedBackground, separateBackground, }: import("./elements").ToolbarViewProps) => import("react").JSX.Element;
|
|
38
39
|
};
|
|
39
|
-
export { ToolbarMenu, ToolbarMenuAction, ToolbarButton, ToolbarSpacer, ToolbarView };
|
|
40
|
-
export type { ToolbarProps, ToolbarMenuProps, ToolbarMenuActionProps, ToolbarButtonProps, ToolbarSpacerProps, ToolbarViewProps as ToolbarCustomViewProps, } from './elements';
|
|
40
|
+
export { ToolbarMenu, ToolbarMenuAction, ToolbarButton, ToolbarSpacer, ToolbarSearchBarPreferredSlot, ToolbarView, };
|
|
41
|
+
export type { ToolbarProps, ToolbarMenuProps, ToolbarMenuActionProps, ToolbarButtonProps, ToolbarSpacerProps, ToolbarSearchBarPreferredSlotProps, ToolbarViewProps as ToolbarCustomViewProps, } from './elements';
|
|
41
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,6BAA6B,EAC7B,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,OAAO;;;;;;;CAOlB,CAAC;AAEH,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,6BAA6B,EAC7B,WAAW,GACZ,CAAC;AAEF,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,kCAAkC,EAClC,gBAAgB,IAAI,sBAAsB,GAC3C,MAAM,YAAY,CAAC"}
|
package/build/toolbar/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToolbarView = exports.ToolbarSpacer = exports.ToolbarButton = exports.ToolbarMenuAction = exports.ToolbarMenu = exports.Toolbar = void 0;
|
|
3
|
+
exports.ToolbarView = exports.ToolbarSearchBarPreferredSlot = exports.ToolbarSpacer = exports.ToolbarButton = exports.ToolbarMenuAction = exports.ToolbarMenu = exports.Toolbar = void 0;
|
|
4
4
|
const elements_1 = require("./elements");
|
|
5
5
|
Object.defineProperty(exports, "ToolbarMenu", { enumerable: true, get: function () { return elements_1.ToolbarMenu; } });
|
|
6
6
|
Object.defineProperty(exports, "ToolbarMenuAction", { enumerable: true, get: function () { return elements_1.ToolbarMenuAction; } });
|
|
7
7
|
Object.defineProperty(exports, "ToolbarButton", { enumerable: true, get: function () { return elements_1.ToolbarButton; } });
|
|
8
8
|
Object.defineProperty(exports, "ToolbarSpacer", { enumerable: true, get: function () { return elements_1.ToolbarSpacer; } });
|
|
9
|
+
Object.defineProperty(exports, "ToolbarSearchBarPreferredSlot", { enumerable: true, get: function () { return elements_1.ToolbarSearchBarPreferredSlot; } });
|
|
9
10
|
Object.defineProperty(exports, "ToolbarView", { enumerable: true, get: function () { return elements_1.ToolbarView; } });
|
|
10
11
|
/**
|
|
11
12
|
* A component that provides a [bottom toolbar](https://developer.apple.com/design/human-interface-guidelines/toolbars).
|
|
@@ -21,8 +22,8 @@ Object.defineProperty(exports, "ToolbarView", { enumerable: true, get: function
|
|
|
21
22
|
* <Toolbar>
|
|
22
23
|
* <Toolbar.Spacer />
|
|
23
24
|
* <Toolbar.Button icon="magnifyingglass" tintColor={Color.ios.placeholderText} />
|
|
24
|
-
* <Toolbar.View
|
|
25
|
-
* <TextInput placeholder="Search" />
|
|
25
|
+
* <Toolbar.View>
|
|
26
|
+
* <TextInput style={{ width: 200 }} placeholder="Search" />
|
|
26
27
|
* </Toolbar.View>
|
|
27
28
|
* <Toolbar.Menu icon="ellipsis">
|
|
28
29
|
* <Toolbar.MenuAction icon="mail" title="Send email" onPress={() => {}} />
|
|
@@ -42,6 +43,7 @@ exports.Toolbar = Object.assign(elements_1.ToolbarHost, {
|
|
|
42
43
|
MenuAction: elements_1.ToolbarMenuAction,
|
|
43
44
|
Button: elements_1.ToolbarButton,
|
|
44
45
|
Spacer: elements_1.ToolbarSpacer,
|
|
46
|
+
SearchBarPreferredSlot: elements_1.ToolbarSearchBarPreferredSlot,
|
|
45
47
|
View: elements_1.ToolbarView,
|
|
46
48
|
});
|
|
47
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":";;;AAAA,yCAQoB;AA0ClB,4FAhDA,sBAAW,OAgDA;AACX,kGAhDA,4BAAiB,OAgDA;AACjB,8FAhDA,wBAAa,OAgDA;AACb,8FAhDA,wBAAa,OAgDA;AACb,8GAhDA,wCAA6B,OAgDA;AAC7B,4FAhDA,sBAAW,OAgDA;AA7Cb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACU,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,sBAAW,EAAE;IAChD,IAAI,EAAE,sBAAW;IACjB,UAAU,EAAE,4BAAiB;IAC7B,MAAM,EAAE,wBAAa;IACrB,MAAM,EAAE,wBAAa;IACrB,sBAAsB,EAAE,wCAA6B;IACrD,IAAI,EAAE,sBAAW;CAClB,CAAC,CAAC","sourcesContent":["import {\n ToolbarHost,\n ToolbarMenu,\n ToolbarMenuAction,\n ToolbarButton,\n ToolbarSpacer,\n ToolbarSearchBarPreferredSlot,\n ToolbarView,\n} from './elements';\n\n/**\n * A component that provides a [bottom toolbar](https://developer.apple.com/design/human-interface-guidelines/toolbars).\n *\n * @example\n * ```tsx\n * import { Toolbar } from \"expo-router\";\n *\n * export default function MyScreen() {\n * return (\n * <>\n * <YourScreenContent />\n * <Toolbar>\n * <Toolbar.Spacer />\n * <Toolbar.Button icon=\"magnifyingglass\" tintColor={Color.ios.placeholderText} />\n * <Toolbar.View>\n * <TextInput style={{ width: 200 }} placeholder=\"Search\" />\n * </Toolbar.View>\n * <Toolbar.Menu icon=\"ellipsis\">\n * <Toolbar.MenuAction icon=\"mail\" title=\"Send email\" onPress={() => {}} />\n * <Toolbar.MenuAction icon=\"trash\" title=\"Delete\" destructive onPress={() => {}} />\n * </Toolbar.Menu>\n * <Toolbar.Spacer />\n * </Toolbar>\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const Toolbar = Object.assign(ToolbarHost, {\n Menu: ToolbarMenu,\n MenuAction: ToolbarMenuAction,\n Button: ToolbarButton,\n Spacer: ToolbarSpacer,\n SearchBarPreferredSlot: ToolbarSearchBarPreferredSlot,\n View: ToolbarView,\n});\n\nexport {\n ToolbarMenu,\n ToolbarMenuAction,\n ToolbarButton,\n ToolbarSpacer,\n ToolbarSearchBarPreferredSlot,\n ToolbarView,\n};\n\nexport type {\n ToolbarProps,\n ToolbarMenuProps,\n ToolbarMenuActionProps,\n ToolbarButtonProps,\n ToolbarSpacerProps,\n ToolbarSearchBarPreferredSlotProps,\n ToolbarViewProps as ToolbarCustomViewProps,\n} from './elements';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.ios.d.ts","sourceRoot":"","sources":["../../src/toolbar/native.ios.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAMrF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAc9D;
|
|
1
|
+
{"version":3,"file":"native.ios.d.ts","sourceRoot":"","sources":["../../src/toolbar/native.ios.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAMrF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAc9D;AAmBD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAU9D"}
|
|
@@ -16,6 +16,8 @@ function RouterToolbarHost(props) {
|
|
|
16
16
|
}
|
|
17
17
|
const RouterToolbarItemView = (0, expo_1.requireNativeView)('ExpoRouterToolbarModule', 'RouterToolbarItemView');
|
|
18
18
|
function RouterToolbarItem(props) {
|
|
19
|
-
|
|
19
|
+
// Needed to pass shared object ID to native side
|
|
20
|
+
const imageObjectId = props.image?.__expo_shared_object_id__;
|
|
21
|
+
return <RouterToolbarItemView {...props} image={imageObjectId}/>;
|
|
20
22
|
}
|
|
21
23
|
//# sourceMappingURL=native.ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.ios.js","sourceRoot":"","sources":["../../src/toolbar/native.ios.tsx"],"names":[],"mappings":";;AAUA,8CAcC;
|
|
1
|
+
{"version":3,"file":"native.ios.js","sourceRoot":"","sources":["../../src/toolbar/native.ios.tsx"],"names":[],"mappings":";;AAUA,8CAcC;AAmBD,8CAUC;AArDD,+BAAyC;AAMzC,MAAM,qBAAqB,GAAmC,IAAA,wBAAiB,EAC7E,yBAAyB,EACzB,uBAAuB,CACxB,CAAC;AACF,SAAgB,iBAAiB,CAAC,KAA6B;IAC7D,OAAO,CACL,CAAC,qBAAqB,CACpB,IAAI,KAAK,CAAC,CACV,KAAK,CAAC,CAAC;YACL,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,eAAe,EAAE,aAAa;SAC/B,CAAC,EACF,CACH,CAAC;AACJ,CAAC;AAED,MAAM,qBAAqB,GAevB,IAAA,wBAAiB,EAAC,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AAE1E,SAAgB,iBAAiB,CAAC,KAA6B;IAC7D,iDAAiD;IACjD,MAAM,aAAa,GACjB,KAAK,CAAC,KAKP,EAAE,yBAAyB,CAAC;IAC7B,OAAO,CAAC,qBAAqB,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,EAAG,CAAC;AACpE,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport { type ColorValue, type TextStyle, type ViewProps } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport type { RouterToolbarHostProps, RouterToolbarItemProps } from './native.types';\n\nconst RouterToolbarHostView: React.ComponentType<ViewProps> = requireNativeView(\n 'ExpoRouterToolbarModule',\n 'RouterToolbarHostView'\n);\nexport function RouterToolbarHost(props: RouterToolbarHostProps) {\n return (\n <RouterToolbarHostView\n {...props}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: 1,\n height: 1,\n backgroundColor: 'transparent',\n }}\n />\n );\n}\n\nconst RouterToolbarItemView: React.ComponentType<\n ViewProps & {\n identifier: string;\n title?: string;\n systemImageName?: SFSymbol;\n image?: number;\n type?: string;\n titleStyle?: {\n fontFamily?: string;\n fontSize?: number;\n fontWeight?: TextStyle['fontWeight'];\n color?: ColorValue;\n };\n tintColor?: ColorValue;\n }\n> = requireNativeView('ExpoRouterToolbarModule', 'RouterToolbarItemView');\n\nexport function RouterToolbarItem(props: RouterToolbarItemProps) {\n // Needed to pass shared object ID to native side\n const imageObjectId = (\n props.image as\n | {\n __expo_shared_object_id__: number;\n }\n | undefined\n )?.__expo_shared_object_id__;\n return <RouterToolbarItemView {...props} image={imageObjectId} />;\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ImageRef } from 'expo-image';
|
|
1
2
|
import type { ColorValue } from 'react-native';
|
|
2
3
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
3
4
|
import type { BasicTextStyle } from '../utils/font';
|
|
@@ -9,7 +10,22 @@ export interface RouterToolbarItemProps {
|
|
|
9
10
|
identifier: string;
|
|
10
11
|
title?: string;
|
|
11
12
|
systemImageName?: SFSymbol;
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Custom image loaded using expo-image's `useImage` hook.
|
|
15
|
+
* Takes priority over `systemImageName` when both are provided.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const customIcon = useImage('https://example.com/icon.png', {
|
|
20
|
+
* maxWidth: 44,
|
|
21
|
+
* maxHeight: 44,
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* <Toolbar.Item image={customIcon} title="Custom" />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
image?: ImageRef | null;
|
|
28
|
+
type?: 'normal' | 'fixedSpacer' | 'fluidSpacer' | 'searchBar';
|
|
13
29
|
tintColor?: ColorValue;
|
|
14
30
|
hidesSharedBackground?: boolean;
|
|
15
31
|
sharesBackground?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.types.d.ts","sourceRoot":"","sources":["../../src/toolbar/native.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM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EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B,kBAAkB,CAAC,EAAE;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,UAAU,CAAC;KAC9B,GAAG,cAAc,CAAC;IACnB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.types.js","sourceRoot":"","sources":["../../src/toolbar/native.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ColorValue } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport type { BasicTextStyle } from '../utils/font';\n\nexport interface RouterToolbarHostProps {\n children?: React.ReactNode;\n}\n\nexport interface RouterToolbarItemProps {\n children?: React.ReactNode;\n identifier: string;\n title?: string;\n systemImageName?: SFSymbol;\n type?: 'normal' | 'fixedSpacer' | 'fluidSpacer';\n tintColor?: ColorValue;\n hidesSharedBackground?: boolean;\n sharesBackground?: boolean;\n barButtonItemStyle?: 'plain' | 'prominent';\n width?: number;\n hidden?: boolean;\n selected?: boolean;\n possibleTitles?: string[];\n // Right now this does not seem to work\n badgeConfiguration?: {\n value?: string;\n backgroundColor?: ColorValue;\n } & BasicTextStyle;\n titleStyle?: BasicTextStyle;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n disabled?: boolean;\n onSelected?: () => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"native.types.js","sourceRoot":"","sources":["../../src/toolbar/native.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ImageRef } from 'expo-image';\nimport type { ColorValue } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport type { BasicTextStyle } from '../utils/font';\n\nexport interface RouterToolbarHostProps {\n children?: React.ReactNode;\n}\n\nexport interface RouterToolbarItemProps {\n children?: React.ReactNode;\n identifier: string;\n title?: string;\n systemImageName?: SFSymbol;\n /**\n * Custom image loaded using expo-image's `useImage` hook.\n * Takes priority over `systemImageName` when both are provided.\n *\n * @example\n * ```tsx\n * const customIcon = useImage('https://example.com/icon.png', {\n * maxWidth: 44,\n * maxHeight: 44,\n * });\n *\n * <Toolbar.Item image={customIcon} title=\"Custom\" />\n * ```\n */\n image?: ImageRef | null;\n type?: 'normal' | 'fixedSpacer' | 'fluidSpacer' | 'searchBar';\n tintColor?: ColorValue;\n hidesSharedBackground?: boolean;\n sharesBackground?: boolean;\n barButtonItemStyle?: 'plain' | 'prominent';\n width?: number;\n hidden?: boolean;\n selected?: boolean;\n possibleTitles?: string[];\n // Right now this does not seem to work\n badgeConfiguration?: {\n value?: string;\n backgroundColor?: ColorValue;\n } & BasicTextStyle;\n titleStyle?: BasicTextStyle;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n disabled?: boolean;\n onSelected?: () => void;\n}\n"]}
|
package/build/ui/Slot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slot.d.ts","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"Slot.d.ts","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":"AACA,OAAc,EAGZ,KAAK,yBAAyB,EAC9B,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAoC1D,MAAM,WAAW,IAAI,CAAC,KAAK,GAAG,SAAS,EAAE,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,CACjE,SAAQ,yBAAyB,CAAC,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;CAAG;AAElE,eAAO,MAAM,IAAI,EAAE,IAA8C,CAAC"}
|
package/build/ui/Slot.js
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.Slot = void 0;
|
|
4
37
|
const react_slot_1 = require("@radix-ui/react-slot");
|
|
5
|
-
const react_1 = require("react");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
6
39
|
const react_native_1 = require("react-native");
|
|
7
40
|
/**
|
|
8
41
|
* RadixUI has special logic to handle the merging of `style` and `className` props.
|
|
@@ -20,6 +53,16 @@ const react_native_1 = require("react-native");
|
|
|
20
53
|
function ShimSlotForReactNative(Component) {
|
|
21
54
|
return (0, react_1.forwardRef)(function RNSlotHOC({ style, ...props }, ref) {
|
|
22
55
|
style = (0, react_1.useMemo)(() => react_native_1.StyleSheet.flatten(style), [style]);
|
|
56
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
57
|
+
if (react_1.default.isValidElement(props.children)) {
|
|
58
|
+
if (typeof props.children.props === 'object' &&
|
|
59
|
+
props.children.props !== null &&
|
|
60
|
+
'style' in props.children.props &&
|
|
61
|
+
Array.isArray(props.children.props.style)) {
|
|
62
|
+
throw new Error(`[expo-router]: You are passing an array of styles to a child of <Slot>. Consider flattening the styles with StyleSheet.flatten before passing them to the child component.`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
23
66
|
return <Component ref={ref} {...props} style={style}/>;
|
|
24
67
|
});
|
|
25
68
|
}
|
package/build/ui/Slot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slot.js","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Slot.js","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuD;AACvD,+CAMe;AACf,+CAA0D;AAE1D;;;;;;;;;;;;GAYG;AACH,SAAS,sBAAsB,CAAC,SAAyB;IACvD,OAAO,IAAA,kBAAU,EAAC,SAAS,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;QAC3D,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,yBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1D,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,IAAI,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACzC,IACE,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,KAAK,QAAQ;oBACxC,KAAK,CAAC,QAAQ,CAAC,KAAK,KAAK,IAAI;oBAC7B,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK;oBAC/B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EACzC,CAAC;oBACD,MAAM,IAAI,KAAK,CACb,4KAA4K,CAC7K,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC;AAKY,QAAA,IAAI,GAAS,sBAAsB,CAAC,iBAAO,CAAS,CAAC","sourcesContent":["import { Slot as RUISlot } from '@radix-ui/react-slot';\nimport React, {\n forwardRef,\n useMemo,\n type ForwardRefExoticComponent,\n type Component,\n type RefAttributes,\n} from 'react';\nimport { StyleSheet, type ViewProps } from 'react-native';\n\n/**\n * RadixUI has special logic to handle the merging of `style` and `className` props.\n * On the web styles are not allowed so Radix does not handle this scenario.\n * This could be fixed upstream (PR open), but it may not as RN is not their target\n * platform.\n *\n * This shim calls `StyleSheet.flatten` on the styles before we render the <Slot />\n *\n * @see https://github.com/expo/expo/issues/31352\n * @see https://github.com/radix-ui/primitives/issues/3107\n * @param Component\n * @returns\n */\nfunction ShimSlotForReactNative(Component: typeof RUISlot): typeof RUISlot {\n return forwardRef(function RNSlotHOC({ style, ...props }, ref) {\n style = useMemo(() => StyleSheet.flatten(style), [style]);\n if (process.env.NODE_ENV !== 'production') {\n if (React.isValidElement(props.children)) {\n if (\n typeof props.children.props === 'object' &&\n props.children.props !== null &&\n 'style' in props.children.props &&\n Array.isArray(props.children.props.style)\n ) {\n throw new Error(\n `[expo-router]: You are passing an array of styles to a child of <Slot>. Consider flattening the styles with StyleSheet.flatten before passing them to the child component.`\n );\n }\n }\n }\n return <Component ref={ref} {...props} style={style} />;\n });\n}\n\nexport interface Slot<Props = ViewProps, Ref = Component<ViewProps>>\n extends ForwardRefExoticComponent<Props & RefAttributes<Ref>> {}\n\nexport const Slot: Slot = ShimSlotForReactNative(RUISlot) as Slot;\n"]}
|
package/build/useScreens.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { BottomTabNavigationEventMap } from '@react-navigation/bottom-tabs';
|
|
2
|
+
import { type EventMapBase, type NavigationProp, type NavigationState, type ParamListBase, type RouteProp, type ScreenListeners } from '@react-navigation/native';
|
|
3
|
+
import type { NativeStackNavigationEventMap } from '@react-navigation/native-stack';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { RouteNode } from './Route';
|
|
4
6
|
import { UnknownOutputParams } from './types';
|
|
@@ -31,7 +33,12 @@ export type SingularOptions = boolean | ((name: string, params: UnknownOutputPar
|
|
|
31
33
|
export declare function useSortedScreens(order: ScreenProps[], protectedScreens: Set<string>, useOnlyUserDefinedScreens?: boolean): React.ReactNode[];
|
|
32
34
|
/** Wrap the component with various enhancements and add access to child routes. */
|
|
33
35
|
export declare function getQualifiedRouteComponent(value: RouteNode): React.ComponentType<any> | {
|
|
34
|
-
({ route, navigation, ...props }:
|
|
36
|
+
({ route, navigation, ...props }: {
|
|
37
|
+
route?: RouteProp<ParamListBase, string>;
|
|
38
|
+
navigation: Omit<NavigationProp<ParamListBase, string, undefined, NavigationState, object, NativeStackNavigationEventMap | BottomTabNavigationEventMap>, "getState"> & {
|
|
39
|
+
getState(): NavigationState | undefined;
|
|
40
|
+
};
|
|
41
|
+
}): React.JSX.Element;
|
|
35
42
|
displayName: string;
|
|
36
43
|
};
|
|
37
44
|
export declare function screenOptionsFactory(route: RouteNode, options?: ScreenProps['options']): ScreenProps['options'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreens.d.ts","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"useScreens.d.ts","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,KAA6B,MAAM,OAAO,CAAC;AAElD,OAAO,EAAsB,SAAS,EAAuC,MAAM,SAAS,CAAC;AAa7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAK9C,MAAM,MAAM,WAAW,CACrB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,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,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS;sCAiCtD;QACD,KAAK,CAAC,EAAE,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACzC,UAAU,EAAE,IAAI,CACd,cAAc,CACZ,aAAa,EACb,MAAM,EACN,SAAS,EACT,eAAe,EACf,MAAM,EACN,6BAA6B,GAAG,2BAA2B,CAC5D,EACD,UAAU,CACX,GAAG;YACF,QAAQ,IAAI,eAAe,GAAG,SAAS,CAAC;SACzC,CAAC;KACH;;EAoEF;AAgED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,GAC/B,WAAW,CAAC,SAAS,CAAC,CAqBxB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,EAChB,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,GAAE,OAAO,CAAC,WAAW,CAAM,qBAYxD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,UAa5E"}
|
package/build/useScreens.js
CHANGED
|
@@ -199,13 +199,13 @@ function getQualifiedRouteComponent(value) {
|
|
|
199
199
|
const store = (0, storeContext_1.useExpoRouterStore)();
|
|
200
200
|
if (isFocused) {
|
|
201
201
|
const state = navigation.getState();
|
|
202
|
-
const isLeaf = !('state' in state.routes[state.index]);
|
|
202
|
+
const isLeaf = !(state && 'state' in state.routes[state.index]);
|
|
203
203
|
if (isLeaf && stateForPath)
|
|
204
204
|
store.setFocusedState(stateForPath);
|
|
205
205
|
}
|
|
206
206
|
(0, react_1.useEffect)(() => navigation.addListener('focus', () => {
|
|
207
207
|
const state = navigation.getState();
|
|
208
|
-
const isLeaf = !('state' in state.routes[state.index]);
|
|
208
|
+
const isLeaf = !(state && 'state' in state.routes[state.index]);
|
|
209
209
|
// Because setFocusedState caches the route info, this call will only trigger rerenders
|
|
210
210
|
// if the component itself didn’t rerender and the route info changed.
|
|
211
211
|
// Otherwise, the update from the `if` above will handle it,
|
|
@@ -224,10 +224,12 @@ function getQualifiedRouteComponent(value) {
|
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
226
|
}, [navigation]);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
<
|
|
227
|
+
const isRouteType = value.type === 'route';
|
|
228
|
+
const hasRouteKey = !!route?.key;
|
|
229
|
+
return (<Route_1.Route node={value} params={route?.params}>
|
|
230
|
+
{isRouteType && hasRouteKey && navigationEvents_1.unstable_navigationEvents.hasAnyListener() && (<AnalyticsListeners navigation={navigation} screenId={route.key}/>)}
|
|
230
231
|
<zoom_transition_context_providers_1.ZoomTransitionTargetContextProvider route={route}>
|
|
232
|
+
<ZoomTransitionEnabler_1.ZoomTransitionEnabler route={route}/>
|
|
231
233
|
<react_1.default.Suspense fallback={<SuspenseFallback_1.SuspenseFallback route={value}/>}>
|
|
232
234
|
<ScreenComponent {...props}
|
|
233
235
|
// Expose the template segment path, e.g. `(home)`, `[foo]`, `index`
|