expo-router 4.0.0-preview.11 → 4.0.0-preview.12
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/build/fast-refresh.d.ts.map +1 -1
- package/build/fast-refresh.js.map +1 -1
- package/build/getRoutesCore.d.ts +1 -0
- package/build/getRoutesCore.d.ts.map +1 -1
- package/build/getRoutesCore.js +3 -1
- package/build/getRoutesCore.js.map +1 -1
- package/build/head/url.d.ts +1 -0
- package/build/head/url.d.ts.map +1 -1
- package/build/head/url.js +21 -4
- package/build/head/url.js.map +1 -1
- package/build/hooks.d.ts +90 -38
- package/build/hooks.d.ts.map +1 -1
- package/build/hooks.js +46 -39
- package/build/hooks.js.map +1 -1
- package/build/imperative-api.d.ts +58 -15
- package/build/imperative-api.d.ts.map +1 -1
- package/build/imperative-api.js.map +1 -1
- package/build/layouts/withLayoutContext.d.ts +4 -1
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +4 -1
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.d.ts +48 -4
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +47 -3
- package/build/link/Link.js.map +1 -1
- package/build/link/href.d.ts +1 -1
- package/build/link/href.d.ts.map +1 -1
- package/build/link/href.js.map +1 -1
- package/build/link/useLinkHooks.d.ts +122 -29
- package/build/link/useLinkHooks.d.ts.map +1 -1
- package/build/link/useLinkHooks.js.map +1 -1
- package/build/rsc/exports.d.ts +3 -1
- package/build/rsc/exports.d.ts.map +1 -1
- package/build/rsc/exports.js +3 -1
- package/build/rsc/exports.js.map +1 -1
- package/build/rsc/router/client.d.ts +2 -2
- package/build/rsc/router/client.d.ts.map +1 -1
- package/build/rsc/router/client.js.map +1 -1
- package/build/rsc/router/host.d.ts.map +1 -1
- package/build/rsc/router/host.js +20 -15
- package/build/rsc/router/host.js.map +1 -1
- package/build/rsc/rsc-renderer.d.ts +1 -1
- package/build/rsc/rsc-renderer.d.ts.map +1 -1
- package/build/rsc/rsc-renderer.js +1 -1
- package/build/rsc/rsc-renderer.js.map +1 -1
- package/build/testing-library/context-stubs.d.ts.map +1 -1
- package/build/testing-library/context-stubs.js +3 -1
- package/build/testing-library/context-stubs.js.map +1 -1
- package/build/testing-library/mocks.js +14 -13
- package/build/testing-library/mocks.js.map +1 -1
- package/build/typed-routes/generate.d.ts +5 -1
- package/build/typed-routes/generate.d.ts.map +1 -1
- package/build/typed-routes/generate.js +129 -64
- package/build/typed-routes/generate.js.map +1 -1
- package/build/typed-routes/index.d.ts +5 -0
- package/build/typed-routes/index.d.ts.map +1 -1
- package/build/typed-routes/index.js +8 -3
- package/build/typed-routes/index.js.map +1 -1
- package/build/typed-routes/testSetup.d.ts +1 -1
- package/build/typed-routes/testSetup.d.ts.map +1 -1
- package/build/typed-routes/testSetup.js +29 -17
- package/build/typed-routes/testSetup.js.map +1 -1
- package/build/typed-routes/types.d.ts +43 -145
- package/build/typed-routes/types.d.ts.map +1 -1
- package/build/typed-routes/types.js.map +1 -1
- package/build/types.d.ts +33 -0
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/ui/TabContext.d.ts +157 -1
- package/build/ui/TabContext.d.ts.map +1 -1
- package/build/ui/TabContext.js +25 -1
- package/build/ui/TabContext.js.map +1 -1
- package/build/ui/TabList.d.ts +16 -0
- package/build/ui/TabList.d.ts.map +1 -1
- package/build/ui/TabList.js +16 -0
- package/build/ui/TabList.js.map +1 -1
- package/build/ui/TabSlot.d.ts +41 -5
- package/build/ui/TabSlot.d.ts.map +1 -1
- package/build/ui/TabSlot.js +36 -14
- package/build/ui/TabSlot.js.map +1 -1
- package/build/ui/TabTrigger.d.ts +50 -68
- package/build/ui/TabTrigger.d.ts.map +1 -1
- package/build/ui/TabTrigger.js +23 -1
- package/build/ui/TabTrigger.js.map +1 -1
- package/build/ui/Tabs.d.ts +96 -132
- package/build/ui/Tabs.d.ts.map +1 -1
- package/build/ui/Tabs.js +48 -8
- package/build/ui/Tabs.js.map +1 -1
- package/build/ui/common.d.ts +3 -3
- package/build/ui/common.d.ts.map +1 -1
- package/build/ui/common.js.map +1 -1
- package/build/useFocusEffect.d.ts +15 -6
- package/build/useFocusEffect.d.ts.map +1 -1
- package/build/useFocusEffect.js +15 -6
- package/build/useFocusEffect.js.map +1 -1
- package/build/useNavigation.d.ts +11 -5
- package/build/useNavigation.d.ts.map +1 -1
- package/build/useNavigation.js +11 -5
- package/build/useNavigation.js.map +1 -1
- package/build/views/Navigator.d.ts +6 -5
- package/build/views/Navigator.d.ts.map +1 -1
- package/build/views/Navigator.js +6 -5
- package/build/views/Navigator.js.map +1 -1
- package/build/views/Try.d.ts +1 -1
- package/build/views/Try.d.ts.map +1 -1
- package/build/views/Try.js.map +1 -1
- package/entry-classic.js +0 -6
- package/package.json +3 -4
- package/plugin/build/index.d.ts +2 -0
- package/plugin/options.json +74 -73
- package/rsc/entry.js +0 -6
- package/build/rsc/runtime.d.ts +0 -9
- package/build/rsc/runtime.d.ts.map +0 -1
- package/build/rsc/runtime.js +0 -36
- package/build/rsc/runtime.js.map +0 -1
- package/virtual-client-boundaries.js +0 -1
package/build/ui/TabContext.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { BottomTabNavigationOptions } from '@react-navigation/bottom-tabs';
|
|
2
3
|
import { DefaultNavigatorOptions, NavigationAction, NavigationProp, ParamListBase, TabActionHelpers, TabNavigationState, TabRouterOptions, useNavigationBuilder } from '@react-navigation/native';
|
|
3
4
|
import { TriggerMap } from './common';
|
|
4
5
|
export type ExpoTabsProps = ExpoTabsNavigatorOptions;
|
|
@@ -10,11 +11,17 @@ export type ExpoTabsNavigatorScreenOptions = {
|
|
|
10
11
|
};
|
|
11
12
|
export type ExpoTabsNavigatorOptions = DefaultNavigatorOptions<ParamListBase, string | undefined, TabNavigationState<ParamListBase>, ExpoTabsScreenOptions, TabNavigationEventMap, ExpoTabsNavigationProp<ParamListBase>> & Omit<TabRouterOptions, 'initialRouteName'> & ExpoTabsNavigatorScreenOptions;
|
|
12
13
|
export type ExpoTabsNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = NavigationProp<ParamList, RouteName, NavigatorID, TabNavigationState<ParamListBase>, ExpoTabsScreenOptions, TabNavigationEventMap>;
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export type ExpoTabsScreenOptions = Pick<BottomTabNavigationOptions, 'title' | 'lazy' | 'freezeOnBlur'> & {
|
|
14
18
|
params?: object;
|
|
15
19
|
title: string;
|
|
16
20
|
action: NavigationAction;
|
|
17
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
18
25
|
export type TabNavigationEventMap = {
|
|
19
26
|
/**
|
|
20
27
|
* Event which fires on tapping on the tab in the tab bar.
|
|
@@ -30,10 +37,159 @@ export type TabNavigationEventMap = {
|
|
|
30
37
|
data: undefined;
|
|
31
38
|
};
|
|
32
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* The React Navigation custom navigator
|
|
42
|
+
* @see https://reactnavigation.org/docs/custom-navigators/#usenavigationbuilder
|
|
43
|
+
*/
|
|
33
44
|
export type TabsContextValue = ReturnType<typeof useNavigationBuilder<TabNavigationState<any>, TabRouterOptions, TabActionHelpers<ParamListBase>, ExpoTabsNavigatorScreenOptions, TabNavigationEventMap>>;
|
|
34
45
|
export type TabContextValue = TabsDescriptor['options'];
|
|
35
46
|
export declare const TabContext: import("react").Context<ExpoTabsNavigatorScreenOptions>;
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
36
50
|
export declare const TabTriggerMapContext: import("react").Context<TriggerMap>;
|
|
51
|
+
/**
|
|
52
|
+
* @hidden
|
|
53
|
+
*/
|
|
54
|
+
export declare const TabsDescriptorsContext: import("react").Context<Record<string, import("@react-navigation/native").Descriptor<ExpoTabsNavigatorScreenOptions, Omit<{
|
|
55
|
+
dispatch(action: Readonly<{
|
|
56
|
+
type: string;
|
|
57
|
+
payload?: object | undefined;
|
|
58
|
+
source?: string | undefined;
|
|
59
|
+
target?: string | undefined;
|
|
60
|
+
}> | ((state: Readonly<TabNavigationState<any>>) => Readonly<{
|
|
61
|
+
type: string;
|
|
62
|
+
payload?: object | undefined;
|
|
63
|
+
source?: string | undefined;
|
|
64
|
+
target?: string | undefined;
|
|
65
|
+
}>)): void;
|
|
66
|
+
navigate<RouteName extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
|
|
67
|
+
navigate<RouteName_1 extends string>(options: {
|
|
68
|
+
name: string;
|
|
69
|
+
params: object | undefined;
|
|
70
|
+
path?: string | undefined;
|
|
71
|
+
merge?: boolean | undefined;
|
|
72
|
+
}): void;
|
|
73
|
+
navigateDeprecated<RouteName_2 extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
|
|
74
|
+
navigateDeprecated<RouteName_3 extends string>(options: {
|
|
75
|
+
name: string;
|
|
76
|
+
params: object | undefined;
|
|
77
|
+
merge?: boolean | undefined;
|
|
78
|
+
}): void;
|
|
79
|
+
preload<RouteName_4 extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
|
|
80
|
+
reset(state: TabNavigationState<any> | import("@react-navigation/native").PartialState<TabNavigationState<any>>): void;
|
|
81
|
+
goBack(): void;
|
|
82
|
+
isFocused(): boolean;
|
|
83
|
+
canGoBack(): boolean;
|
|
84
|
+
getId(): string | undefined;
|
|
85
|
+
getParent<T = import("@react-navigation/native").NavigationHelpers<ParamListBase, {}> | undefined>(id?: string | undefined): T;
|
|
86
|
+
getState(): TabNavigationState<any>;
|
|
87
|
+
setStateForNextRouteNamesChange(state: TabNavigationState<any> | import("@react-navigation/native").PartialState<TabNavigationState<any>>): void;
|
|
88
|
+
} & import("@react-navigation/native").PrivateValueStore<[ParamListBase, unknown, unknown]>, "getParent"> & {
|
|
89
|
+
getParent<T_1 = NavigationProp<ParamListBase, string, undefined, Readonly<{
|
|
90
|
+
key: string;
|
|
91
|
+
index: number;
|
|
92
|
+
routeNames: string[];
|
|
93
|
+
history?: unknown[] | undefined;
|
|
94
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
95
|
+
type: string;
|
|
96
|
+
stale: false;
|
|
97
|
+
}>, {}, {}> | undefined>(id?: string | undefined): T_1;
|
|
98
|
+
setParams(params: Partial<object | undefined>): void;
|
|
99
|
+
setOptions(options: Partial<ExpoTabsNavigatorScreenOptions>): void;
|
|
100
|
+
} & import("@react-navigation/native").EventConsumer<TabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<any>>> & import("@react-navigation/native").PrivateValueStore<[ParamListBase, string, TabNavigationEventMap]> & TabActionHelpers<ParamListBase>, import("@react-navigation/native").RouteProp<ParamListBase, string>>>>;
|
|
101
|
+
/**
|
|
102
|
+
* @hidden
|
|
103
|
+
*/
|
|
104
|
+
export declare const TabsNavigatorContext: import("react").Context<({
|
|
105
|
+
dispatch(action: Readonly<{
|
|
106
|
+
type: string;
|
|
107
|
+
payload?: object | undefined;
|
|
108
|
+
source?: string | undefined;
|
|
109
|
+
target?: string | undefined;
|
|
110
|
+
}> | ((state: Readonly<Readonly<{
|
|
111
|
+
key: string;
|
|
112
|
+
index: number;
|
|
113
|
+
routeNames: string[];
|
|
114
|
+
history?: unknown[] | undefined;
|
|
115
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
116
|
+
type: string;
|
|
117
|
+
stale: false;
|
|
118
|
+
}>>) => Readonly<{
|
|
119
|
+
type: string;
|
|
120
|
+
payload?: object | undefined;
|
|
121
|
+
source?: string | undefined;
|
|
122
|
+
target?: string | undefined;
|
|
123
|
+
}>)): void;
|
|
124
|
+
navigate<RouteName extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
|
|
125
|
+
navigate<RouteName_1 extends string>(options: {
|
|
126
|
+
name: string;
|
|
127
|
+
params: object | undefined;
|
|
128
|
+
path?: string | undefined;
|
|
129
|
+
merge?: boolean | undefined;
|
|
130
|
+
}): void;
|
|
131
|
+
navigateDeprecated<RouteName_2 extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
|
|
132
|
+
navigateDeprecated<RouteName_3 extends string>(options: {
|
|
133
|
+
name: string;
|
|
134
|
+
params: object | undefined;
|
|
135
|
+
merge?: boolean | undefined;
|
|
136
|
+
}): void;
|
|
137
|
+
preload<RouteName_4 extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
|
|
138
|
+
reset(state: Readonly<{
|
|
139
|
+
key: string;
|
|
140
|
+
index: number;
|
|
141
|
+
routeNames: string[];
|
|
142
|
+
history?: unknown[] | undefined;
|
|
143
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
144
|
+
type: string;
|
|
145
|
+
stale: false;
|
|
146
|
+
}> | import("@react-navigation/native").PartialState<Readonly<{
|
|
147
|
+
key: string;
|
|
148
|
+
index: number;
|
|
149
|
+
routeNames: string[];
|
|
150
|
+
history?: unknown[] | undefined;
|
|
151
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
152
|
+
type: string;
|
|
153
|
+
stale: false;
|
|
154
|
+
}>>): void;
|
|
155
|
+
goBack(): void;
|
|
156
|
+
isFocused(): boolean;
|
|
157
|
+
canGoBack(): boolean;
|
|
158
|
+
getId(): string | undefined;
|
|
159
|
+
getParent<T = import("@react-navigation/native").NavigationHelpers<ParamListBase, {}> | undefined>(id?: string | undefined): T;
|
|
160
|
+
getState(): Readonly<{
|
|
161
|
+
key: string;
|
|
162
|
+
index: number;
|
|
163
|
+
routeNames: string[];
|
|
164
|
+
history?: unknown[] | undefined;
|
|
165
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
166
|
+
type: string;
|
|
167
|
+
stale: false;
|
|
168
|
+
}>;
|
|
169
|
+
setStateForNextRouteNamesChange(state: Readonly<{
|
|
170
|
+
key: string;
|
|
171
|
+
index: number;
|
|
172
|
+
routeNames: string[];
|
|
173
|
+
history?: unknown[] | undefined;
|
|
174
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
175
|
+
type: string;
|
|
176
|
+
stale: false;
|
|
177
|
+
}> | import("@react-navigation/native").PartialState<Readonly<{
|
|
178
|
+
key: string;
|
|
179
|
+
index: number;
|
|
180
|
+
routeNames: string[];
|
|
181
|
+
history?: unknown[] | undefined;
|
|
182
|
+
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
183
|
+
type: string;
|
|
184
|
+
stale: false;
|
|
185
|
+
}>>): void;
|
|
186
|
+
} & import("@react-navigation/native").PrivateValueStore<[ParamListBase, unknown, unknown]> & import("@react-navigation/native").EventEmitter<TabNavigationEventMap> & {
|
|
187
|
+
setParams<RouteName_5 extends string>(params: Partial<object | undefined>): void;
|
|
188
|
+
} & TabActionHelpers<ParamListBase>) | null>;
|
|
189
|
+
/**
|
|
190
|
+
* @hidden
|
|
191
|
+
*/
|
|
192
|
+
export declare const TabsStateContext: import("react").Context<TabNavigationState<any>>;
|
|
37
193
|
export type Route = TabNavigationState<ParamListBase>['routes'][number];
|
|
38
194
|
export type TabsDescriptor = TabsContextValue['descriptors'][number];
|
|
39
195
|
//# sourceMappingURL=TabContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabContext.d.ts","sourceRoot":"","sources":["../../src/ui/TabContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAErD,MAAM,MA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AC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;AAExD,eAAO,MAAM,UAAU,yDAAqC,CAAC;AAC7D;;GAEG;AACH,eAAO,MAAM,oBAAoB,qCAAgC,CAAC;AAClE;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uWAAqD,CAAC;AACzF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAA6D,CAAC;AAC/F;;GAEG;AACH,eAAO,MAAM,gBAAgB,kDAS3B,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/build/ui/TabContext.js
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TabTriggerMapContext = exports.TabContext = void 0;
|
|
3
|
+
exports.TabsStateContext = exports.TabsNavigatorContext = exports.TabsDescriptorsContext = exports.TabTriggerMapContext = exports.TabContext = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
exports.TabContext = (0, react_1.createContext)({});
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
6
9
|
exports.TabTriggerMapContext = (0, react_1.createContext)({});
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
exports.TabsDescriptorsContext = (0, react_1.createContext)({});
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
exports.TabsNavigatorContext = (0, react_1.createContext)(null);
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
exports.TabsStateContext = (0, react_1.createContext)({
|
|
22
|
+
type: 'tab',
|
|
23
|
+
preloadedRouteKeys: [],
|
|
24
|
+
history: [],
|
|
25
|
+
index: -1,
|
|
26
|
+
key: '',
|
|
27
|
+
stale: false,
|
|
28
|
+
routeNames: [],
|
|
29
|
+
routes: [],
|
|
30
|
+
});
|
|
7
31
|
//# sourceMappingURL=TabContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabContext.js","sourceRoot":"","sources":["../../src/ui/TabContext.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TabContext.js","sourceRoot":"","sources":["../../src/ui/TabContext.tsx"],"names":[],"mappings":";;;AAWA,iCAAsC;AAgFzB,QAAA,UAAU,GAAG,IAAA,qBAAa,EAAkB,EAAE,CAAC,CAAC;AAC7D;;GAEG;AACU,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAAa,EAAE,CAAC,CAAC;AAClE;;GAEG;AACU,QAAA,sBAAsB,GAAG,IAAA,qBAAa,EAAkC,EAAE,CAAC,CAAC;AACzF;;GAEG;AACU,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAAwC,IAAI,CAAC,CAAC;AAC/F;;GAEG;AACU,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAA4B;IACvE,IAAI,EAAE,KAAK;IACX,kBAAkB,EAAE,EAAE;IACtB,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,CAAC,CAAC;IACT,GAAG,EAAE,EAAE;IACP,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,EAAE;IACd,MAAM,EAAE,EAAE;CACX,CAAC,CAAC","sourcesContent":["import { BottomTabNavigationOptions } from '@react-navigation/bottom-tabs';\nimport {\n DefaultNavigatorOptions,\n NavigationAction,\n NavigationProp,\n ParamListBase,\n TabActionHelpers,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport { createContext } from 'react';\n\nimport { TriggerMap } from './common';\n\nexport type ExpoTabsProps = ExpoTabsNavigatorOptions;\n\nexport type ExpoTabsNavigatorScreenOptions = {\n detachInactiveScreens?: boolean;\n unmountOnBlur?: boolean;\n freezeOnBlur?: boolean;\n lazy?: boolean;\n};\n\nexport type ExpoTabsNavigatorOptions = DefaultNavigatorOptions<\n ParamListBase,\n string | undefined,\n TabNavigationState<ParamListBase>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap,\n ExpoTabsNavigationProp<ParamListBase>\n> &\n // Should be set through `unstable_settings`\n Omit<TabRouterOptions, 'initialRouteName'> &\n ExpoTabsNavigatorScreenOptions;\n\nexport type ExpoTabsNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined,\n> = NavigationProp<\n ParamList,\n RouteName,\n NavigatorID,\n TabNavigationState<ParamListBase>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap\n>;\n\n/**\n * @hidden\n */\nexport type ExpoTabsScreenOptions = Pick<\n BottomTabNavigationOptions,\n 'title' | 'lazy' | 'freezeOnBlur'\n> & {\n params?: object;\n title: string;\n action: NavigationAction;\n};\n\n/**\n * @hidden\n */\nexport type TabNavigationEventMap = {\n /**\n * Event which fires on tapping on the tab in the tab bar.\n */\n tabPress: { data: undefined; canPreventDefault: true };\n /**\n * Event which fires on long press on the tab in the tab bar.\n */\n tabLongPress: { data: undefined };\n};\n\n/**\n * The React Navigation custom navigator\n * @see https://reactnavigation.org/docs/custom-navigators/#usenavigationbuilder\n */\nexport type TabsContextValue = ReturnType<\n typeof useNavigationBuilder<\n TabNavigationState<any>,\n TabRouterOptions,\n TabActionHelpers<ParamListBase>,\n ExpoTabsNavigatorScreenOptions,\n TabNavigationEventMap\n >\n>;\n\nexport type TabContextValue = TabsDescriptor['options'];\n\nexport const TabContext = createContext<TabContextValue>({});\n/**\n * @hidden\n */\nexport const TabTriggerMapContext = createContext<TriggerMap>({});\n/**\n * @hidden\n */\nexport const TabsDescriptorsContext = createContext<TabsContextValue['descriptors']>({});\n/**\n * @hidden\n */\nexport const TabsNavigatorContext = createContext<TabsContextValue['navigation'] | null>(null);\n/**\n * @hidden\n */\nexport const TabsStateContext = createContext<TabsContextValue['state']>({\n type: 'tab',\n preloadedRouteKeys: [],\n history: [],\n index: -1,\n key: '',\n stale: false,\n routeNames: [],\n routes: [],\n});\n\nexport type Route = TabNavigationState<ParamListBase>['routes'][number];\nexport type TabsDescriptor = TabsContextValue['descriptors'][number];\n"]}
|
package/build/ui/TabList.d.ts
CHANGED
|
@@ -4,6 +4,22 @@ export type TabListProps = ViewProps & {
|
|
|
4
4
|
/** Forward props to child component and removes the extra <View />. Useful for custom wrappers. */
|
|
5
5
|
asChild?: boolean;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Wrapper component for `<TabTriggers />`. `<TabTriggers />` within the `<TabList />` define the tabs.o
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* <Tabs>
|
|
13
|
+
* <TabSlot />
|
|
14
|
+
* <TabList>
|
|
15
|
+
* <TabTrigger name="home" href="/" />
|
|
16
|
+
* </TabList>
|
|
17
|
+
* </Tabs>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
7
20
|
export declare function TabList({ asChild, style, ...props }: TabListProps): import("react").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
8
24
|
export declare function isTabList(child: ReactElement<any>): child is ReactElement<ComponentProps<typeof TabList>>;
|
|
9
25
|
//# sourceMappingURL=TabList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../src/ui/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAI3D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG;IACrC,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,+BAGjE;AAED,wBAAgB,SAAS,CACvB,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,GACvB,KAAK,IAAI,YAAY,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,CAEvD"}
|
|
1
|
+
{"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../src/ui/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAI3D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG;IACrC,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,+BAGjE;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,GACvB,KAAK,IAAI,YAAY,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,CAEvD"}
|
package/build/ui/TabList.js
CHANGED
|
@@ -3,11 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isTabList = exports.TabList = void 0;
|
|
4
4
|
const react_native_1 = require("react-native");
|
|
5
5
|
const common_1 = require("./common");
|
|
6
|
+
/**
|
|
7
|
+
* Wrapper component for `<TabTriggers />`. `<TabTriggers />` within the `<TabList />` define the tabs.o
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* <Tabs>
|
|
12
|
+
* <TabSlot />
|
|
13
|
+
* <TabList>
|
|
14
|
+
* <TabTrigger name="home" href="/" />
|
|
15
|
+
* </TabList>
|
|
16
|
+
* </Tabs>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
6
19
|
function TabList({ asChild, style, ...props }) {
|
|
7
20
|
const Comp = asChild ? common_1.ViewSlot : react_native_1.View;
|
|
8
21
|
return <Comp style={[styles.tabList, style]} {...props}/>;
|
|
9
22
|
}
|
|
10
23
|
exports.TabList = TabList;
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
11
27
|
function isTabList(child) {
|
|
12
28
|
return child.type === TabList;
|
|
13
29
|
}
|
package/build/ui/TabList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../src/ui/TabList.tsx"],"names":[],"mappings":";;;AACA,+CAA2D;AAE3D,qCAAoC;AAOpC,SAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,EAAgB;IAChE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAQ,CAAC,CAAC,CAAC,mBAAI,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7D,CAAC;AAHD,0BAGC;AAED,SAAgB,SAAS,CACvB,KAAwB;IAExB,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC;AAJD,8BAIC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;IACD,UAAU,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;CACF,CAAC,CAAC","sourcesContent":["import { ReactElement, ComponentProps } from 'react';\nimport { View, StyleSheet, ViewProps } from 'react-native';\n\nimport { ViewSlot } from './common';\n\nexport type TabListProps = ViewProps & {\n /** Forward props to child component and removes the extra <View />. Useful for custom wrappers. */\n asChild?: boolean;\n};\n\nexport function TabList({ asChild, style, ...props }: TabListProps) {\n const Comp = asChild ? ViewSlot : View;\n return <Comp style={[styles.tabList, style]} {...props} />;\n}\n\nexport function isTabList(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof TabList>> {\n return child.type === TabList;\n}\n\nconst styles = StyleSheet.create({\n tabList: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n tabTrigger: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../src/ui/TabList.tsx"],"names":[],"mappings":";;;AACA,+CAA2D;AAE3D,qCAAoC;AAOpC;;;;;;;;;;;;GAYG;AACH,SAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,EAAgB;IAChE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAQ,CAAC,CAAC,CAAC,mBAAI,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7D,CAAC;AAHD,0BAGC;AAED;;GAEG;AACH,SAAgB,SAAS,CACvB,KAAwB;IAExB,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC;AAJD,8BAIC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;IACD,UAAU,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;CACF,CAAC,CAAC","sourcesContent":["import { ReactElement, ComponentProps } from 'react';\nimport { View, StyleSheet, ViewProps } from 'react-native';\n\nimport { ViewSlot } from './common';\n\nexport type TabListProps = ViewProps & {\n /** Forward props to child component and removes the extra <View />. Useful for custom wrappers. */\n asChild?: boolean;\n};\n\n/**\n * Wrapper component for `<TabTriggers />`. `<TabTriggers />` within the `<TabList />` define the tabs.o\n *\n * @example\n * ```ts\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function TabList({ asChild, style, ...props }: TabListProps) {\n const Comp = asChild ? ViewSlot : View;\n return <Comp style={[styles.tabList, style]} {...props} />;\n}\n\n/**\n * @hidden\n */\nexport function isTabList(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof TabList>> {\n return child.type === TabList;\n}\n\nconst styles = StyleSheet.create({\n tabList: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n tabTrigger: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n});\n"]}
|
package/build/ui/TabSlot.d.ts
CHANGED
|
@@ -3,22 +3,58 @@ import { ScreenContainer } from 'react-native-screens';
|
|
|
3
3
|
import { TabsDescriptor } from './TabContext';
|
|
4
4
|
import { TabListProps } from './TabList';
|
|
5
5
|
export type UseTabSlotOptions = ComponentProps<typeof ScreenContainer> & {
|
|
6
|
+
/** Remove inactive screens */
|
|
6
7
|
detachInactiveScreens?: boolean;
|
|
8
|
+
/** Override how the <Screen /> is rendered */
|
|
7
9
|
renderFn?: typeof defaultTabsSlotRender;
|
|
8
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Options provided to the UseTabSlotOptions.renderFn
|
|
13
|
+
*/
|
|
9
14
|
export type TabsSlotRenderOptions = {
|
|
15
|
+
/** Index of screen */
|
|
10
16
|
index: number;
|
|
17
|
+
/** Whether the screen is focused */
|
|
11
18
|
isFocused: boolean;
|
|
19
|
+
/** Whether the screen has been loaded */
|
|
12
20
|
loaded: boolean;
|
|
21
|
+
/** Should the screen be unloaded when inactive */
|
|
13
22
|
detachInactiveScreens: boolean;
|
|
14
23
|
};
|
|
15
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Returns a ReactElement of the current tab.
|
|
26
|
+
*
|
|
27
|
+
* @see `useTabSlot`
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* function MyTabSlot() {
|
|
32
|
+
* const slot = useTabSlot()
|
|
33
|
+
* return slot
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function useTabSlot(options?: UseTabSlotOptions): import("react").JSX.Element;
|
|
16
38
|
export type TabSlotProps = UseTabSlotOptions;
|
|
39
|
+
/**
|
|
40
|
+
* Renders the current tab.
|
|
41
|
+
*
|
|
42
|
+
* @see `useTabSlot`
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* <Tabs>
|
|
47
|
+
* <TabSlot />
|
|
48
|
+
* <TabList>
|
|
49
|
+
* <TabTrigger name="home" href="/" />
|
|
50
|
+
* </TabList>
|
|
51
|
+
* </Tabs>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
17
54
|
export declare function TabSlot(props: TabSlotProps): import("react").JSX.Element;
|
|
18
|
-
export declare function useTab(): {
|
|
19
|
-
options: import("./TabContext").ExpoTabsNavigatorScreenOptions;
|
|
20
|
-
setOptions: (options: Partial<{}>) => void;
|
|
21
|
-
};
|
|
22
55
|
export declare function defaultTabsSlotRender(descriptor: TabsDescriptor, { isFocused, loaded, detachInactiveScreens }: TabsSlotRenderOptions): import("react").JSX.Element | null;
|
|
56
|
+
/**
|
|
57
|
+
* @hidden
|
|
58
|
+
*/
|
|
23
59
|
export declare function isTabSlot(child: ReactElement<any>): child is ReactElement<TabListProps>;
|
|
24
60
|
//# sourceMappingURL=TabSlot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabSlot.d.ts","sourceRoot":"","sources":["../../src/ui/TabSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"TabSlot.d.ts","sourceRoot":"","sources":["../../src/ui/TabSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAU,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAc,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,GAAG;IACvE,8BAA8B;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,qBAAqB,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,MAAM,EAAE,OAAO,CAAC;IAChB,kDAAkD;IAClD,qBAAqB,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,+BAsCzD;AAED,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAE7C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAE1C;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,cAAc,EAC1B,EAAE,SAAS,EAAE,MAAM,EAAE,qBAAqB,EAAE,EAAE,qBAAqB,sCAuBpE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,KAAK,IAAI,YAAY,CAAC,YAAY,CAAC,CAEvF"}
|
package/build/ui/TabSlot.js
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTabSlot = exports.defaultTabsSlotRender = exports.
|
|
3
|
+
exports.isTabSlot = exports.defaultTabsSlotRender = exports.TabSlot = exports.useTabSlot = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
6
|
const react_native_screens_1 = require("react-native-screens");
|
|
7
7
|
const TabContext_1 = require("./TabContext");
|
|
8
|
-
const useNavigation_1 = require("../useNavigation");
|
|
9
8
|
const Navigator_1 = require("../views/Navigator");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Returns a ReactElement of the current tab.
|
|
11
|
+
*
|
|
12
|
+
* @see `useTabSlot`
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* function MyTabSlot() {
|
|
17
|
+
* const slot = useTabSlot()
|
|
18
|
+
* return slot
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function useTabSlot(options = {}) {
|
|
23
|
+
const { detachInactiveScreens = react_native_1.Platform.OS === 'web' ||
|
|
24
|
+
react_native_1.Platform.OS === 'android' ||
|
|
25
|
+
react_native_1.Platform.OS === 'ios', style, renderFn = defaultTabsSlotRender, } = options;
|
|
13
26
|
const { state, descriptors } = (0, Navigator_1.useNavigatorContext)();
|
|
14
27
|
const focusedRouteKey = state.routes[state.index].key;
|
|
15
28
|
const [loaded, setLoaded] = (0, react_1.useState)({ [focusedRouteKey]: true });
|
|
@@ -31,19 +44,25 @@ function useTabSlot({ detachInactiveScreens = react_native_1.Platform.OS === 'we
|
|
|
31
44
|
</react_native_screens_1.ScreenContainer>);
|
|
32
45
|
}
|
|
33
46
|
exports.useTabSlot = useTabSlot;
|
|
47
|
+
/**
|
|
48
|
+
* Renders the current tab.
|
|
49
|
+
*
|
|
50
|
+
* @see `useTabSlot`
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* <Tabs>
|
|
55
|
+
* <TabSlot />
|
|
56
|
+
* <TabList>
|
|
57
|
+
* <TabTrigger name="home" href="/" />
|
|
58
|
+
* </TabList>
|
|
59
|
+
* </Tabs>
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
34
62
|
function TabSlot(props) {
|
|
35
63
|
return useTabSlot(props);
|
|
36
64
|
}
|
|
37
65
|
exports.TabSlot = TabSlot;
|
|
38
|
-
function useTab() {
|
|
39
|
-
const navigation = (0, useNavigation_1.useNavigation)();
|
|
40
|
-
const options = (0, react_1.useContext)(TabContext_1.TabContext);
|
|
41
|
-
return {
|
|
42
|
-
options,
|
|
43
|
-
setOptions: navigation.setOptions,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
exports.useTab = useTab;
|
|
47
66
|
function defaultTabsSlotRender(descriptor, { isFocused, loaded, detachInactiveScreens }) {
|
|
48
67
|
const { lazy = true, unmountOnBlur, freezeOnBlur } = descriptor.options;
|
|
49
68
|
if (unmountOnBlur && !isFocused) {
|
|
@@ -58,6 +77,9 @@ function defaultTabsSlotRender(descriptor, { isFocused, loaded, detachInactiveSc
|
|
|
58
77
|
</react_native_screens_1.Screen>);
|
|
59
78
|
}
|
|
60
79
|
exports.defaultTabsSlotRender = defaultTabsSlotRender;
|
|
80
|
+
/**
|
|
81
|
+
* @hidden
|
|
82
|
+
*/
|
|
61
83
|
function isTabSlot(child) {
|
|
62
84
|
return child.type === TabSlot;
|
|
63
85
|
}
|
package/build/ui/TabSlot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabSlot.js","source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AAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CACtE;MAAA,CAAC,UAAU,CAAC,MAAM,EAAE,CACtB;IAAA,EAAE,6BAAM,CAAC,CACV,CAAC;AACJ,CAAC;AAzBD,sDAyBC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,KAAwB;IAChD,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC;AAFD,8BAEC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,MAAM;KACf;IACD,eAAe,EAAE;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,OAAO,EAAE;QACP,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,SAAS,EAAE;QACT,MAAM,EAAE,CAAC,CAAC;QACV,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;CACF,CAAC,CAAC","sourcesContent":["import { ComponentProps, ReactElement, useState } from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { ScreenContainer, Screen } from 'react-native-screens';\n\nimport { TabContext, TabsDescriptor } from './TabContext';\nimport { TabListProps } from './TabList';\nimport { useNavigatorContext } from '../views/Navigator';\n\nexport type UseTabSlotOptions = ComponentProps<typeof ScreenContainer> & {\n /** Remove inactive screens */\n detachInactiveScreens?: boolean;\n /** Override how the <Screen /> is rendered */\n renderFn?: typeof defaultTabsSlotRender;\n};\n\n/**\n * Options provided to the UseTabSlotOptions.renderFn\n */\nexport type TabsSlotRenderOptions = {\n /** Index of screen */\n index: number;\n /** Whether the screen is focused */\n isFocused: boolean;\n /** Whether the screen has been loaded */\n loaded: boolean;\n /** Should the screen be unloaded when inactive */\n detachInactiveScreens: boolean;\n};\n\n/**\n * Returns a ReactElement of the current tab.\n *\n * @see `useTabSlot`\n *\n * @example\n * ```ts\n * function MyTabSlot() {\n * const slot = useTabSlot()\n * return slot\n * }\n * ```\n */\nexport function useTabSlot(options: UseTabSlotOptions = {}) {\n const {\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n style,\n renderFn = defaultTabsSlotRender,\n } = options;\n\n const { state, descriptors } = useNavigatorContext();\n const focusedRouteKey = state.routes[state.index].key;\n const [loaded, setLoaded] = useState({ [focusedRouteKey]: true });\n\n if (!loaded[focusedRouteKey]) {\n setLoaded({ ...loaded, [focusedRouteKey]: true });\n }\n\n return (\n <ScreenContainer\n enabled={detachInactiveScreens}\n hasTwoStates\n style={[styles.screenContainer, style]}>\n {state.routes.map((route, index) => {\n const descriptor = descriptors[route.key] as unknown as TabsDescriptor;\n\n return (\n <TabContext.Provider key={descriptor.route.key} value={descriptor.options}>\n {renderFn(descriptor, {\n index,\n isFocused: state.index === index,\n loaded: loaded[route.key],\n detachInactiveScreens,\n })}\n </TabContext.Provider>\n );\n })}\n </ScreenContainer>\n );\n}\n\nexport type TabSlotProps = UseTabSlotOptions;\n\n/**\n * Renders the current tab.\n *\n * @see `useTabSlot`\n *\n * @example\n * ```ts\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function TabSlot(props: TabSlotProps) {\n return useTabSlot(props);\n}\n\nexport function defaultTabsSlotRender(\n descriptor: TabsDescriptor,\n { isFocused, loaded, detachInactiveScreens }: TabsSlotRenderOptions\n) {\n const { lazy = true, unmountOnBlur, freezeOnBlur } = descriptor.options;\n\n if (unmountOnBlur && !isFocused) {\n return null;\n }\n\n if (lazy && !loaded && !isFocused) {\n // Don't render a lazy screen if we've never navigated to it\n return null;\n }\n\n return (\n <Screen\n key={descriptor.route.key}\n enabled={detachInactiveScreens}\n activityState={isFocused ? 2 : 0}\n freezeOnBlur={freezeOnBlur}\n style={[styles.screen, isFocused ? styles.focused : styles.unfocused]}>\n {descriptor.render()}\n </Screen>\n );\n}\n\n/**\n * @hidden\n */\nexport function isTabSlot(child: ReactElement<any>): child is ReactElement<TabListProps> {\n return child.type === TabSlot;\n}\n\nconst styles = StyleSheet.create({\n screen: {\n flex: 1,\n position: 'relative',\n height: '100%',\n },\n screenContainer: {\n flexShrink: 0,\n flexGrow: 1,\n },\n focused: {\n zIndex: 1,\n display: 'flex',\n flexShrink: 0,\n flexGrow: 1,\n },\n unfocused: {\n zIndex: -1,\n display: 'none',\n flexShrink: 1,\n flexGrow: 0,\n },\n});\n"]}
|
package/build/ui/TabTrigger.d.ts
CHANGED
|
@@ -1,94 +1,76 @@
|
|
|
1
|
+
import { TabNavigationState } from '@react-navigation/native';
|
|
1
2
|
import { ReactNode, ReactElement, ComponentProps } from 'react';
|
|
2
3
|
import { View, PressableProps } from 'react-native';
|
|
3
4
|
import { ExpoTabsResetValue } from './TabRouter';
|
|
5
|
+
import type { TriggerMap } from './common';
|
|
4
6
|
import type { Href } from '../types';
|
|
5
7
|
type PressablePropsWithoutFunctionChildren = Omit<PressableProps, 'children'> & {
|
|
6
8
|
children?: ReactNode | undefined;
|
|
7
9
|
};
|
|
8
|
-
export type TabTriggerProps
|
|
10
|
+
export type TabTriggerProps = PressablePropsWithoutFunctionChildren & {
|
|
11
|
+
/** Name of tab. When used within a `<TabList />` this sets the name of the tab. Otherwise, this references the name. */
|
|
9
12
|
name: string;
|
|
10
|
-
|
|
13
|
+
/** Name of tab. Required when used within a `<TabList />` */
|
|
14
|
+
href?: Href;
|
|
11
15
|
/** Forward props to child component. Useful for custom wrappers. */
|
|
12
16
|
asChild?: boolean;
|
|
13
17
|
/** Reset the route when switching to the tab */
|
|
14
18
|
reset?: SwitchToOptions['reset'] | 'onLongPress';
|
|
15
19
|
};
|
|
16
|
-
export type TabTriggerOptions
|
|
20
|
+
export type TabTriggerOptions = {
|
|
17
21
|
name: string;
|
|
18
|
-
href: Href
|
|
22
|
+
href: Href;
|
|
19
23
|
};
|
|
20
24
|
export type TabTriggerSlotProps = PressablePropsWithoutFunctionChildren & React.RefAttributes<View> & {
|
|
21
25
|
isFocused?: boolean;
|
|
22
26
|
href?: string;
|
|
23
27
|
};
|
|
24
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Creates a trigger to navigate to a tab. `<TabTrigger />` functionality slightly changes when used as a child of `<TabList />`. In this instance, the `href` prop is required, and the trigger also defines what routes are present in the `<Tabs />`.
|
|
30
|
+
*
|
|
31
|
+
* When used outside of `<TabList />`, `<TabTrigger />` no longer requires a `href`.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* <Tabs>
|
|
36
|
+
* <TabSlot />
|
|
37
|
+
* <TabList>
|
|
38
|
+
* <TabTrigger name="home" href="/" />
|
|
39
|
+
* </TabList>
|
|
40
|
+
* </Tabs>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function TabTrigger({ asChild, name, href, reset, ...props }: TabTriggerProps): import("react").JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
25
47
|
export declare function isTabTrigger(child: ReactElement<any>): child is ReactElement<ComponentProps<typeof TabTrigger>>;
|
|
48
|
+
/**
|
|
49
|
+
* Options for `switchTab` function.
|
|
50
|
+
*/
|
|
26
51
|
export type SwitchToOptions = {
|
|
52
|
+
/** Navigate and reset the history */
|
|
27
53
|
reset?: ExpoTabsResetValue;
|
|
28
54
|
};
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
name: string;
|
|
34
|
-
href: string;
|
|
35
|
-
routeNode: import("../Route").RouteNode;
|
|
36
|
-
action: import("@react-navigation/routers").TabActionType | {
|
|
37
|
-
type: "JUMP_TO";
|
|
38
|
-
source?: string | undefined;
|
|
39
|
-
target?: string | undefined;
|
|
40
|
-
payload: {
|
|
41
|
-
name: string;
|
|
42
|
-
reset?: ExpoTabsResetValue | undefined;
|
|
43
|
-
params?: object | undefined;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
index: number;
|
|
47
|
-
isFocused: boolean;
|
|
48
|
-
route: import("@react-navigation/routers").NavigationRoute<import("@react-navigation/routers").ParamListBase, string>;
|
|
49
|
-
resolvedHref: string;
|
|
50
|
-
} | {
|
|
51
|
-
type: "external";
|
|
52
|
-
name: string;
|
|
53
|
-
href: string;
|
|
54
|
-
index: number;
|
|
55
|
-
isFocused: boolean;
|
|
56
|
-
route: import("@react-navigation/routers").NavigationRoute<import("@react-navigation/routers").ParamListBase, string>;
|
|
57
|
-
resolvedHref: string;
|
|
58
|
-
} | undefined;
|
|
59
|
-
trigger: {
|
|
60
|
-
type: "internal";
|
|
61
|
-
name: string;
|
|
62
|
-
href: string;
|
|
63
|
-
routeNode: import("../Route").RouteNode;
|
|
64
|
-
action: import("@react-navigation/routers").TabActionType | {
|
|
65
|
-
type: "JUMP_TO";
|
|
66
|
-
source?: string | undefined;
|
|
67
|
-
target?: string | undefined;
|
|
68
|
-
payload: {
|
|
69
|
-
name: string;
|
|
70
|
-
reset?: ExpoTabsResetValue | undefined;
|
|
71
|
-
params?: object | undefined;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
index: number;
|
|
75
|
-
isFocused: boolean;
|
|
76
|
-
route: import("@react-navigation/routers").NavigationRoute<import("@react-navigation/routers").ParamListBase, string>;
|
|
77
|
-
resolvedHref: string;
|
|
78
|
-
} | {
|
|
79
|
-
type: "external";
|
|
80
|
-
name: string;
|
|
81
|
-
href: string;
|
|
82
|
-
index: number;
|
|
83
|
-
isFocused: boolean;
|
|
84
|
-
route: import("@react-navigation/routers").NavigationRoute<import("@react-navigation/routers").ParamListBase, string>;
|
|
85
|
-
resolvedHref: string;
|
|
86
|
-
} | undefined;
|
|
87
|
-
triggerProps: {
|
|
88
|
-
isFocused: boolean;
|
|
89
|
-
onPress: (event: import("react-native").GestureResponderEvent) => void;
|
|
90
|
-
onLongPress: (event: import("react-native").GestureResponderEvent) => void;
|
|
91
|
-
};
|
|
55
|
+
export type Trigger = TriggerMap[string] & {
|
|
56
|
+
isFocused: boolean;
|
|
57
|
+
resolvedHref: string;
|
|
58
|
+
route: TabNavigationState<any>['routes'][number];
|
|
92
59
|
};
|
|
60
|
+
export type UseTabTriggerResult = {
|
|
61
|
+
switchTab: (name: string, options: SwitchToOptions) => void;
|
|
62
|
+
getTrigger: (name: string) => Trigger | undefined;
|
|
63
|
+
trigger?: Trigger;
|
|
64
|
+
triggerProps: TriggerProps;
|
|
65
|
+
};
|
|
66
|
+
export type TriggerProps = {
|
|
67
|
+
isFocused: boolean;
|
|
68
|
+
onPress: PressableProps['onPress'];
|
|
69
|
+
onLongPress: PressableProps['onLongPress'];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Utility hook creating custom `<TabTrigger />`
|
|
73
|
+
*/
|
|
74
|
+
export declare function useTabTrigger(options: TabTriggerProps): UseTabTriggerResult;
|
|
93
75
|
export {};
|
|
94
76
|
//# sourceMappingURL=TabTrigger.d.ts.map
|