expo-router 7.0.0-canary-20251216-6e1f9a7 → 7.0.0-canary-20251223-b83b31e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +2 -2
- package/build/color/index.d.ts +44 -0
- package/build/color/index.d.ts.map +1 -1
- package/build/color/index.js +69 -5
- package/build/color/index.js.map +1 -1
- package/build/exports.d.ts +1 -0
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js +3 -1
- package/build/exports.js.map +1 -1
- package/build/layouts/StackClient.d.ts +3 -3
- package/build/layouts/stack-utils/StackHeaderButton.d.ts +77 -2
- package/build/layouts/stack-utils/StackHeaderButton.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderButton.js +3 -0
- package/build/layouts/stack-utils/StackHeaderButton.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderComponent.d.ts +84 -1
- package/build/layouts/stack-utils/StackHeaderComponent.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderComponent.js +54 -1
- package/build/layouts/stack-utils/StackHeaderComponent.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderLeftRight.d.ts +107 -3
- package/build/layouts/stack-utils/StackHeaderLeftRight.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderLeftRight.js +108 -13
- package/build/layouts/stack-utils/StackHeaderLeftRight.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderMenu.d.ts +83 -7
- package/build/layouts/stack-utils/StackHeaderMenu.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderMenu.js +14 -4
- package/build/layouts/stack-utils/StackHeaderMenu.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderSpacer.d.ts +7 -1
- package/build/layouts/stack-utils/StackHeaderSpacer.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderSpacer.js +5 -2
- package/build/layouts/stack-utils/StackHeaderSpacer.js.map +1 -1
- package/build/layouts/stack-utils/{StackHeaderItem.d.ts → StackHeaderView.d.ts} +18 -5
- package/build/layouts/stack-utils/StackHeaderView.d.ts.map +1 -0
- package/build/layouts/stack-utils/{StackHeaderItem.js → StackHeaderView.js} +14 -10
- package/build/layouts/stack-utils/StackHeaderView.js.map +1 -0
- package/build/layouts/stack-utils/index.d.ts +5 -5
- package/build/layouts/stack-utils/index.d.ts.map +1 -1
- package/build/layouts/stack-utils/index.js +4 -4
- package/build/layouts/stack-utils/index.js.map +1 -1
- package/build/layouts/stack-utils/shared.d.ts +4 -42
- package/build/layouts/stack-utils/shared.d.ts.map +1 -1
- package/build/layouts/stack-utils/shared.js +3 -22
- package/build/layouts/stack-utils/shared.js.map +1 -1
- package/build/link/ExpoLink.d.ts.map +1 -1
- package/build/link/ExpoLink.js +1 -8
- package/build/link/ExpoLink.js.map +1 -1
- package/build/link/elements.d.ts +36 -13
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +14 -5
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +12 -1
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js.map +1 -1
- package/build/navigationEvents/index.d.ts +36 -0
- package/build/navigationEvents/index.d.ts.map +1 -0
- package/build/navigationEvents/index.js +53 -0
- package/build/navigationEvents/index.js.map +1 -0
- package/build/toolbar/elements.d.ts +325 -16
- package/build/toolbar/elements.d.ts.map +1 -1
- package/build/toolbar/elements.js +130 -12
- package/build/toolbar/elements.js.map +1 -1
- package/build/toolbar/index.d.ts +38 -6
- package/build/toolbar/index.d.ts.map +1 -1
- package/build/toolbar/index.js +36 -1
- package/build/toolbar/index.js.map +1 -1
- package/build/toolbar/native.ios.d.ts.map +1 -1
- package/build/toolbar/native.ios.js.map +1 -1
- package/build/toolbar/native.types.d.ts +6 -5
- package/build/toolbar/native.types.d.ts.map +1 -1
- package/build/toolbar/native.types.js.map +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +50 -0
- package/build/useScreens.js.map +1 -1
- package/build/utils/font.d.ts +9 -0
- package/build/utils/font.d.ts.map +1 -0
- package/build/utils/font.js +20 -0
- package/build/utils/font.js.map +1 -0
- package/expo-module.config.json +1 -1
- package/ios/LinkPreview/LinkPreviewNativeActionView.swift +105 -24
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +35 -8
- package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +16 -20
- package/ios/LinkPreview/LinkPreviewNativePreviewView.swift +1 -8
- package/ios/LinkPreview/LinkPreviewNativeView.swift +48 -50
- package/ios/LinkPreview/LinkZoomTransition.swift +8 -10
- package/ios/RouterViewWithLogger.swift +5 -0
- package/ios/Toolbar/RouterFontUtils.swift +50 -0
- package/ios/Toolbar/RouterToolbarHostView.swift +41 -17
- package/ios/Toolbar/RouterToolbarItemView.swift +30 -13
- package/ios/Toolbar/RouterToolbarModule.swift +28 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar +0 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module} +17 -17
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
- package/package.json +10 -10
- package/build/layouts/stack-utils/StackHeaderItem.d.ts.map +0 -1
- package/build/layouts/stack-utils/StackHeaderItem.js.map +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar +0 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar.md5 → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar.sha1 → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar.sha256 → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar.sha512 → 7.0.0-canary-20251223-b83b31e/expo.modules.router-7.0.0-canary-20251223-b83b31e-sources.jar.sha512} +0 -0
|
@@ -1,28 +1,146 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ToolbarHost = exports.ToolbarView = exports.ToolbarSpacer = exports.ToolbarButton = exports.ToolbarMenuAction = exports.ToolbarMenu = void 0;
|
|
4
|
-
const non_secure_1 = require("nanoid/non-secure");
|
|
5
4
|
const react_1 = require("react");
|
|
6
5
|
const react_native_1 = require("react-native");
|
|
7
6
|
const native_1 = require("./native");
|
|
8
7
|
const InternalLinkPreviewContext_1 = require("../link/InternalLinkPreviewContext");
|
|
9
8
|
const elements_1 = require("../link/elements");
|
|
10
|
-
|
|
9
|
+
const native_2 = require("../link/preview/native");
|
|
10
|
+
const primitives_1 = require("../primitives");
|
|
11
|
+
const children_1 = require("../utils/children");
|
|
12
|
+
/**
|
|
13
|
+
* Adds a context menu for to a toolbar.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Toolbar>
|
|
18
|
+
* <Toolbar.Menu title="Options">
|
|
19
|
+
* <Toolbar.MenuAction title="Action 1" onPress={() => {}} />
|
|
20
|
+
* <Toolbar.MenuAction title="Action 2" onPress={() => {}} />
|
|
21
|
+
* </Toolbar.Menu>
|
|
22
|
+
* </Toolbar>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @platform ios
|
|
26
|
+
*/
|
|
27
|
+
const ToolbarMenu = ({ accessibilityHint, accessibilityLabel, separateBackground, hidesSharedBackground, palette, inline, hidden, title, destructive, children, icon, tintColor, variant, style, }) => {
|
|
28
|
+
const identifier = (0, react_1.useId)();
|
|
29
|
+
const validChildren = react_1.Children.toArray(children).filter((child) => (0, react_1.isValidElement)(child) && (child.type === exports.ToolbarMenuAction || child.type === exports.ToolbarMenu));
|
|
30
|
+
const label = (0, children_1.getFirstChildOfType)(children, primitives_1.Label);
|
|
31
|
+
const iconComponent = (0, children_1.getFirstChildOfType)(children, primitives_1.Icon);
|
|
32
|
+
const computedTitle = title ?? label?.props.children ?? '';
|
|
33
|
+
const computedIcon = icon ??
|
|
34
|
+
(iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);
|
|
35
|
+
const sf = typeof computedIcon === 'string' ? computedIcon : undefined;
|
|
36
|
+
const titleStyle = react_native_1.StyleSheet.flatten(style);
|
|
37
|
+
return (<native_2.NativeLinkPreviewAction sharesBackground={!separateBackground} hidesSharedBackground={hidesSharedBackground} hidden={hidden} icon={sf} destructive={destructive} accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint} displayAsPalette={palette} displayInline={inline} tintColor={tintColor} titleStyle={titleStyle} barButtonItemStyle={variant === 'done' ? 'prominent' : variant} title={computedTitle} onSelected={() => { }} children={validChildren} identifier={identifier}/>);
|
|
38
|
+
};
|
|
39
|
+
exports.ToolbarMenu = ToolbarMenu;
|
|
40
|
+
/**
|
|
41
|
+
* A single action item within a toolbar menu.
|
|
42
|
+
*
|
|
43
|
+
* For available props, see [`LinkMenuActionProps`](./router/#linkmenuactionprops).
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <Toolbar>
|
|
48
|
+
* <Toolbar.Menu title="Options">
|
|
49
|
+
* <Toolbar.MenuAction title="Action 1" onPress={() => {}} />
|
|
50
|
+
* <Toolbar.MenuAction title="Action 2" onPress={() => {}} />
|
|
51
|
+
* </Toolbar.Menu>
|
|
52
|
+
* </Toolbar>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @platform ios
|
|
56
|
+
*/
|
|
11
57
|
exports.ToolbarMenuAction = elements_1.LinkMenuAction;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
58
|
+
// 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.
|
|
59
|
+
// currently badges are not supported in toolbars, and only in navigation bars.
|
|
60
|
+
// Therefore, there is no badge support in ToolbarButton
|
|
61
|
+
/**
|
|
62
|
+
* A button component for use in the toolbar.
|
|
63
|
+
* It should only be used as a child of `Toolbar`.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <Toolbar>
|
|
68
|
+
* <Toolbar.Button icon="magnifyingglass" tintColor={Color.ios.placeholderText} />
|
|
69
|
+
* <Toolbar.Button>Text Button</Toolbar.Button>
|
|
70
|
+
* <Toolbar.Button hidden={!isSearchFocused} icon="xmark" onPress={handleClear} />
|
|
71
|
+
* </Toolbar>
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @platform ios
|
|
75
|
+
*/
|
|
76
|
+
const ToolbarButton = (props) => {
|
|
77
|
+
const id = (0, react_1.useId)();
|
|
78
|
+
const areChildrenString = typeof props.children === 'string';
|
|
79
|
+
const label = areChildrenString
|
|
80
|
+
? props.children
|
|
81
|
+
: (0, children_1.getFirstChildOfType)(props.children, primitives_1.Label)?.props.children;
|
|
82
|
+
const iconComponent = !props.icon && !areChildrenString ? (0, children_1.getFirstChildOfType)(props.children, primitives_1.Icon) : undefined;
|
|
83
|
+
const icon = props.icon ??
|
|
84
|
+
(iconComponent?.props && 'sf' in iconComponent.props ? iconComponent.props.sf : undefined);
|
|
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)}/>);
|
|
15
87
|
};
|
|
16
88
|
exports.ToolbarButton = ToolbarButton;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
89
|
+
/**
|
|
90
|
+
* A spacer component for the toolbar.
|
|
91
|
+
* Without a width, it creates a flexible spacer that expands to fill available space.
|
|
92
|
+
* With a width, it creates a fixed-width spacer.
|
|
93
|
+
* It should only be used as a child of `Toolbar`.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* <Toolbar>
|
|
98
|
+
* <Toolbar.Spacer />
|
|
99
|
+
* <Toolbar.Button icon="magnifyingglass" />
|
|
100
|
+
* <Toolbar.Spacer width={20} />
|
|
101
|
+
* <Toolbar.Button icon="mic" />
|
|
102
|
+
* <Toolbar.Spacer />
|
|
103
|
+
* </Toolbar>
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @platform ios
|
|
107
|
+
*/
|
|
108
|
+
const ToolbarSpacer = (props) => {
|
|
109
|
+
const id = (0, react_1.useId)();
|
|
110
|
+
return (<native_1.RouterToolbarItem hidesSharedBackground={props.hidesSharedBackground} hidden={props.hidden} identifier={id} sharesBackground={props.sharesBackground} type={props.width ? 'fixedSpacer' : 'fluidSpacer'} width={props.width}/>);
|
|
20
111
|
};
|
|
21
112
|
exports.ToolbarSpacer = ToolbarSpacer;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
113
|
+
/**
|
|
114
|
+
* A custom view component for the toolbar that can contain any React elements.
|
|
115
|
+
* Useful for embedding custom components.
|
|
116
|
+
* It should only be used as a child of `Toolbar`.
|
|
117
|
+
*
|
|
118
|
+
* The items within the view will be absolutely positioned, so flexbox styles will not work as expected.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```tsx
|
|
122
|
+
* <Toolbar>
|
|
123
|
+
* <Toolbar.Spacer />
|
|
124
|
+
* <Toolbar.View>
|
|
125
|
+
* <TextInput
|
|
126
|
+
* placeholder="Search"
|
|
127
|
+
* placeholderTextColor={Color.ios.placeholderText}
|
|
128
|
+
* />
|
|
129
|
+
* </Toolbar.View>
|
|
130
|
+
* <Toolbar.View separateBackground style={{ width: 32, height: 32 }}>
|
|
131
|
+
* <Pressable onPress={handlePress}>
|
|
132
|
+
* <SymbolView name="plus" size={22} />
|
|
133
|
+
* </Pressable>
|
|
134
|
+
* </Toolbar.View>
|
|
135
|
+
* </Toolbar>
|
|
136
|
+
* ```
|
|
137
|
+
*
|
|
138
|
+
* @platform ios
|
|
139
|
+
*/
|
|
140
|
+
const ToolbarView = ({ children, hidden, hidesSharedBackground, separateBackground, }) => {
|
|
141
|
+
const id = (0, react_1.useId)();
|
|
142
|
+
return (<native_1.RouterToolbarItem hidesSharedBackground={hidesSharedBackground} hidden={hidden} identifier={id} sharesBackground={!separateBackground}>
|
|
143
|
+
{children}
|
|
26
144
|
</native_1.RouterToolbarItem>);
|
|
27
145
|
};
|
|
28
146
|
exports.ToolbarView = ToolbarView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/toolbar/elements.tsx"],"names":[],"mappings":";;;AAAA,kDAA2C;AAC3C,iCAAgC;AAChC,+CAAoE;AAGpE,qCAAgE;AAEhE,mFAAgF;AAChF,+CAK0B;AAGb,QAAA,WAAW,GAAG,mBAAQ,CAAC;AAGvB,QAAA,iBAAiB,GAAG,yBAAc,CAAC;AAiBzC,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,EAAsB,EAAE,EAAE;IACtF,MAAM,EAAE,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,mBAAM,GAAE,EAAE,EAAE,CAAC,CAAC;IACvC,OAAO,CACL,CAAC,0BAAiB,CAChB,IAAI,IAAI,CAAC,CACT,UAAU,CAAC,CAAC,OAAO,CAAC,CACpB,UAAU,CAAC,CAAC,EAAE,CAAC,CACf,KAAK,CAAC,CAAC,QAAQ,CAAC,CAChB,eAAe,CAAC,CAAC,EAAE,CAAC,EACpB,CACH,CAAC;AACJ,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AI,KAAK,CAAC,EAC/B;IAAA,EAAE,uDAA0B,CAAC,CAC9B,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,WAAW,eAOtB","sourcesContent":["import { nanoid } from 'nanoid/non-secure';\nimport { useMemo } from 'react';\nimport { View, type StyleProp, type ViewStyle } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { RouterToolbarHost, RouterToolbarItem } from './native';\nimport type { RouterToolbarHostProps, RouterToolbarItemProps } from './native.types';\nimport { InternalLinkPreviewContext } from '../link/InternalLinkPreviewContext';\nimport {\n LinkMenu,\n LinkMenuAction,\n type LinkMenuActionProps,\n type LinkMenuProps,\n} from '../link/elements';\n\nexport type ToolbarMenuProps = LinkMenuProps;\nexport const ToolbarMenu = LinkMenu;\n\nexport type ToolbarMenuActionProps = LinkMenuActionProps;\nexport const ToolbarMenuAction = LinkMenuAction;\n\nexport interface ToolbarButtonProps\n extends Pick<\n RouterToolbarItemProps,\n | 'barButtonItemStyle'\n | 'hidden'\n | 'selected'\n | 'possibleTitles'\n | 'tintColor'\n | 'hidesSharedBackground'\n | 'sharesBackground'\n > {\n children?: string;\n sf?: SFSymbol;\n onPress?: () => void;\n}\nexport const ToolbarButton = ({ children, sf, onPress, ...rest }: ToolbarButtonProps) => {\n const id = useMemo(() => nanoid(), []);\n return (\n <RouterToolbarItem\n {...rest}\n onSelected={onPress}\n identifier={id}\n title={children}\n systemImageName={sf}\n />\n );\n};\n\nexport type ToolbarSpacerProps = Pick<RouterToolbarItemProps, 'width' | 'hidden'>;\nexport const ToolbarSpacer = ({ width, ...rest }: ToolbarSpacerProps) => {\n const id = useMemo(() => nanoid(), []);\n return (\n <RouterToolbarItem\n {...rest}\n identifier={id}\n type={width ? 'fixedSpacer' : 'fluidSpacer'}\n width={width}\n />\n );\n};\n\nexport interface ToolbarViewProps\n extends Pick<RouterToolbarItemProps, 'hidesSharedBackground' | 'sharesBackground'> {\n children: React.ReactNode;\n style?: StyleProp<\n Omit<ViewStyle, 'position' | 'inset' | 'top' | 'left' | 'right' | 'bottom' | 'flex'>\n >;\n}\nexport const ToolbarView = ({ children, style, ...rest }: ToolbarViewProps) => {\n const id = useMemo(() => nanoid(), []);\n return (\n <RouterToolbarItem {...rest} identifier={id}>\n <View style={[style, { position: 'absolute' }]}>{children}</View>\n </RouterToolbarItem>\n );\n};\n\nexport type ToolbarHostProps = RouterToolbarHostProps;\nexport const ToolbarHost = (props: ToolbarHostProps) => {\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":";;;AAAA,iCAAwE;AACxE,+CAA2E;AAG3E,qCAAgE;AAChE,mFAAgF;AAChF,+CAA4E;AAC5E,mDAAiE;AACjE,8CAA4C;AAC5C,gDAAwD;AAmFxD;;;;;;;;;;;;;;GAcG;AACI,MAAM,WAAW,GAA+B,CAAC,EACtD,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,OAAO,EACP,MAAM,EACN,MAAM,EACN,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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ACH,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,aAAa,iBAYxB;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 { 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 * 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 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 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"]}
|
package/build/toolbar/index.d.ts
CHANGED
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ToolbarMenu, ToolbarMenuAction, ToolbarButton, ToolbarSpacer, ToolbarView } from './elements';
|
|
2
|
+
/**
|
|
3
|
+
* A component that provides a [bottom toolbar](https://developer.apple.com/design/human-interface-guidelines/toolbars).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* import { Toolbar } from "expo-router";
|
|
8
|
+
*
|
|
9
|
+
* export default function MyScreen() {
|
|
10
|
+
* return (
|
|
11
|
+
* <>
|
|
12
|
+
* <YourScreenContent />
|
|
13
|
+
* <Toolbar>
|
|
14
|
+
* <Toolbar.Spacer />
|
|
15
|
+
* <Toolbar.Button icon="magnifyingglass" tintColor={Color.ios.placeholderText} />
|
|
16
|
+
* <Toolbar.View style={{ width: 200 }}>
|
|
17
|
+
* <TextInput placeholder="Search" />
|
|
18
|
+
* </Toolbar.View>
|
|
19
|
+
* <Toolbar.Menu icon="ellipsis">
|
|
20
|
+
* <Toolbar.MenuAction icon="mail" title="Send email" onPress={() => {}} />
|
|
21
|
+
* <Toolbar.MenuAction icon="trash" title="Delete" destructive onPress={() => {}} />
|
|
22
|
+
* </Toolbar.Menu>
|
|
23
|
+
* <Toolbar.Spacer />
|
|
24
|
+
* </Toolbar>
|
|
25
|
+
* </>
|
|
26
|
+
* );
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @platform ios
|
|
31
|
+
*/
|
|
32
|
+
export declare const Toolbar: ((props: import("./elements").ToolbarProps) => import("react").JSX.Element) & {
|
|
33
|
+
Menu: import("react").FC<import("./elements").ToolbarMenuProps>;
|
|
3
34
|
MenuAction: typeof import("..").LinkMenuAction;
|
|
4
|
-
Button: (
|
|
5
|
-
Spacer: (
|
|
6
|
-
View: ({ children,
|
|
35
|
+
Button: (props: import("./elements").ToolbarButtonProps) => import("react").JSX.Element;
|
|
36
|
+
Spacer: (props: import("./elements").ToolbarSpacerProps) => import("react").JSX.Element;
|
|
37
|
+
View: ({ children, hidden, hidesSharedBackground, separateBackground, }: import("./elements").ToolbarViewProps) => import("react").JSX.Element;
|
|
7
38
|
};
|
|
8
|
-
export
|
|
39
|
+
export { ToolbarMenu, ToolbarMenuAction, ToolbarButton, ToolbarSpacer, ToolbarView };
|
|
40
|
+
export type { ToolbarProps, ToolbarMenuProps, ToolbarMenuActionProps, ToolbarButtonProps, ToolbarSpacerProps, ToolbarViewProps as ToolbarCustomViewProps, } from './elements';
|
|
9
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toolbar/index.
|
|
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;;;;;;CAMlB,CAAC;AAEH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AAErF,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,IAAI,sBAAsB,GAC3C,MAAM,YAAY,CAAC"}
|
package/build/toolbar/index.js
CHANGED
|
@@ -1,7 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Toolbar = void 0;
|
|
3
|
+
exports.ToolbarView = exports.ToolbarSpacer = exports.ToolbarButton = exports.ToolbarMenuAction = exports.ToolbarMenu = exports.Toolbar = void 0;
|
|
4
4
|
const elements_1 = require("./elements");
|
|
5
|
+
Object.defineProperty(exports, "ToolbarMenu", { enumerable: true, get: function () { return elements_1.ToolbarMenu; } });
|
|
6
|
+
Object.defineProperty(exports, "ToolbarMenuAction", { enumerable: true, get: function () { return elements_1.ToolbarMenuAction; } });
|
|
7
|
+
Object.defineProperty(exports, "ToolbarButton", { enumerable: true, get: function () { return elements_1.ToolbarButton; } });
|
|
8
|
+
Object.defineProperty(exports, "ToolbarSpacer", { enumerable: true, get: function () { return elements_1.ToolbarSpacer; } });
|
|
9
|
+
Object.defineProperty(exports, "ToolbarView", { enumerable: true, get: function () { return elements_1.ToolbarView; } });
|
|
10
|
+
/**
|
|
11
|
+
* A component that provides a [bottom toolbar](https://developer.apple.com/design/human-interface-guidelines/toolbars).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { Toolbar } from "expo-router";
|
|
16
|
+
*
|
|
17
|
+
* export default function MyScreen() {
|
|
18
|
+
* return (
|
|
19
|
+
* <>
|
|
20
|
+
* <YourScreenContent />
|
|
21
|
+
* <Toolbar>
|
|
22
|
+
* <Toolbar.Spacer />
|
|
23
|
+
* <Toolbar.Button icon="magnifyingglass" tintColor={Color.ios.placeholderText} />
|
|
24
|
+
* <Toolbar.View style={{ width: 200 }}>
|
|
25
|
+
* <TextInput placeholder="Search" />
|
|
26
|
+
* </Toolbar.View>
|
|
27
|
+
* <Toolbar.Menu icon="ellipsis">
|
|
28
|
+
* <Toolbar.MenuAction icon="mail" title="Send email" onPress={() => {}} />
|
|
29
|
+
* <Toolbar.MenuAction icon="trash" title="Delete" destructive onPress={() => {}} />
|
|
30
|
+
* </Toolbar.Menu>
|
|
31
|
+
* <Toolbar.Spacer />
|
|
32
|
+
* </Toolbar>
|
|
33
|
+
* </>
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @platform ios
|
|
39
|
+
*/
|
|
5
40
|
exports.Toolbar = Object.assign(elements_1.ToolbarHost, {
|
|
6
41
|
Menu: elements_1.ToolbarMenu,
|
|
7
42
|
MenuAction: elements_1.ToolbarMenuAction,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/toolbar/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":";;;AAAA,yCAOoB;AAwCX,4FA7CP,sBAAW,OA6CO;AAAE,kGA5CpB,4BAAiB,OA4CoB;AAAE,8FA3CvC,wBAAa,OA2CuC;AAAE,8FA1CtD,wBAAa,OA0CsD;AAAE,4FAzCrE,sBAAW,OAyCqE;AAtClF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,IAAI,EAAE,sBAAW;CAClB,CAAC,CAAC","sourcesContent":["import {\n ToolbarHost,\n ToolbarMenu,\n ToolbarMenuAction,\n ToolbarButton,\n ToolbarSpacer,\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 style={{ width: 200 }}>\n * <TextInput 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 View: ToolbarView,\n});\n\nexport { ToolbarMenu, ToolbarMenuAction, ToolbarButton, ToolbarSpacer, ToolbarView };\n\nexport type {\n ToolbarProps,\n ToolbarMenuProps,\n ToolbarMenuActionProps,\n ToolbarButtonProps,\n ToolbarSpacerProps,\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;AAiBD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAE9D"}
|
|
@@ -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;AAiBD,8CAEC;AA3CD,+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,GAcvB,IAAA,wBAAiB,EAAC,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AAC1E,SAAgB,iBAAiB,CAAC,KAA6B;IAC7D,OAAO,CAAC,qBAAqB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC9C,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 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');\nexport function RouterToolbarItem(props: RouterToolbarItemProps) {\n return <RouterToolbarItemView {...props} />;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ColorValue } from 'react-native';
|
|
2
2
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
3
|
+
import type { BasicTextStyle } from '../utils/font';
|
|
3
4
|
export interface RouterToolbarHostProps {
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
}
|
|
@@ -20,11 +21,11 @@ export interface RouterToolbarItemProps {
|
|
|
20
21
|
badgeConfiguration?: {
|
|
21
22
|
value?: string;
|
|
22
23
|
backgroundColor?: ColorValue;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
} & BasicTextStyle;
|
|
25
|
+
titleStyle?: BasicTextStyle;
|
|
26
|
+
accessibilityLabel?: string;
|
|
27
|
+
accessibilityHint?: string;
|
|
28
|
+
disabled?: boolean;
|
|
28
29
|
onSelected?: () => void;
|
|
29
30
|
}
|
|
30
31
|
//# sourceMappingURL=native.types.d.ts.map
|
|
@@ -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,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,IAAI,CAAC,EAAE,QAAQ,GAAG,aAAa,GAAG,aAAa,CAAC;IAChD,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,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,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"}
|
|
@@ -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\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
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreens.d.ts","sourceRoot":"","sources":["../src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;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,KAAK,MAAM,GAAG,SAAS,CAAC;IAE7E,mBAAmB,CAAC,EAAE,eAAe,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC;AA2FxE;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,EAAE,EACpB,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC7B,yBAAyB,GAAE,OAAe,GACzC,KAAK,CAAC,SAAS,EAAE,CAoBnB;AAkDD,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS;sCAiCtD,GAAG;;EAoEP;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
|
@@ -45,10 +45,12 @@ exports.getSingularId = getSingularId;
|
|
|
45
45
|
const native_1 = require("@react-navigation/native");
|
|
46
46
|
const react_1 = __importStar(require("react"));
|
|
47
47
|
const Route_1 = require("./Route");
|
|
48
|
+
const getPathFromState_1 = require("./fork/getPathFromState");
|
|
48
49
|
const storeContext_1 = require("./global-state/storeContext");
|
|
49
50
|
const import_mode_1 = __importDefault(require("./import-mode"));
|
|
50
51
|
const ZoomTransitionEnabler_1 = require("./link/zoom/ZoomTransitionEnabler");
|
|
51
52
|
const zoom_transition_context_providers_1 = require("./link/zoom/zoom-transition-context-providers");
|
|
53
|
+
const navigationEvents_1 = require("./navigationEvents");
|
|
52
54
|
const navigationParams_1 = require("./navigationParams");
|
|
53
55
|
const primitives_1 = require("./primitives");
|
|
54
56
|
const EmptyRoute_1 = require("./views/EmptyRoute");
|
|
@@ -223,6 +225,7 @@ function getQualifiedRouteComponent(value) {
|
|
|
223
225
|
});
|
|
224
226
|
}, [navigation]);
|
|
225
227
|
return (<Route_1.Route node={value} route={route}>
|
|
228
|
+
{value.type === 'route' && navigationEvents_1.unstable_navigationEvents.hasAnyListener() && (<AnalyticsListeners navigation={navigation} screenId={route.key}/>)}
|
|
226
229
|
<ZoomTransitionEnabler_1.ZoomTransitionEnabler route={route}/>
|
|
227
230
|
<zoom_transition_context_providers_1.ZoomTransitionTargetContextProvider route={route}>
|
|
228
231
|
<react_1.default.Suspense fallback={<SuspenseFallback_1.SuspenseFallback route={value}/>}>
|
|
@@ -240,6 +243,53 @@ function getQualifiedRouteComponent(value) {
|
|
|
240
243
|
qualifiedStore.set(value, BaseRoute);
|
|
241
244
|
return BaseRoute;
|
|
242
245
|
}
|
|
246
|
+
function AnalyticsListeners({ navigation, screenId, }) {
|
|
247
|
+
const stateForPath = (0, native_1.useStateForPath)();
|
|
248
|
+
const isFirstRenderRef = react_1.default.useRef(true);
|
|
249
|
+
const pathname = (0, react_1.useMemo)(() => (stateForPath ? decodeURIComponent((0, getPathFromState_1.getPathFromState)(stateForPath)) : undefined), [stateForPath]);
|
|
250
|
+
if (isFirstRenderRef.current) {
|
|
251
|
+
isFirstRenderRef.current = false;
|
|
252
|
+
if (pathname) {
|
|
253
|
+
navigationEvents_1.unstable_navigationEvents.emit('pageWillRender', {
|
|
254
|
+
pathname,
|
|
255
|
+
screenId,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
(0, react_1.useEffect)(() => {
|
|
260
|
+
if (pathname) {
|
|
261
|
+
return () => {
|
|
262
|
+
navigationEvents_1.unstable_navigationEvents.emit('pageRemoved', {
|
|
263
|
+
pathname,
|
|
264
|
+
screenId,
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
return () => { };
|
|
269
|
+
}, [pathname]);
|
|
270
|
+
(0, react_1.useEffect)(() => {
|
|
271
|
+
if (pathname) {
|
|
272
|
+
const cleanFocus = navigation.addListener('focus', () => {
|
|
273
|
+
navigationEvents_1.unstable_navigationEvents.emit('pageFocused', {
|
|
274
|
+
pathname,
|
|
275
|
+
screenId,
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
const cleanBlur = navigation.addListener('blur', () => {
|
|
279
|
+
navigationEvents_1.unstable_navigationEvents.emit('pageBlurred', {
|
|
280
|
+
pathname,
|
|
281
|
+
screenId,
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
return () => {
|
|
285
|
+
cleanFocus();
|
|
286
|
+
cleanBlur();
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
return () => { };
|
|
290
|
+
}, [navigation, pathname]);
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
243
293
|
function screenOptionsFactory(route, options) {
|
|
244
294
|
return (args) => {
|
|
245
295
|
// Only eager load generated components
|
package/build/useScreens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0Jb,4CAwBC;AAmDD,gEAkGC;AAED,oDAwBC;AAED,sCAcC;AAED,sCAaC;AA9XD,qDAOkC;AAElC,+CAAyC;AAEzC,mCAA6F;AAC7F,8DAAiE;AACjE,gEAAoD;AACpD,6EAA0E;AAC1E,qGAAoG;AACpG,yDAI4B;AAC5B,6CAAsC;AAEtC,mDAAg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IAAI,OAAO,CAAC;QACtE,CAAC;aAAM,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5D,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport {\n useStateForPath,\n type EventMapBase,\n type NavigationState,\n type ParamListBase,\n type RouteProp,\n type ScreenListeners,\n} from '@react-navigation/native';\nimport type { NativeStackNavigationEventMap } from '@react-navigation/native-stack';\nimport React, { useEffect } from 'react';\n\nimport { LoadedRoute, Route, RouteNode, sortRoutesWithInitial, useRouteNode } from './Route';\nimport { useExpoRouterStore } from './global-state/storeContext';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { ZoomTransitionEnabler } from './link/zoom/ZoomTransitionEnabler';\nimport { ZoomTransitionTargetContextProvider } from './link/zoom/zoom-transition-context-providers';\nimport {\n hasParam,\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n removeParams,\n} from './navigationParams';\nimport { Screen } from './primitives';\nimport { UnknownOutputParams } from './types';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport { SuspenseFallback } from './views/SuspenseFallback';\nimport { Try } from './views/Try';\n\nexport type ScreenProps<\n TOptions extends Record<string, any> = Record<string, any>,\n TState extends NavigationState = NavigationState,\n TEventMap extends EventMapBase = EventMapBase,\n> = {\n /** Name is required when used inside a Layout component. */\n name?: string;\n /**\n * Redirect to the nearest sibling route.\n * If all children are `redirect={true}`, the layout will render `null` as there are no children to render.\n */\n redirect?: boolean;\n initialParams?: Record<string, any>;\n options?:\n | TOptions\n | ((prop: { route: RouteProp<ParamListBase, string>; navigation: any }) => TOptions);\n\n listeners?:\n | ScreenListeners<TState, TEventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n navigation: any;\n }) => ScreenListeners<TState, TEventMap>);\n\n getId?: ({ params }: { params?: Record<string, any> }) => string | undefined;\n\n dangerouslySingular?: SingularOptions;\n};\n\nexport type SingularOptions =\n | boolean\n | ((name: string, params: UnknownOutputParams) => string | undefined);\n\nfunction getSortedChildren(\n children: RouteNode[],\n order: ScreenProps[] = [],\n initialRouteName?: string\n): { route: RouteNode; props: Partial<ScreenProps> }[] {\n if (!order?.length) {\n return children\n .sort(sortRoutesWithInitial(initialRouteName))\n .map((route) => ({ route, props: {} }));\n }\n const entries = [...children];\n\n const ordered = order\n .map(\n ({\n name,\n redirect,\n initialParams,\n listeners,\n options,\n getId,\n dangerouslySingular: singular,\n }) => {\n if (!entries.length) {\n console.warn(\n `[Layout children]: Too many screens defined. Route \"${name}\" is extraneous.`\n );\n return null;\n }\n const matchIndex = entries.findIndex((child) => child.route === name);\n if (matchIndex === -1) {\n console.warn(\n `[Layout children]: No route named \"${name}\" exists in nested children:`,\n children.map(({ route }) => route)\n );\n return null;\n } else {\n // Get match and remove from entries\n const match = entries[matchIndex];\n entries.splice(matchIndex, 1);\n\n // Ensure to return null after removing from entries.\n if (redirect) {\n if (typeof redirect === 'string') {\n throw new Error(`Redirecting to a specific route is not supported yet.`);\n }\n return null;\n }\n\n if (getId) {\n console.warn(\n `Deprecated: prop 'getId' on screen ${name} is deprecated. Please rename the prop to 'dangerouslySingular'`\n );\n if (singular) {\n console.warn(\n `Screen ${name} cannot use both getId and dangerouslySingular together.`\n );\n }\n } else if (singular) {\n // If singular is set, use it as the getId function.\n if (typeof singular === 'string') {\n getId = () => singular;\n } else if (typeof singular === 'function' && name) {\n getId = (options) => singular(name, options.params || {});\n } else if (singular === true && name) {\n getId = (options) => getSingularId(name, options);\n }\n }\n\n return {\n route: match,\n props: { initialParams, listeners, options, getId },\n };\n }\n }\n )\n .filter(Boolean) as {\n route: RouteNode;\n props: Partial<ScreenProps>;\n }[];\n\n // Add any remaining children\n ordered.push(\n ...entries.sort(sortRoutesWithInitial(initialRouteName)).map((route) => ({ route, props: {} }))\n );\n\n return ordered;\n}\n\n/**\n * @returns React Navigation screens sorted by the `route` property.\n */\nexport function useSortedScreens(\n order: ScreenProps[],\n protectedScreens: Set<string>,\n useOnlyUserDefinedScreens: boolean = false\n): React.ReactNode[] {\n const node = useRouteNode();\n\n const nodeChildren = node?.children ?? [];\n const children = useOnlyUserDefinedScreens\n ? nodeChildren.filter((child) =>\n order.some((userDefinedScreen) => userDefinedScreen.name === child.route)\n )\n : nodeChildren;\n\n const sorted = children.length ? getSortedChildren(children, order, node?.initialRouteName) : [];\n return React.useMemo(\n () =>\n sorted\n .filter((item) => !protectedScreens.has(item.route.route))\n .map((value) => {\n return routeToScreen(value.route, value.props);\n }),\n [sorted, protectedScreens]\n );\n}\n\nfunction fromImport(value: RouteNode, { ErrorBoundary, ...component }: LoadedRoute) {\n // If possible, add a more helpful display name for the component stack to improve debugging of React errors such as `Text strings must be rendered within a <Text> component.`.\n if (component?.default && __DEV__) {\n component.default.displayName ??= `${component.default.name ?? 'Route'}(${value.contextKey})`;\n }\n\n if (ErrorBoundary) {\n const Wrapped = React.forwardRef((props: any, ref: any) => {\n const children = React.createElement(component.default || EmptyRoute, {\n ...props,\n ref,\n });\n return <Try catch={ErrorBoundary}>{children}</Try>;\n });\n\n if (__DEV__) {\n Wrapped.displayName = `ErrorBoundary(${value.contextKey})`;\n }\n\n return {\n default: Wrapped,\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof component.default === 'object' &&\n component.default &&\n Object.keys(component.default).length === 0\n ) {\n return { default: EmptyRoute };\n }\n }\n\n return { default: component.default };\n}\n\nfunction fromLoadedRoute(value: RouteNode, res: LoadedRoute) {\n if (!(res instanceof Promise)) {\n return fromImport(value, res);\n }\n\n return res.then(fromImport.bind(null, value));\n}\n\n// TODO: Maybe there's a more React-y way to do this?\n// Without this store, the process enters a recursive loop.\nconst qualifiedStore = new WeakMap<RouteNode, React.ComponentType<any>>();\n\n/** Wrap the component with various enhancements and add access to child routes. */\nexport function getQualifiedRouteComponent(value: RouteNode) {\n if (qualifiedStore.has(value)) {\n return qualifiedStore.get(value)!;\n }\n\n let ScreenComponent:\n | React.ForwardRefExoticComponent<React.RefAttributes<unknown>>\n | React.ComponentType<any>;\n\n // TODO: This ensures sync doesn't use React.lazy, but it's not ideal.\n if (EXPO_ROUTER_IMPORT_MODE === 'lazy') {\n ScreenComponent = React.lazy(async () => {\n const res = value.loadRoute();\n return fromLoadedRoute(value, res) as Promise<{\n default: React.ComponentType<any>;\n }>;\n });\n\n if (__DEV__) {\n ScreenComponent.displayName = `AsyncRoute(${value.route})`;\n }\n } else {\n const res = value.loadRoute();\n ScreenComponent = fromImport(value, res).default!;\n }\n function BaseRoute({\n // Remove these React Navigation props to\n // enforce usage of expo-router hooks (where the query params are correct).\n route,\n navigation,\n\n // Pass all other props to the component\n ...props\n }: any) {\n const stateForPath = useStateForPath();\n const isFocused = navigation.isFocused();\n const store = useExpoRouterStore();\n\n if (isFocused) {\n const state = navigation.getState();\n const isLeaf = !('state' in state.routes[state.index]);\n if (isLeaf && stateForPath) store.setFocusedState(stateForPath);\n }\n\n useEffect(\n () =>\n navigation.addListener('focus', () => {\n const state = navigation.getState();\n const isLeaf = !('state' in state.routes[state.index]);\n // Because setFocusedState caches the route info, this call will only trigger rerenders\n // if the component itself didn’t rerender and the route info changed.\n // Otherwise, the update from the `if` above will handle it,\n // and this won’t cause a redundant second update.\n if (isLeaf && stateForPath) store.setFocusedState(stateForPath);\n }),\n [navigation]\n );\n\n useEffect(() => {\n return navigation.addListener(\n 'transitionEnd',\n (e?: NativeStackNavigationEventMap['transitionEnd']) => {\n if (!e?.data?.closing) {\n // When navigating to a screen, remove the no animation param to re-enable animations\n // Otherwise the navigation back would also have no animation\n if (hasParam(route?.params, INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME)) {\n navigation.replaceParams(\n removeParams(route?.params, [INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME])\n );\n }\n }\n }\n );\n }, [navigation]);\n\n return (\n <Route node={value} route={route}>\n <ZoomTransitionEnabler route={route} />\n <ZoomTransitionTargetContextProvider route={route}>\n <React.Suspense fallback={<SuspenseFallback route={value} />}>\n <ScreenComponent\n {...props}\n // Expose the template segment path, e.g. `(home)`, `[foo]`, `index`\n // the intention is to make it possible to deduce shared routes.\n segment={value.route}\n />\n </React.Suspense>\n </ZoomTransitionTargetContextProvider>\n </Route>\n );\n }\n\n if (__DEV__) {\n BaseRoute.displayName = `Route(${value.route})`;\n }\n\n qualifiedStore.set(value, BaseRoute);\n return BaseRoute;\n}\n\nexport function screenOptionsFactory(\n route: RouteNode,\n options?: ScreenProps['options']\n): ScreenProps['options'] {\n return (args) => {\n // Only eager load generated components\n const staticOptions = route.generated ? route.loadRoute()?.getNavOptions : null;\n const staticResult = typeof staticOptions === 'function' ? staticOptions(args) : staticOptions;\n const dynamicResult = typeof options === 'function' ? options?.(args) : options;\n const output = {\n ...staticResult,\n ...dynamicResult,\n };\n\n // Prevent generated screens from showing up in the tab bar.\n if (route.internal) {\n output.tabBarItemStyle = { display: 'none' };\n output.tabBarButton = () => null;\n // TODO: React Navigation doesn't provide a way to prevent rendering the drawer item.\n output.drawerItemStyle = { height: 0, display: 'none' };\n }\n\n return output;\n };\n}\n\nexport function routeToScreen(\n route: RouteNode,\n { options, getId, ...props }: Partial<ScreenProps> = {}\n) {\n return (\n <Screen\n {...props}\n name={route.route}\n key={route.route}\n getId={getId}\n options={screenOptionsFactory(route, options)}\n getComponent={() => getQualifiedRouteComponent(route)}\n />\n );\n}\n\nexport function getSingularId(name: string, options: Record<string, any> = {}) {\n return name\n .split('/')\n .map((segment) => {\n if (segment.startsWith('[...')) {\n return options.params?.[segment.slice(4, -1)]?.join('/') || segment;\n } else if (segment.startsWith('[') && segment.endsWith(']')) {\n return options.params?.[segment.slice(1, -1)] || segment;\n } else {\n return segment;\n }\n })\n .join('/');\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useScreens.js","sourceRoot":"","sources":["../src/useScreens.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6Jb,4CAwBC;AAmDD,gEAqGC;AAgED,oDAwBC;AAED,sCAcC;AAED,sCAaC;AAlcD,qDAQkC;AAElC,+CAAkD;AAElD,mCAA6F;AAC7F,8DAA2D;AAC3D,8DAAiE;AACjE,gEAAoD;AACpD,6EAA0E;AAC1E,qGAAoG;AACpG,yDAA+D;AAC/D,yDAI4B;AAC5B,6CAAsC;AAEtC,mDAAgD;AAChD,+DAA4D;AAC5D,qCAAkC;AAmClC,SAAS,iBAAiB,CACxB,QAAqB,EACrB,QAAuB,EAAE,EACzB,gBAAyB;IAEzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,QAAQ;aACZ,IAAI,CAAC,IAAA,6BAAqB,EAAC,gBAAgB,CAAC,CAAC;aAC7C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;IAE9B,MAAM,OAAO,GAAG,KAAK;SAClB,GAAG,CACF,CAAC,EACC,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,SAAS,EACT,OAAO,EACP,KAAK,EACL,mBAAmB,EAAE,QAAQ,GAC9B,EAAE,EAAE;QACH,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CACV,uDAAuD,IAAI,kBAAkB,CAC9E,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,UAAU,GAAG,OA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,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport {\n useStateForPath,\n type EventConsumer,\n type EventMapBase,\n type NavigationState,\n type ParamListBase,\n type RouteProp,\n type ScreenListeners,\n} from '@react-navigation/native';\nimport type { NativeStackNavigationEventMap } from '@react-navigation/native-stack';\nimport React, { useEffect, useMemo } from 'react';\n\nimport { LoadedRoute, Route, RouteNode, sortRoutesWithInitial, useRouteNode } from './Route';\nimport { getPathFromState } from './fork/getPathFromState';\nimport { useExpoRouterStore } from './global-state/storeContext';\nimport EXPO_ROUTER_IMPORT_MODE from './import-mode';\nimport { ZoomTransitionEnabler } from './link/zoom/ZoomTransitionEnabler';\nimport { ZoomTransitionTargetContextProvider } from './link/zoom/zoom-transition-context-providers';\nimport { unstable_navigationEvents } from './navigationEvents';\nimport {\n hasParam,\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n removeParams,\n} from './navigationParams';\nimport { Screen } from './primitives';\nimport { UnknownOutputParams } from './types';\nimport { EmptyRoute } from './views/EmptyRoute';\nimport { SuspenseFallback } from './views/SuspenseFallback';\nimport { Try } from './views/Try';\n\nexport type ScreenProps<\n TOptions extends Record<string, any> = Record<string, any>,\n TState extends NavigationState = NavigationState,\n TEventMap extends EventMapBase = EventMapBase,\n> = {\n /** Name is required when used inside a Layout component. */\n name?: string;\n /**\n * Redirect to the nearest sibling route.\n * If all children are `redirect={true}`, the layout will render `null` as there are no children to render.\n */\n redirect?: boolean;\n initialParams?: Record<string, any>;\n options?:\n | TOptions\n | ((prop: { route: RouteProp<ParamListBase, string>; navigation: any }) => TOptions);\n\n listeners?:\n | ScreenListeners<TState, TEventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n navigation: any;\n }) => ScreenListeners<TState, TEventMap>);\n\n getId?: ({ params }: { params?: Record<string, any> }) => string | undefined;\n\n dangerouslySingular?: SingularOptions;\n};\n\nexport type SingularOptions =\n | boolean\n | ((name: string, params: UnknownOutputParams) => string | undefined);\n\nfunction getSortedChildren(\n children: RouteNode[],\n order: ScreenProps[] = [],\n initialRouteName?: string\n): { route: RouteNode; props: Partial<ScreenProps> }[] {\n if (!order?.length) {\n return children\n .sort(sortRoutesWithInitial(initialRouteName))\n .map((route) => ({ route, props: {} }));\n }\n const entries = [...children];\n\n const ordered = order\n .map(\n ({\n name,\n redirect,\n initialParams,\n listeners,\n options,\n getId,\n dangerouslySingular: singular,\n }) => {\n if (!entries.length) {\n console.warn(\n `[Layout children]: Too many screens defined. Route \"${name}\" is extraneous.`\n );\n return null;\n }\n const matchIndex = entries.findIndex((child) => child.route === name);\n if (matchIndex === -1) {\n console.warn(\n `[Layout children]: No route named \"${name}\" exists in nested children:`,\n children.map(({ route }) => route)\n );\n return null;\n } else {\n // Get match and remove from entries\n const match = entries[matchIndex];\n entries.splice(matchIndex, 1);\n\n // Ensure to return null after removing from entries.\n if (redirect) {\n if (typeof redirect === 'string') {\n throw new Error(`Redirecting to a specific route is not supported yet.`);\n }\n return null;\n }\n\n if (getId) {\n console.warn(\n `Deprecated: prop 'getId' on screen ${name} is deprecated. Please rename the prop to 'dangerouslySingular'`\n );\n if (singular) {\n console.warn(\n `Screen ${name} cannot use both getId and dangerouslySingular together.`\n );\n }\n } else if (singular) {\n // If singular is set, use it as the getId function.\n if (typeof singular === 'string') {\n getId = () => singular;\n } else if (typeof singular === 'function' && name) {\n getId = (options) => singular(name, options.params || {});\n } else if (singular === true && name) {\n getId = (options) => getSingularId(name, options);\n }\n }\n\n return {\n route: match,\n props: { initialParams, listeners, options, getId },\n };\n }\n }\n )\n .filter(Boolean) as {\n route: RouteNode;\n props: Partial<ScreenProps>;\n }[];\n\n // Add any remaining children\n ordered.push(\n ...entries.sort(sortRoutesWithInitial(initialRouteName)).map((route) => ({ route, props: {} }))\n );\n\n return ordered;\n}\n\n/**\n * @returns React Navigation screens sorted by the `route` property.\n */\nexport function useSortedScreens(\n order: ScreenProps[],\n protectedScreens: Set<string>,\n useOnlyUserDefinedScreens: boolean = false\n): React.ReactNode[] {\n const node = useRouteNode();\n\n const nodeChildren = node?.children ?? [];\n const children = useOnlyUserDefinedScreens\n ? nodeChildren.filter((child) =>\n order.some((userDefinedScreen) => userDefinedScreen.name === child.route)\n )\n : nodeChildren;\n\n const sorted = children.length ? getSortedChildren(children, order, node?.initialRouteName) : [];\n return React.useMemo(\n () =>\n sorted\n .filter((item) => !protectedScreens.has(item.route.route))\n .map((value) => {\n return routeToScreen(value.route, value.props);\n }),\n [sorted, protectedScreens]\n );\n}\n\nfunction fromImport(value: RouteNode, { ErrorBoundary, ...component }: LoadedRoute) {\n // If possible, add a more helpful display name for the component stack to improve debugging of React errors such as `Text strings must be rendered within a <Text> component.`.\n if (component?.default && __DEV__) {\n component.default.displayName ??= `${component.default.name ?? 'Route'}(${value.contextKey})`;\n }\n\n if (ErrorBoundary) {\n const Wrapped = React.forwardRef((props: any, ref: any) => {\n const children = React.createElement(component.default || EmptyRoute, {\n ...props,\n ref,\n });\n return <Try catch={ErrorBoundary}>{children}</Try>;\n });\n\n if (__DEV__) {\n Wrapped.displayName = `ErrorBoundary(${value.contextKey})`;\n }\n\n return {\n default: Wrapped,\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof component.default === 'object' &&\n component.default &&\n Object.keys(component.default).length === 0\n ) {\n return { default: EmptyRoute };\n }\n }\n\n return { default: component.default };\n}\n\nfunction fromLoadedRoute(value: RouteNode, res: LoadedRoute) {\n if (!(res instanceof Promise)) {\n return fromImport(value, res);\n }\n\n return res.then(fromImport.bind(null, value));\n}\n\n// TODO: Maybe there's a more React-y way to do this?\n// Without this store, the process enters a recursive loop.\nconst qualifiedStore = new WeakMap<RouteNode, React.ComponentType<any>>();\n\n/** Wrap the component with various enhancements and add access to child routes. */\nexport function getQualifiedRouteComponent(value: RouteNode) {\n if (qualifiedStore.has(value)) {\n return qualifiedStore.get(value)!;\n }\n\n let ScreenComponent:\n | React.ForwardRefExoticComponent<React.RefAttributes<unknown>>\n | React.ComponentType<any>;\n\n // TODO: This ensures sync doesn't use React.lazy, but it's not ideal.\n if (EXPO_ROUTER_IMPORT_MODE === 'lazy') {\n ScreenComponent = React.lazy(async () => {\n const res = value.loadRoute();\n return fromLoadedRoute(value, res) as Promise<{\n default: React.ComponentType<any>;\n }>;\n });\n\n if (__DEV__) {\n ScreenComponent.displayName = `AsyncRoute(${value.route})`;\n }\n } else {\n const res = value.loadRoute();\n ScreenComponent = fromImport(value, res).default!;\n }\n function BaseRoute({\n // Remove these React Navigation props to\n // enforce usage of expo-router hooks (where the query params are correct).\n route,\n navigation,\n\n // Pass all other props to the component\n ...props\n }: any) {\n const stateForPath = useStateForPath();\n const isFocused = navigation.isFocused();\n const store = useExpoRouterStore();\n\n if (isFocused) {\n const state = navigation.getState();\n const isLeaf = !('state' in state.routes[state.index]);\n if (isLeaf && stateForPath) store.setFocusedState(stateForPath);\n }\n\n useEffect(\n () =>\n navigation.addListener('focus', () => {\n const state = navigation.getState();\n const isLeaf = !('state' in state.routes[state.index]);\n // Because setFocusedState caches the route info, this call will only trigger rerenders\n // if the component itself didn’t rerender and the route info changed.\n // Otherwise, the update from the `if` above will handle it,\n // and this won’t cause a redundant second update.\n if (isLeaf && stateForPath) store.setFocusedState(stateForPath);\n }),\n [navigation]\n );\n\n useEffect(() => {\n return navigation.addListener(\n 'transitionEnd',\n (e?: NativeStackNavigationEventMap['transitionEnd']) => {\n if (!e?.data?.closing) {\n // When navigating to a screen, remove the no animation param to re-enable animations\n // Otherwise the navigation back would also have no animation\n if (hasParam(route?.params, INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME)) {\n navigation.replaceParams(\n removeParams(route?.params, [INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME])\n );\n }\n }\n }\n );\n }, [navigation]);\n\n return (\n <Route node={value} route={route}>\n {value.type === 'route' && unstable_navigationEvents.hasAnyListener() && (\n <AnalyticsListeners navigation={navigation} screenId={route.key} />\n )}\n <ZoomTransitionEnabler route={route} />\n <ZoomTransitionTargetContextProvider route={route}>\n <React.Suspense fallback={<SuspenseFallback route={value} />}>\n <ScreenComponent\n {...props}\n // Expose the template segment path, e.g. `(home)`, `[foo]`, `index`\n // the intention is to make it possible to deduce shared routes.\n segment={value.route}\n />\n </React.Suspense>\n </ZoomTransitionTargetContextProvider>\n </Route>\n );\n }\n\n if (__DEV__) {\n BaseRoute.displayName = `Route(${value.route})`;\n }\n\n qualifiedStore.set(value, BaseRoute);\n return BaseRoute;\n}\n\nfunction AnalyticsListeners({\n navigation,\n screenId,\n}: {\n navigation: EventConsumer<EventMapBase>;\n screenId: string;\n}) {\n const stateForPath = useStateForPath();\n const isFirstRenderRef = React.useRef(true);\n\n const pathname = useMemo(\n () => (stateForPath ? decodeURIComponent(getPathFromState(stateForPath)) : undefined),\n [stateForPath]\n );\n\n if (isFirstRenderRef.current) {\n isFirstRenderRef.current = false;\n if (pathname) {\n unstable_navigationEvents.emit('pageWillRender', {\n pathname,\n screenId,\n });\n }\n }\n\n useEffect(() => {\n if (pathname) {\n return () => {\n unstable_navigationEvents.emit('pageRemoved', {\n pathname,\n screenId,\n });\n };\n }\n return () => {};\n }, [pathname]);\n\n useEffect(() => {\n if (pathname) {\n const cleanFocus = navigation.addListener('focus', () => {\n unstable_navigationEvents.emit('pageFocused', {\n pathname,\n screenId,\n });\n });\n const cleanBlur = navigation.addListener('blur', () => {\n unstable_navigationEvents.emit('pageBlurred', {\n pathname,\n screenId,\n });\n });\n return () => {\n cleanFocus();\n cleanBlur();\n };\n }\n return () => {};\n }, [navigation, pathname]);\n\n return null;\n}\n\nexport function screenOptionsFactory(\n route: RouteNode,\n options?: ScreenProps['options']\n): ScreenProps['options'] {\n return (args) => {\n // Only eager load generated components\n const staticOptions = route.generated ? route.loadRoute()?.getNavOptions : null;\n const staticResult = typeof staticOptions === 'function' ? staticOptions(args) : staticOptions;\n const dynamicResult = typeof options === 'function' ? options?.(args) : options;\n const output = {\n ...staticResult,\n ...dynamicResult,\n };\n\n // Prevent generated screens from showing up in the tab bar.\n if (route.internal) {\n output.tabBarItemStyle = { display: 'none' };\n output.tabBarButton = () => null;\n // TODO: React Navigation doesn't provide a way to prevent rendering the drawer item.\n output.drawerItemStyle = { height: 0, display: 'none' };\n }\n\n return output;\n };\n}\n\nexport function routeToScreen(\n route: RouteNode,\n { options, getId, ...props }: Partial<ScreenProps> = {}\n) {\n return (\n <Screen\n {...props}\n name={route.route}\n key={route.route}\n getId={getId}\n options={screenOptionsFactory(route, options)}\n getComponent={() => getQualifiedRouteComponent(route)}\n />\n );\n}\n\nexport function getSingularId(name: string, options: Record<string, any> = {}) {\n return name\n .split('/')\n .map((segment) => {\n if (segment.startsWith('[...')) {\n return options.params?.[segment.slice(4, -1)]?.join('/') || segment;\n } else if (segment.startsWith('[') && segment.endsWith(']')) {\n return options.params?.[segment.slice(1, -1)] || segment;\n } else {\n return segment;\n }\n })\n .join('/');\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type StyleProp, type TextStyle } from 'react-native';
|
|
2
|
+
type NumericFontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
3
|
+
type ConvertedFontWeightType = Exclude<TextStyle['fontWeight'], number> | `${NumericFontWeight}`;
|
|
4
|
+
export declare function convertTextStyleToRNTextStyle<BaseStyleType extends Pick<TextStyle, 'fontWeight'>>(style: StyleProp<BaseStyleType | undefined>): (Omit<BaseStyleType, 'fontWeight'> & {
|
|
5
|
+
fontWeight?: ConvertedFontWeightType;
|
|
6
|
+
}) | undefined;
|
|
7
|
+
export type BasicTextStyle = Pick<TextStyle, 'fontSize' | 'fontWeight' | 'fontFamily' | 'color'>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=font.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font.d.ts","sourceRoot":"","sources":["../../src/utils/font.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1E,KAAK,iBAAiB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE7E,KAAK,uBAAuB,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,GAAG,GAAG,iBAAiB,EAAE,CAAC;AAEjG,wBAAgB,6BAA6B,CAAC,aAAa,SAAS,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAC/F,KAAK,EAAE,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC,GAEzC,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG;IACnC,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC,CAAC,GACF,SAAS,CAeZ;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,YAAY,GAAG,YAAY,GAAG,OAAO,CAAC,CAAC"}
|