@@ -56,27 +56,9 @@ import {
56
56
TabActions ,
57
57
} from ' @react-navigation/native' ;
58
58
59
- function TabNavigator ({
60
- id,
61
- initialRouteName,
62
- children,
63
- layout,
64
- screenListeners,
65
- screenOptions,
66
- screenLayout,
67
- tabBarStyle,
68
- contentStyle,
69
- }) {
59
+ function TabNavigator ({ tabBarStyle, contentStyle, ... rest }) {
70
60
const { state , navigation , descriptors , NavigationContent } =
71
- useNavigationBuilder (TabRouter, {
72
- id,
73
- initialRouteName,
74
- children,
75
- layout,
76
- screenListeners,
77
- screenOptions,
78
- screenLayout,
79
- });
61
+ useNavigationBuilder (TabRouter, rest);
80
62
81
63
return (
82
64
< NavigationContent>
@@ -210,7 +192,7 @@ import {
210
192
useNavigationBuilder ,
211
193
} from ' @react-navigation/native' ;
212
194
213
- // Props accepted by the view
195
+ // Additional props accepted by the view
214
196
type TabNavigationConfig = {
215
197
tabBarStyle: StyleProp< ViewStyle> ;
216
198
contentStyle: StyleProp< ViewStyle> ;
@@ -222,7 +204,6 @@ type TabNavigationOptions = {
222
204
};
223
205
224
206
// Map of event name and the type of data (in event.data)
225
- //
226
207
// canPreventDefault: true adds the defaultPrevented property to the
227
208
// emitted events.
228
209
type TabNavigationEventMap = {
@@ -242,35 +223,15 @@ type Props = DefaultNavigatorOptions<
242
223
TabRouterOptions &
243
224
TabNavigationConfig;
244
225
245
- function TabNavigator ({
246
- id,
247
- initialRouteName,
248
- children,
249
- layout,
250
- screenListeners,
251
- screenOptions,
252
- screenLayout,
253
- backBehavior,
254
- tabBarStyle,
255
- contentStyle,
256
- }: Props ) {
226
+ function TabNavigator ({ tabBarStyle, contentStyle, ... rest }: Props ) {
257
227
const { state , navigation , descriptors , NavigationContent } =
258
228
useNavigationBuilder<
259
229
TabNavigationState< ParamListBase> ,
260
230
TabRouterOptions,
261
231
TabActionHelpers< ParamListBase> ,
262
232
TabNavigationOptions,
263
233
TabNavigationEventMap
264
- > (TabRouter, {
265
- id,
266
- initialRouteName,
267
- children,
268
- layout,
269
- screenListeners,
270
- screenOptions,
271
- screenLayout,
272
- backBehavior,
273
- });
234
+ > (TabRouter, rest);
274
235
275
236
return (
276
237
< NavigationContent>
@@ -321,6 +282,7 @@ function TabNavigator({
321
282
);
322
283
}
323
284
285
+ // The factory function with generic types for type-inference
324
286
export function createMyNavigator<
325
287
const ParamList extends ParamListBase,
326
288
const NavigatorID extends string | undefined = undefined,
0 commit comments