expo-router 4.0.0-preview.9 → 4.0.0

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.
Files changed (194) hide show
  1. package/assets/error.png +0 -0
  2. package/assets/file.png +0 -0
  3. package/assets/forward.png +0 -0
  4. package/assets/logotype.png +0 -0
  5. package/assets/pkg.png +0 -0
  6. package/assets/sitemap.png +0 -0
  7. package/build/ExpoRoot.js +2 -2
  8. package/build/ExpoRoot.js.map +1 -1
  9. package/build/doctor/index.d.ts +16 -0
  10. package/build/doctor/index.d.ts.map +1 -0
  11. package/build/doctor/index.js +66 -0
  12. package/build/doctor/index.js.map +1 -0
  13. package/build/exports.d.ts +1 -1
  14. package/build/exports.d.ts.map +1 -1
  15. package/build/exports.js +24 -2
  16. package/build/exports.js.map +1 -1
  17. package/build/fast-refresh.d.ts.map +1 -1
  18. package/build/fast-refresh.js.map +1 -1
  19. package/build/getRoutesCore.d.ts +1 -0
  20. package/build/getRoutesCore.d.ts.map +1 -1
  21. package/build/getRoutesCore.js +3 -1
  22. package/build/getRoutesCore.js.map +1 -1
  23. package/build/global-state/router-store.d.ts.map +1 -1
  24. package/build/global-state/router-store.js +1 -2
  25. package/build/global-state/router-store.js.map +1 -1
  26. package/build/global-state/routing.d.ts.map +1 -1
  27. package/build/global-state/routing.js +4 -0
  28. package/build/global-state/routing.js.map +1 -1
  29. package/build/head/url.d.ts +1 -0
  30. package/build/head/url.d.ts.map +1 -1
  31. package/build/head/url.js +21 -4
  32. package/build/head/url.js.map +1 -1
  33. package/build/hooks.d.ts +90 -38
  34. package/build/hooks.d.ts.map +1 -1
  35. package/build/hooks.js +46 -39
  36. package/build/hooks.js.map +1 -1
  37. package/build/imperative-api.d.ts +58 -15
  38. package/build/imperative-api.d.ts.map +1 -1
  39. package/build/imperative-api.js.map +1 -1
  40. package/build/layouts/Drawer.d.ts +2 -142
  41. package/build/layouts/Drawer.d.ts.map +1 -1
  42. package/build/layouts/Drawer.js +8 -5
  43. package/build/layouts/Drawer.js.map +1 -1
  44. package/build/layouts/DrawerClient.d.ts +144 -0
  45. package/build/layouts/DrawerClient.d.ts.map +1 -0
  46. package/build/layouts/DrawerClient.js +10 -0
  47. package/build/layouts/DrawerClient.js.map +1 -0
  48. package/build/layouts/Stack.d.ts +2 -126
  49. package/build/layouts/Stack.d.ts.map +1 -1
  50. package/build/layouts/Stack.js +8 -6
  51. package/build/layouts/Stack.js.map +1 -1
  52. package/build/layouts/StackClient.d.ts +128 -0
  53. package/build/layouts/StackClient.d.ts.map +1 -0
  54. package/build/layouts/StackClient.js +10 -0
  55. package/build/layouts/StackClient.js.map +1 -0
  56. package/build/layouts/Tabs.d.ts +2 -134
  57. package/build/layouts/Tabs.d.ts.map +1 -1
  58. package/build/layouts/Tabs.js +5 -37
  59. package/build/layouts/Tabs.js.map +1 -1
  60. package/build/layouts/TabsClient.d.ts +136 -0
  61. package/build/layouts/TabsClient.d.ts.map +1 -0
  62. package/build/layouts/TabsClient.js +44 -0
  63. package/build/layouts/TabsClient.js.map +1 -0
  64. package/build/layouts/withLayoutContext.d.ts +4 -1
  65. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  66. package/build/layouts/withLayoutContext.js +4 -1
  67. package/build/layouts/withLayoutContext.js.map +1 -1
  68. package/build/link/Link.d.ts +48 -4
  69. package/build/link/Link.d.ts.map +1 -1
  70. package/build/link/Link.js +47 -3
  71. package/build/link/Link.js.map +1 -1
  72. package/build/link/href.d.ts +1 -1
  73. package/build/link/href.d.ts.map +1 -1
  74. package/build/link/href.js.map +1 -1
  75. package/build/link/useLinkHooks.d.ts +122 -29
  76. package/build/link/useLinkHooks.d.ts.map +1 -1
  77. package/build/link/useLinkHooks.js.map +1 -1
  78. package/build/onboard/Tutorial.d.ts.map +1 -1
  79. package/build/onboard/Tutorial.js +140 -86
  80. package/build/onboard/Tutorial.js.map +1 -1
  81. package/build/renderRootComponent.d.ts.map +1 -1
  82. package/build/renderRootComponent.js +1 -2
  83. package/build/renderRootComponent.js.map +1 -1
  84. package/build/rsc/exports.d.ts +3 -1
  85. package/build/rsc/exports.d.ts.map +1 -1
  86. package/build/rsc/exports.js +3 -1
  87. package/build/rsc/exports.js.map +1 -1
  88. package/build/rsc/middleware.d.ts +1 -1
  89. package/build/rsc/middleware.d.ts.map +1 -1
  90. package/build/rsc/middleware.js +2 -1
  91. package/build/rsc/middleware.js.map +1 -1
  92. package/build/rsc/router/client.d.ts +2 -2
  93. package/build/rsc/router/client.d.ts.map +1 -1
  94. package/build/rsc/router/client.js.map +1 -1
  95. package/build/rsc/router/host.d.ts.map +1 -1
  96. package/build/rsc/router/host.js +20 -15
  97. package/build/rsc/router/host.js.map +1 -1
  98. package/build/rsc/rsc-renderer.d.ts +1 -1
  99. package/build/rsc/rsc-renderer.d.ts.map +1 -1
  100. package/build/rsc/rsc-renderer.js +1 -1
  101. package/build/rsc/rsc-renderer.js.map +1 -1
  102. package/build/rsc/server.d.ts +3 -0
  103. package/build/rsc/server.d.ts.map +1 -1
  104. package/build/rsc/server.js +19 -1
  105. package/build/rsc/server.js.map +1 -1
  106. package/build/testing-library/context-stubs.d.ts.map +1 -1
  107. package/build/testing-library/context-stubs.js +3 -1
  108. package/build/testing-library/context-stubs.js.map +1 -1
  109. package/build/testing-library/mocks.js +14 -13
  110. package/build/testing-library/mocks.js.map +1 -1
  111. package/build/typed-routes/generate.d.ts +5 -1
  112. package/build/typed-routes/generate.d.ts.map +1 -1
  113. package/build/typed-routes/generate.js +129 -64
  114. package/build/typed-routes/generate.js.map +1 -1
  115. package/build/typed-routes/index.d.ts +5 -0
  116. package/build/typed-routes/index.d.ts.map +1 -1
  117. package/build/typed-routes/index.js +8 -3
  118. package/build/typed-routes/index.js.map +1 -1
  119. package/build/typed-routes/testSetup.d.ts +1 -1
  120. package/build/typed-routes/testSetup.d.ts.map +1 -1
  121. package/build/typed-routes/testSetup.js +29 -17
  122. package/build/typed-routes/testSetup.js.map +1 -1
  123. package/build/typed-routes/types.d.ts +43 -145
  124. package/build/typed-routes/types.d.ts.map +1 -1
  125. package/build/typed-routes/types.js.map +1 -1
  126. package/build/types.d.ts +33 -0
  127. package/build/types.d.ts.map +1 -1
  128. package/build/types.js.map +1 -1
  129. package/build/ui/TabContext.d.ts +158 -1
  130. package/build/ui/TabContext.d.ts.map +1 -1
  131. package/build/ui/TabContext.js +25 -1
  132. package/build/ui/TabContext.js.map +1 -1
  133. package/build/ui/TabList.d.ts +17 -1
  134. package/build/ui/TabList.d.ts.map +1 -1
  135. package/build/ui/TabList.js +16 -0
  136. package/build/ui/TabList.js.map +1 -1
  137. package/build/ui/TabSlot.d.ts +55 -5
  138. package/build/ui/TabSlot.d.ts.map +1 -1
  139. package/build/ui/TabSlot.js +38 -14
  140. package/build/ui/TabSlot.js.map +1 -1
  141. package/build/ui/TabTrigger.d.ts +65 -70
  142. package/build/ui/TabTrigger.d.ts.map +1 -1
  143. package/build/ui/TabTrigger.js +25 -1
  144. package/build/ui/TabTrigger.js.map +1 -1
  145. package/build/ui/Tabs.d.ts +89 -132
  146. package/build/ui/Tabs.d.ts.map +1 -1
  147. package/build/ui/Tabs.js +53 -8
  148. package/build/ui/Tabs.js.map +1 -1
  149. package/build/ui/common.d.ts +3 -3
  150. package/build/ui/common.d.ts.map +1 -1
  151. package/build/ui/common.js.map +1 -1
  152. package/build/useFocusEffect.d.ts +15 -6
  153. package/build/useFocusEffect.d.ts.map +1 -1
  154. package/build/useFocusEffect.js +15 -6
  155. package/build/useFocusEffect.js.map +1 -1
  156. package/build/useNavigation.d.ts +11 -5
  157. package/build/useNavigation.d.ts.map +1 -1
  158. package/build/useNavigation.js +11 -5
  159. package/build/useNavigation.js.map +1 -1
  160. package/build/utils/splash.d.ts +6 -0
  161. package/build/utils/splash.d.ts.map +1 -0
  162. package/build/utils/splash.js +51 -0
  163. package/build/utils/splash.js.map +1 -0
  164. package/build/utils/url.js +2 -2
  165. package/build/utils/url.js.map +1 -1
  166. package/build/views/Navigator.d.ts +6 -5
  167. package/build/views/Navigator.d.ts.map +1 -1
  168. package/build/views/Navigator.js +6 -5
  169. package/build/views/Navigator.js.map +1 -1
  170. package/build/views/Sitemap.d.ts.map +1 -1
  171. package/build/views/Sitemap.js +93 -46
  172. package/build/views/Sitemap.js.map +1 -1
  173. package/build/views/Splash.d.ts +1 -1
  174. package/build/views/Splash.d.ts.map +1 -1
  175. package/build/views/Splash.js +3 -13
  176. package/build/views/Splash.js.map +1 -1
  177. package/build/views/Try.d.ts +1 -1
  178. package/build/views/Try.d.ts.map +1 -1
  179. package/build/views/Try.js +1 -1
  180. package/build/views/Try.js.map +1 -1
  181. package/doctor.js +1 -0
  182. package/entry-classic.js +0 -6
  183. package/package.json +23 -24
  184. package/plugin/build/index.d.ts +2 -0
  185. package/plugin/options.json +74 -73
  186. package/plugin/src/index.ts +64 -0
  187. package/rsc/entry.js +0 -6
  188. package/rsc/headers.d.ts +3 -0
  189. package/rsc/headers.js +5 -0
  190. package/build/rsc/runtime.d.ts +0 -9
  191. package/build/rsc/runtime.d.ts.map +0 -1
  192. package/build/rsc/runtime.js +0 -36
  193. package/build/rsc/runtime.js.map +0 -1
  194. package/virtual-client-boundaries.js +0 -1
@@ -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
- export type ExpoTabsScreenOptions = ExpoTabsNavigatorScreenOptions & {
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,160 @@ export type TabNavigationEventMap = {
30
37
  data: undefined;
31
38
  };
32
39
  };
40
+ /**
41
+ * The React Navigation custom navigator.
42
+ *
43
+ * @see [`useNavigationBuilder`](https://reactnavigation.org/docs/custom-navigators/#usenavigationbuilder) hook from React Navigation for more information.
44
+ */
33
45
  export type TabsContextValue = ReturnType<typeof useNavigationBuilder<TabNavigationState<any>, TabRouterOptions, TabActionHelpers<ParamListBase>, ExpoTabsNavigatorScreenOptions, TabNavigationEventMap>>;
34
46
  export type TabContextValue = TabsDescriptor['options'];
35
47
  export declare const TabContext: import("react").Context<ExpoTabsNavigatorScreenOptions>;
48
+ /**
49
+ * @hidden
50
+ */
36
51
  export declare const TabTriggerMapContext: import("react").Context<TriggerMap>;
52
+ /**
53
+ * @hidden
54
+ */
55
+ export declare const TabsDescriptorsContext: import("react").Context<Record<string, import("@react-navigation/native").Descriptor<ExpoTabsNavigatorScreenOptions, Omit<{
56
+ dispatch(action: Readonly<{
57
+ type: string;
58
+ payload?: object | undefined;
59
+ source?: string | undefined;
60
+ target?: string | undefined;
61
+ }> | ((state: Readonly<TabNavigationState<any>>) => Readonly<{
62
+ type: string;
63
+ payload?: object | undefined;
64
+ source?: string | undefined;
65
+ target?: string | undefined;
66
+ }>)): void;
67
+ navigate<RouteName extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
68
+ navigate<RouteName_1 extends string>(options: {
69
+ name: string;
70
+ params: object | undefined;
71
+ path?: string | undefined;
72
+ merge?: boolean | undefined;
73
+ }): void;
74
+ navigateDeprecated<RouteName_2 extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
75
+ navigateDeprecated<RouteName_3 extends string>(options: {
76
+ name: string;
77
+ params: object | undefined;
78
+ merge?: boolean | undefined;
79
+ }): void;
80
+ preload<RouteName_4 extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
81
+ reset(state: TabNavigationState<any> | import("@react-navigation/native").PartialState<TabNavigationState<any>>): void;
82
+ goBack(): void;
83
+ isFocused(): boolean;
84
+ canGoBack(): boolean;
85
+ getId(): string | undefined;
86
+ getParent<T = import("@react-navigation/native").NavigationHelpers<ParamListBase, {}> | undefined>(id?: string | undefined): T;
87
+ getState(): TabNavigationState<any>;
88
+ setStateForNextRouteNamesChange(state: TabNavigationState<any> | import("@react-navigation/native").PartialState<TabNavigationState<any>>): void;
89
+ } & import("@react-navigation/native").PrivateValueStore<[ParamListBase, unknown, unknown]>, "getParent"> & {
90
+ getParent<T_1 = NavigationProp<ParamListBase, string, undefined, Readonly<{
91
+ key: string;
92
+ index: number;
93
+ routeNames: string[];
94
+ history?: unknown[] | undefined;
95
+ routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
96
+ type: string;
97
+ stale: false;
98
+ }>, {}, {}> | undefined>(id?: string | undefined): T_1;
99
+ setParams(params: Partial<object | undefined>): void;
100
+ setOptions(options: Partial<ExpoTabsNavigatorScreenOptions>): void;
101
+ } & 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>>>>;
102
+ /**
103
+ * @hidden
104
+ */
105
+ export declare const TabsNavigatorContext: import("react").Context<({
106
+ dispatch(action: Readonly<{
107
+ type: string;
108
+ payload?: object | undefined;
109
+ source?: string | undefined;
110
+ target?: string | undefined;
111
+ }> | ((state: Readonly<Readonly<{
112
+ key: string;
113
+ index: number;
114
+ routeNames: string[];
115
+ history?: unknown[] | undefined;
116
+ routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
117
+ type: string;
118
+ stale: false;
119
+ }>>) => Readonly<{
120
+ type: string;
121
+ payload?: object | undefined;
122
+ source?: string | undefined;
123
+ target?: string | undefined;
124
+ }>)): void;
125
+ navigate<RouteName extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
126
+ navigate<RouteName_1 extends string>(options: {
127
+ name: string;
128
+ params: object | undefined;
129
+ path?: string | undefined;
130
+ merge?: boolean | undefined;
131
+ }): void;
132
+ navigateDeprecated<RouteName_2 extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
133
+ navigateDeprecated<RouteName_3 extends string>(options: {
134
+ name: string;
135
+ params: object | undefined;
136
+ merge?: boolean | undefined;
137
+ }): void;
138
+ preload<RouteName_4 extends string>(...args: [screen: string] | [screen: string, params: object | undefined]): void;
139
+ reset(state: Readonly<{
140
+ key: string;
141
+ index: number;
142
+ routeNames: string[];
143
+ history?: unknown[] | undefined;
144
+ routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
145
+ type: string;
146
+ stale: false;
147
+ }> | import("@react-navigation/native").PartialState<Readonly<{
148
+ key: string;
149
+ index: number;
150
+ routeNames: string[];
151
+ history?: unknown[] | undefined;
152
+ routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
153
+ type: string;
154
+ stale: false;
155
+ }>>): void;
156
+ goBack(): void;
157
+ isFocused(): boolean;
158
+ canGoBack(): boolean;
159
+ getId(): string | undefined;
160
+ getParent<T = import("@react-navigation/native").NavigationHelpers<ParamListBase, {}> | undefined>(id?: string | undefined): T;
161
+ getState(): Readonly<{
162
+ key: string;
163
+ index: number;
164
+ routeNames: string[];
165
+ history?: unknown[] | undefined;
166
+ routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
167
+ type: string;
168
+ stale: false;
169
+ }>;
170
+ setStateForNextRouteNamesChange(state: Readonly<{
171
+ key: string;
172
+ index: number;
173
+ routeNames: string[];
174
+ history?: unknown[] | undefined;
175
+ routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
176
+ type: string;
177
+ stale: false;
178
+ }> | import("@react-navigation/native").PartialState<Readonly<{
179
+ key: string;
180
+ index: number;
181
+ routeNames: string[];
182
+ history?: unknown[] | undefined;
183
+ routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
184
+ type: string;
185
+ stale: false;
186
+ }>>): void;
187
+ } & import("@react-navigation/native").PrivateValueStore<[ParamListBase, unknown, unknown]> & import("@react-navigation/native").EventEmitter<TabNavigationEventMap> & {
188
+ setParams<RouteName_5 extends string>(params: Partial<object | undefined>): void;
189
+ } & TabActionHelpers<ParamListBase>) | null>;
190
+ /**
191
+ * @hidden
192
+ */
193
+ export declare const TabsStateContext: import("react").Context<TabNavigationState<any>>;
37
194
  export type Route = TabNavigationState<ParamListBase>['routes'][number];
38
195
  export type TabsDescriptor = TabsContextValue['descriptors'][number];
39
196
  //# 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,MAAM,8BAA8B,GAAG;IAC3C,qBAAqB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C;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"}
@@ -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":";;;AAUA,iCAAsC;AAmEzB,QAAA,UAAU,GAAG,IAAA,qBAAa,EAAkB,EAAE,CAAC,CAAC;AAChD,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAAa,EAAE,CAAC,CAAC","sourcesContent":["import {\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\nexport type ExpoTabsScreenOptions = ExpoTabsNavigatorScreenOptions & {\n params?: object;\n title: string;\n action: NavigationAction;\n};\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\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>({});\nexport const TabTriggerMapContext = createContext<TriggerMap>({});\n\nexport type Route = TabNavigationState<ParamListBase>['routes'][number];\nexport type TabsDescriptor = TabsContextValue['descriptors'][number];\n"]}
1
+ {"version":3,"file":"TabContext.js","sourceRoot":"","sources":["../../src/ui/TabContext.tsx"],"names":[],"mappings":";;;AAWA,iCAAsC;AAiFzB,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 *\n * @see [`useNavigationBuilder`](https://reactnavigation.org/docs/custom-navigators/#usenavigationbuilder) hook from React Navigation for more information.\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"]}
@@ -1,9 +1,25 @@
1
1
  import { ReactElement, ComponentProps } from 'react';
2
2
  import { ViewProps } from 'react-native';
3
3
  export type TabListProps = ViewProps & {
4
- /** Forward props to child component and removes the extra <View />. Useful for custom wrappers. */
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.
9
+ *
10
+ * @example
11
+ * ```tsx
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"}
@@ -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.
8
+ *
9
+ * @example
10
+ * ```tsx
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
  }
@@ -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.\n *\n * @example\n * ```tsx\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"]}
@@ -3,22 +3,72 @@ 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
+ /**
7
+ * Remove inactive screens.
8
+ */
6
9
  detachInactiveScreens?: boolean;
10
+ /**
11
+ * Override how the `Screen` component is rendered.
12
+ */
7
13
  renderFn?: typeof defaultTabsSlotRender;
8
14
  };
15
+ /**
16
+ * Options provided to the `UseTabSlotOptions`.
17
+ */
9
18
  export type TabsSlotRenderOptions = {
19
+ /**
20
+ * Index of screen.
21
+ */
10
22
  index: number;
23
+ /**
24
+ * Whether the screen is focused.
25
+ */
11
26
  isFocused: boolean;
27
+ /**
28
+ * Whether the screen has been loaded.
29
+ */
12
30
  loaded: boolean;
31
+ /**
32
+ * Should the screen be unloaded when inactive.
33
+ */
13
34
  detachInactiveScreens: boolean;
14
35
  };
15
- export declare function useTabSlot({ detachInactiveScreens, style, renderFn, }?: UseTabSlotOptions): import("react").JSX.Element;
36
+ /**
37
+ *
38
+ * Returns a `ReactElement` of the current tab.
39
+ *
40
+ * @see [`useTabSlot`](#usetabslotoptions).
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * function MyTabSlot() {
45
+ * const slot = useTabSlot();
46
+ *
47
+ * return slot;
48
+ * }
49
+ * ```
50
+ */
51
+ export declare function useTabSlot(options?: UseTabSlotOptions): import("react").JSX.Element;
16
52
  export type TabSlotProps = UseTabSlotOptions;
53
+ /**
54
+ * Renders the current tab.
55
+ *
56
+ * @see [`useTabSlot`](#usetabslot) for a hook version of this component.
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * <Tabs>
61
+ * <TabSlot />
62
+ * <TabList>
63
+ * <TabTrigger name="home" href="/" />
64
+ * </TabList>
65
+ * </Tabs>
66
+ * ```
67
+ */
17
68
  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
69
  export declare function defaultTabsSlotRender(descriptor: TabsDescriptor, { isFocused, loaded, detachInactiveScreens }: TabsSlotRenderOptions): import("react").JSX.Element | null;
70
+ /**
71
+ * @hidden
72
+ */
23
73
  export declare function isTabSlot(child: ReactElement<any>): child is ReactElement<TabListProps>;
24
74
  //# 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,EAAwB,MAAM,OAAO,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAU,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAc,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzC,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,GAAG;IACvE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,qBAAqB,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,qBAEuB,EACvB,KAAK,EACL,QAAgC,GACjC,GAAE,iBAAsB,+BA8BxB;AAED,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAE7C,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAE1C;AAED,wBAAgB,MAAM;;;EAQrB;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,cAAc,EAC1B,EAAE,SAAS,EAAE,MAAM,EAAE,qBAAqB,EAAE,EAAE,qBAAqB,sCAuBpE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,KAAK,IAAI,YAAY,CAAC,YAAY,CAAC,CAEvF"}
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;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,qBAAqB,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,qBAAqB,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;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"}
@@ -1,15 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTabSlot = exports.defaultTabsSlotRender = exports.useTab = exports.TabSlot = exports.useTabSlot = void 0;
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
- function useTabSlot({ detachInactiveScreens = react_native_1.Platform.OS === 'web' ||
11
- react_native_1.Platform.OS === 'android' ||
12
- react_native_1.Platform.OS === 'ios', style, renderFn = defaultTabsSlotRender, } = {}) {
9
+ /**
10
+ *
11
+ * Returns a `ReactElement` of the current tab.
12
+ *
13
+ * @see [`useTabSlot`](#usetabslotoptions).
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * function MyTabSlot() {
18
+ * const slot = useTabSlot();
19
+ *
20
+ * return slot;
21
+ * }
22
+ * ```
23
+ */
24
+ function useTabSlot(options = {}) {
25
+ const { detachInactiveScreens = react_native_1.Platform.OS === 'web' ||
26
+ react_native_1.Platform.OS === 'android' ||
27
+ react_native_1.Platform.OS === 'ios', style, renderFn = defaultTabsSlotRender, } = options;
13
28
  const { state, descriptors } = (0, Navigator_1.useNavigatorContext)();
14
29
  const focusedRouteKey = state.routes[state.index].key;
15
30
  const [loaded, setLoaded] = (0, react_1.useState)({ [focusedRouteKey]: true });
@@ -31,19 +46,25 @@ function useTabSlot({ detachInactiveScreens = react_native_1.Platform.OS === 'we
31
46
  </react_native_screens_1.ScreenContainer>);
32
47
  }
33
48
  exports.useTabSlot = useTabSlot;
49
+ /**
50
+ * Renders the current tab.
51
+ *
52
+ * @see [`useTabSlot`](#usetabslot) for a hook version of this component.
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * <Tabs>
57
+ * <TabSlot />
58
+ * <TabList>
59
+ * <TabTrigger name="home" href="/" />
60
+ * </TabList>
61
+ * </Tabs>
62
+ * ```
63
+ */
34
64
  function TabSlot(props) {
35
65
  return useTabSlot(props);
36
66
  }
37
67
  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
68
  function defaultTabsSlotRender(descriptor, { isFocused, loaded, detachInactiveScreens }) {
48
69
  const { lazy = true, unmountOnBlur, freezeOnBlur } = descriptor.options;
49
70
  if (unmountOnBlur && !isFocused) {
@@ -58,6 +79,9 @@ function defaultTabsSlotRender(descriptor, { isFocused, loaded, detachInactiveSc
58
79
  </react_native_screens_1.Screen>);
59
80
  }
60
81
  exports.defaultTabsSlotRender = defaultTabsSlotRender;
82
+ /**
83
+ * @hidden
84
+ */
61
85
  function isTabSlot(child) {
62
86
  return child.type === TabSlot;
63
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TabSlot.js","sourceRoot":"","sources":["../../src/ui/TabSlot.tsx"],"names":[],"mappings":";;;AAAA,iCAA2E;AAC3E,+CAAoD;AACpD,+DAA+D;AAE/D,6CAA0D;AAE1D,oDAAiD;AACjD,kDAAyD;AAczD,SAAgB,UAAU,CAAC,EACzB,qBAAqB,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK;IAC3C,uBAAQ,CAAC,EAAE,KAAK,SAAS;IACzB,uBAAQ,CAAC,EAAE,KAAK,KAAK,EACvB,KAAK,EACL,QAAQ,GAAG,qBAAqB,MACX,EAAE;IACvB,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAA,+BAAmB,GAAE,CAAC;IACrD,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;IACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,eAAe,CAAC,EAAE,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AC;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, useContext } 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 { useNavigation } from '../useNavigation';\nimport { useNavigatorContext } from '../views/Navigator';\n\nexport type UseTabSlotOptions = ComponentProps<typeof ScreenContainer> & {\n detachInactiveScreens?: boolean;\n renderFn?: typeof defaultTabsSlotRender;\n};\n\nexport type TabsSlotRenderOptions = {\n index: number;\n isFocused: boolean;\n loaded: boolean;\n detachInactiveScreens: boolean;\n};\n\nexport function useTabSlot({\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n style,\n renderFn = defaultTabsSlotRender,\n}: UseTabSlotOptions = {}) {\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\nexport function TabSlot(props: TabSlotProps) {\n return useTabSlot(props);\n}\n\nexport function useTab() {\n const navigation = useNavigation();\n const options = useContext(TabContext);\n\n return {\n options,\n setOptions: navigation.setOptions,\n };\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\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"]}
1
+ {"version":3,"file":"TabSlot.js","sourceRoot":"","sources":["../../src/ui/TabSlot.tsx"],"names":[],"mappings":";;;AAAA,iCAA+D;AAC/D,+CAAoD;AACpD,+DAA+D;AAE/D,6CAA0D;AAE1D,kDAAyD;AAmCzD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,UAAU,CAAC,UAA6B,EAAE;IACxD,MAAM,EACJ,qBAAqB,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK;QAC3C,uBAAQ,CAAC,EAAE,KAAK,SAAS;QACzB,uBAAQ,CAAC,EAAE,KAAK,KAAK,EACvB,K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ACN,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 /**\n * Remove inactive screens.\n */\n detachInactiveScreens?: boolean;\n /**\n * Override how the `Screen` component is rendered.\n */\n renderFn?: typeof defaultTabsSlotRender;\n};\n\n/**\n * Options provided to the `UseTabSlotOptions`.\n */\nexport type TabsSlotRenderOptions = {\n /**\n * Index of screen.\n */\n index: number;\n /**\n * Whether the screen is focused.\n */\n isFocused: boolean;\n /**\n * Whether the screen has been loaded.\n */\n loaded: boolean;\n /**\n * Should the screen be unloaded when inactive.\n */\n detachInactiveScreens: boolean;\n};\n\n/**\n *\n * Returns a `ReactElement` of the current tab.\n *\n * @see [`useTabSlot`](#usetabslotoptions).\n *\n * @example\n * ```tsx\n * function MyTabSlot() {\n * const slot = useTabSlot();\n *\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`](#usetabslot) for a hook version of this component.\n *\n * @example\n * ```tsx\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"]}