react-native-tab-view 4.0.0-alpha.1 → 4.0.0-alpha.10

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 (50) hide show
  1. package/lib/commonjs/PanResponderAdapter.js.map +1 -1
  2. package/lib/commonjs/PlatformPressable.js +22 -1
  3. package/lib/commonjs/PlatformPressable.js.map +1 -1
  4. package/lib/commonjs/SceneView.js.map +1 -1
  5. package/lib/commonjs/TabBar.js +107 -91
  6. package/lib/commonjs/TabBar.js.map +1 -1
  7. package/lib/commonjs/TabBarIndicator.js +19 -14
  8. package/lib/commonjs/TabBarIndicator.js.map +1 -1
  9. package/lib/commonjs/TabBarItem.js +53 -72
  10. package/lib/commonjs/TabBarItem.js.map +1 -1
  11. package/lib/commonjs/TabBarItemLabel.js +3 -2
  12. package/lib/commonjs/TabBarItemLabel.js.map +1 -1
  13. package/lib/commonjs/TabView.js +1 -1
  14. package/lib/module/PanResponderAdapter.js.map +1 -1
  15. package/lib/module/PlatformPressable.js +22 -1
  16. package/lib/module/PlatformPressable.js.map +1 -1
  17. package/lib/module/SceneView.js.map +1 -1
  18. package/lib/module/TabBar.js +107 -91
  19. package/lib/module/TabBar.js.map +1 -1
  20. package/lib/module/TabBarIndicator.js +19 -14
  21. package/lib/module/TabBarIndicator.js.map +1 -1
  22. package/lib/module/TabBarItem.js +53 -72
  23. package/lib/module/TabBarItem.js.map +1 -1
  24. package/lib/module/TabBarItemLabel.js +3 -2
  25. package/lib/module/TabBarItemLabel.js.map +1 -1
  26. package/lib/module/TabView.js +1 -1
  27. package/lib/typescript/src/PlatformPressable.d.ts +3 -2
  28. package/lib/typescript/src/PlatformPressable.d.ts.map +1 -1
  29. package/lib/typescript/src/TabBar.d.ts +4 -15
  30. package/lib/typescript/src/TabBar.d.ts.map +1 -1
  31. package/lib/typescript/src/TabBarIndicator.d.ts.map +1 -1
  32. package/lib/typescript/src/TabBarItem.d.ts +2 -17
  33. package/lib/typescript/src/TabBarItem.d.ts.map +1 -1
  34. package/lib/typescript/src/TabView.d.ts +3 -3
  35. package/lib/typescript/src/TabView.d.ts.map +1 -1
  36. package/lib/typescript/src/index.d.ts +1 -1
  37. package/lib/typescript/src/index.d.ts.map +1 -1
  38. package/lib/typescript/src/types.d.ts +25 -1
  39. package/lib/typescript/src/types.d.ts.map +1 -1
  40. package/package.json +9 -9
  41. package/src/PanResponderAdapter.tsx +2 -2
  42. package/src/PlatformPressable.tsx +31 -2
  43. package/src/SceneView.tsx +2 -2
  44. package/src/TabBar.tsx +160 -162
  45. package/src/TabBarIndicator.tsx +19 -11
  46. package/src/TabBarItem.tsx +86 -110
  47. package/src/TabBarItemLabel.tsx +2 -1
  48. package/src/TabView.tsx +2 -2
  49. package/src/index.tsx +6 -1
  50. package/src/types.tsx +25 -1
package/src/SceneView.tsx CHANGED
@@ -84,8 +84,8 @@ export function SceneView<T extends Route>({
84
84
  layout.width
85
85
  ? { width: layout.width }
86
86
  : focused
87
- ? StyleSheet.absoluteFill
88
- : null,
87
+ ? StyleSheet.absoluteFill
88
+ : null,
89
89
  style,
90
90
  ]}
91
91
  >
package/src/TabBar.tsx CHANGED
@@ -30,6 +30,7 @@ import type {
30
30
  Route,
31
31
  Scene,
32
32
  SceneRendererProps,
33
+ TabDescriptor,
33
34
  } from './types';
34
35
  import { useAnimatedValue } from './useAnimatedValue';
35
36
 
@@ -41,23 +42,8 @@ export type Props<T extends Route> = SceneRendererProps & {
41
42
  inactiveColor?: string;
42
43
  pressColor?: string;
43
44
  pressOpacity?: number;
44
- getLabelText?: (scene: Scene<T>) => string | undefined;
45
- getAccessible?: (scene: Scene<T>) => boolean | undefined;
46
- getAccessibilityLabel?: (scene: Scene<T>) => string | undefined;
47
- getTestID?: (scene: Scene<T>) => string | undefined;
48
- renderLabel?: (
49
- scene: Scene<T> & {
50
- focused: boolean;
51
- color: string;
52
- }
53
- ) => React.ReactNode;
54
- renderIcon?: (
55
- scene: Scene<T> & {
56
- focused: boolean;
57
- color: string;
58
- }
59
- ) => React.ReactNode;
60
- renderBadge?: (scene: Scene<T>) => React.ReactNode;
45
+ options?: Record<string, TabDescriptor<T>>;
46
+ commonOptions?: TabDescriptor<T>;
61
47
  renderIndicator?: (props: IndicatorProps<T>) => React.ReactNode;
62
48
  renderTabBarItem?: (
63
49
  props: TabBarItemProps<T> & { key: string }
@@ -86,19 +72,25 @@ const getFlattenedTabWidth = (style: StyleProp<ViewStyle>) => {
86
72
  return tabStyle?.width;
87
73
  };
88
74
 
89
- const getFlattenedPaddingLeft = (style: StyleProp<ViewStyle>) => {
75
+ const getFlattenedPaddingStart = (style: StyleProp<ViewStyle>) => {
90
76
  const flattenStyle = StyleSheet.flatten(style);
91
77
 
92
78
  return flattenStyle
93
- ? flattenStyle.paddingLeft || flattenStyle.paddingHorizontal || 0
79
+ ? flattenStyle.paddingLeft ||
80
+ flattenStyle.paddingStart ||
81
+ flattenStyle.paddingHorizontal ||
82
+ 0
94
83
  : 0;
95
84
  };
96
85
 
97
- const getFlattenedPaddingRight = (style: StyleProp<ViewStyle>) => {
86
+ const getFlattenedPaddingEnd = (style: StyleProp<ViewStyle>) => {
98
87
  const flattenStyle = StyleSheet.flatten(style);
99
88
 
100
89
  return flattenStyle
101
- ? flattenStyle.paddingRight || flattenStyle.paddingHorizontal || 0
90
+ ? flattenStyle.paddingRight ||
91
+ flattenStyle.paddingEnd ||
92
+ flattenStyle.paddingHorizontal ||
93
+ 0
102
94
  : 0;
103
95
  };
104
96
 
@@ -127,8 +119,8 @@ const getComputedTabWidth = (
127
119
  scrollEnabled: boolean | undefined,
128
120
  tabWidths: { [key: string]: number },
129
121
  flattenedWidth: DimensionValue | undefined,
130
- flattenedPaddingLeft: DimensionValue | undefined,
131
- flattenedPaddingRight: DimensionValue | undefined,
122
+ flattenedPaddingStart: DimensionValue | undefined,
123
+ flattenedPaddingEnd: DimensionValue | undefined,
132
124
  gap?: number
133
125
  ) => {
134
126
  if (flattenedWidth === 'auto') {
@@ -153,8 +145,8 @@ const getComputedTabWidth = (
153
145
 
154
146
  const gapTotalWidth = (gap ?? 0) * (routes.length - 1);
155
147
  const paddingTotalWidth =
156
- convertPaddingPercentToSize(flattenedPaddingLeft, layout) +
157
- convertPaddingPercentToSize(flattenedPaddingRight, layout);
148
+ convertPaddingPercentToSize(flattenedPaddingStart, layout) +
149
+ convertPaddingPercentToSize(flattenedPaddingEnd, layout);
158
150
 
159
151
  return (layout.width - gapTotalWidth - paddingTotalWidth) / routes.length;
160
152
  };
@@ -180,21 +172,21 @@ const getTabBarWidth = <T extends Route>({
180
172
  gap,
181
173
  scrollEnabled,
182
174
  flattenedTabWidth,
183
- flattenedPaddingLeft,
184
- flattenedPaddingRight,
175
+ flattenedPaddingStart,
176
+ flattenedPaddingEnd,
185
177
  tabWidths,
186
178
  }: Pick<Props<T>, 'navigationState' | 'gap' | 'layout' | 'scrollEnabled'> & {
187
179
  tabWidths: Record<string, number>;
188
- flattenedPaddingLeft: DimensionValue | undefined;
189
- flattenedPaddingRight: DimensionValue | undefined;
180
+ flattenedPaddingStart: DimensionValue | undefined;
181
+ flattenedPaddingEnd: DimensionValue | undefined;
190
182
  flattenedTabWidth: DimensionValue | undefined;
191
183
  }) => {
192
184
  const { routes } = navigationState;
193
185
 
194
186
  const paddingsWidth = Math.max(
195
187
  0,
196
- convertPaddingPercentToSize(flattenedPaddingLeft, layout) +
197
- convertPaddingPercentToSize(flattenedPaddingRight, layout)
188
+ convertPaddingPercentToSize(flattenedPaddingStart, layout) +
189
+ convertPaddingPercentToSize(flattenedPaddingEnd, layout)
198
190
  );
199
191
 
200
192
  return routes.reduce<number>(
@@ -208,8 +200,8 @@ const getTabBarWidth = <T extends Route>({
208
200
  scrollEnabled,
209
201
  tabWidths,
210
202
  flattenedTabWidth,
211
- flattenedPaddingLeft,
212
- flattenedPaddingRight,
203
+ flattenedPaddingStart,
204
+ flattenedPaddingEnd,
213
205
  gap
214
206
  ),
215
207
  paddingsWidth
@@ -224,15 +216,15 @@ const normalizeScrollValue = <T extends Route>({
224
216
  tabWidths,
225
217
  value,
226
218
  flattenedTabWidth,
227
- flattenedPaddingLeft,
228
- flattenedPaddingRight,
219
+ flattenedPaddingStart,
220
+ flattenedPaddingEnd,
229
221
  direction,
230
222
  }: Pick<Props<T>, 'layout' | 'navigationState' | 'gap' | 'scrollEnabled'> & {
231
223
  tabWidths: Record<string, number>;
232
224
  value: number;
233
225
  flattenedTabWidth: DimensionValue | undefined;
234
- flattenedPaddingLeft: DimensionValue | undefined;
235
- flattenedPaddingRight: DimensionValue | undefined;
226
+ flattenedPaddingStart: DimensionValue | undefined;
227
+ flattenedPaddingEnd: DimensionValue | undefined;
236
228
  direction: LocaleDirection;
237
229
  }) => {
238
230
  const tabBarWidth = getTabBarWidth({
@@ -242,8 +234,8 @@ const normalizeScrollValue = <T extends Route>({
242
234
  gap,
243
235
  scrollEnabled,
244
236
  flattenedTabWidth,
245
- flattenedPaddingLeft,
246
- flattenedPaddingRight,
237
+ flattenedPaddingStart,
238
+ flattenedPaddingEnd,
247
239
  });
248
240
  const maxDistance = getMaxScrollDistance(tabBarWidth, layout.width);
249
241
  const scrollValue = Math.max(Math.min(value, maxDistance), 0);
@@ -264,20 +256,20 @@ const getScrollAmount = <T extends Route>({
264
256
  scrollEnabled,
265
257
  flattenedTabWidth,
266
258
  tabWidths,
267
- flattenedPaddingLeft,
268
- flattenedPaddingRight,
259
+ flattenedPaddingStart,
260
+ flattenedPaddingEnd,
269
261
  direction,
270
262
  }: Pick<Props<T>, 'layout' | 'navigationState' | 'scrollEnabled' | 'gap'> & {
271
263
  tabWidths: Record<string, number>;
272
264
  flattenedTabWidth: DimensionValue | undefined;
273
- flattenedPaddingLeft: DimensionValue | undefined;
274
- flattenedPaddingRight: DimensionValue | undefined;
265
+ flattenedPaddingStart: DimensionValue | undefined;
266
+ flattenedPaddingEnd: DimensionValue | undefined;
275
267
  direction: LocaleDirection;
276
268
  }) => {
277
269
  const paddingInitial =
278
270
  direction === 'rtl'
279
- ? convertPaddingPercentToSize(flattenedPaddingRight, layout)
280
- : convertPaddingPercentToSize(flattenedPaddingLeft, layout);
271
+ ? convertPaddingPercentToSize(flattenedPaddingEnd, layout)
272
+ : convertPaddingPercentToSize(flattenedPaddingStart, layout);
281
273
 
282
274
  const centerDistance = Array.from({
283
275
  length: navigationState.index + 1,
@@ -289,8 +281,8 @@ const getScrollAmount = <T extends Route>({
289
281
  scrollEnabled,
290
282
  tabWidths,
291
283
  flattenedTabWidth,
292
- flattenedPaddingLeft,
293
- flattenedPaddingRight,
284
+ flattenedPaddingStart,
285
+ flattenedPaddingEnd,
294
286
  gap
295
287
  );
296
288
 
@@ -313,12 +305,11 @@ const getScrollAmount = <T extends Route>({
313
305
  gap,
314
306
  scrollEnabled,
315
307
  flattenedTabWidth,
316
- flattenedPaddingLeft,
317
- flattenedPaddingRight,
308
+ flattenedPaddingStart,
309
+ flattenedPaddingEnd,
318
310
  direction,
319
311
  });
320
312
  };
321
-
322
313
  const getLabelTextDefault = ({ route }: Scene<Route>) => route.title;
323
314
 
324
315
  const getAccessibleDefault = ({ route }: Scene<Route>) =>
@@ -328,8 +319,8 @@ const getAccessibilityLabelDefault = ({ route }: Scene<Route>) =>
328
319
  typeof route.accessibilityLabel === 'string'
329
320
  ? route.accessibilityLabel
330
321
  : typeof route.title === 'string'
331
- ? route.title
332
- : undefined;
322
+ ? route.title
323
+ : undefined;
333
324
 
334
325
  const renderIndicatorDefault = (props: IndicatorProps<Route>) => (
335
326
  <TabBarIndicator {...props} />
@@ -342,10 +333,6 @@ const getTestIdDefault = ({ route }: Scene<Route>) => route.testID;
342
333
  const MEASURE_PER_BATCH = 10;
343
334
 
344
335
  export function TabBar<T extends Route>({
345
- getLabelText = getLabelTextDefault,
346
- getAccessible = getAccessibleDefault,
347
- getAccessibilityLabel = getAccessibilityLabelDefault,
348
- getTestID = getTestIdDefault,
349
336
  renderIndicator = renderIndicatorDefault,
350
337
  gap = 0,
351
338
  scrollEnabled,
@@ -363,9 +350,6 @@ export function TabBar<T extends Route>({
363
350
  onTabPress,
364
351
  pressColor,
365
352
  pressOpacity,
366
- renderBadge,
367
- renderIcon,
368
- renderLabel,
369
353
  direction = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr',
370
354
  renderTabBarItem,
371
355
  style,
@@ -373,6 +357,8 @@ export function TabBar<T extends Route>({
373
357
  layout: propLayout,
374
358
  testID,
375
359
  android_ripple,
360
+ options,
361
+ commonOptions,
376
362
  }: Props<T>) {
377
363
  const [layout, setLayout] = React.useState<Layout>(
378
364
  propLayout ?? { width: 0, height: 0 }
@@ -385,8 +371,8 @@ export function TabBar<T extends Route>({
385
371
  const { routes } = navigationState;
386
372
  const flattenedTabWidth = getFlattenedTabWidth(tabStyle);
387
373
  const isWidthDynamic = flattenedTabWidth === 'auto';
388
- const flattenedPaddingRight = getFlattenedPaddingRight(contentContainerStyle);
389
- const flattenedPaddingLeft = getFlattenedPaddingLeft(contentContainerStyle);
374
+ const flattenedPaddingEnd = getFlattenedPaddingEnd(contentContainerStyle);
375
+ const flattenedPaddingStart = getFlattenedPaddingStart(contentContainerStyle);
390
376
  const scrollOffset = getScrollAmount({
391
377
  layout,
392
378
  navigationState,
@@ -394,8 +380,8 @@ export function TabBar<T extends Route>({
394
380
  gap,
395
381
  scrollEnabled,
396
382
  flattenedTabWidth,
397
- flattenedPaddingLeft,
398
- flattenedPaddingRight,
383
+ flattenedPaddingStart,
384
+ flattenedPaddingEnd,
399
385
  direction,
400
386
  });
401
387
 
@@ -440,15 +426,15 @@ export function TabBar<T extends Route>({
440
426
  gap,
441
427
  scrollEnabled,
442
428
  flattenedTabWidth,
443
- flattenedPaddingLeft,
444
- flattenedPaddingRight,
429
+ flattenedPaddingStart,
430
+ flattenedPaddingEnd,
445
431
  });
446
432
 
447
433
  const separatorsWidth = Math.max(0, routes.length - 1) * gap;
448
434
  const paddingsWidth = Math.max(
449
435
  0,
450
- convertPaddingPercentToSize(flattenedPaddingLeft, layout) +
451
- convertPaddingPercentToSize(flattenedPaddingRight, layout)
436
+ convertPaddingPercentToSize(flattenedPaddingStart, layout) +
437
+ convertPaddingPercentToSize(flattenedPaddingEnd, layout)
452
438
  );
453
439
 
454
440
  const translateX = React.useMemo(
@@ -463,86 +449,103 @@ export function TabBar<T extends Route>({
463
449
 
464
450
  const renderItem = React.useCallback(
465
451
  ({ item: route, index }: ListRenderItemInfo<T>) => {
466
- const props: TabBarItemProps<T> & { key: string } = {
467
- key: route.key,
468
- position: position,
469
- route: route,
470
- navigationState: navigationState,
471
- getAccessibilityLabel: getAccessibilityLabel,
472
- getAccessible: getAccessible,
473
- getLabelText: getLabelText,
474
- getTestID: getTestID,
475
- renderBadge: renderBadge,
476
- renderIcon: renderIcon,
477
- renderLabel: renderLabel,
478
- activeColor: activeColor,
479
- inactiveColor: inactiveColor,
480
- pressColor: pressColor,
481
- pressOpacity: pressOpacity,
482
- onLayout: isWidthDynamic
483
- ? (e: LayoutChangeEvent) => {
484
- measuredTabWidths.current[route.key] = e.nativeEvent.layout.width;
452
+ const {
453
+ testID = getTestIdDefault({ route }),
454
+ labelText = getLabelTextDefault({ route }),
455
+ accessible = getAccessibleDefault({ route }),
456
+ accessibilityLabel = getAccessibilityLabelDefault({ route }),
457
+ ...rest
458
+ } = {
459
+ ...commonOptions,
460
+ ...options?.[route.key],
461
+ };
485
462
 
486
- // When we have measured widths for all of the tabs, we should updates the state
487
- // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
488
- // If we have more than 10 routes divide updating tabWidths into multiple batches. Here we update only first batch of 10 items.
489
- if (
490
- routes.length > MEASURE_PER_BATCH &&
491
- index === MEASURE_PER_BATCH &&
492
- routes
493
- .slice(0, MEASURE_PER_BATCH)
494
- .every(
495
- (r) => typeof measuredTabWidths.current[r.key] === 'number'
496
- )
497
- ) {
498
- setTabWidths({ ...measuredTabWidths.current });
499
- } else if (
500
- routes.every(
463
+ const onLayout = isWidthDynamic
464
+ ? (e: LayoutChangeEvent) => {
465
+ measuredTabWidths.current[route.key] = e.nativeEvent.layout.width;
466
+
467
+ // When we have measured widths for all of the tabs, we should updates the state
468
+ // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
469
+ // If we have more than 10 routes divide updating tabWidths into multiple batches. Here we update only first batch of 10 items.
470
+ if (
471
+ routes.length > MEASURE_PER_BATCH &&
472
+ index === MEASURE_PER_BATCH &&
473
+ routes
474
+ .slice(0, MEASURE_PER_BATCH)
475
+ .every(
501
476
  (r) => typeof measuredTabWidths.current[r.key] === 'number'
502
477
  )
503
- ) {
504
- // When we have measured widths for all of the tabs, we should updates the state
505
- // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
506
- setTabWidths({ ...measuredTabWidths.current });
507
- }
478
+ ) {
479
+ setTabWidths({ ...measuredTabWidths.current });
480
+ } else if (
481
+ routes.every(
482
+ (r) => typeof measuredTabWidths.current[r.key] === 'number'
483
+ )
484
+ ) {
485
+ // When we have measured widths for all of the tabs, we should updates the state
486
+ // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
487
+ setTabWidths({ ...measuredTabWidths.current });
508
488
  }
509
- : undefined,
510
- onPress: () => {
511
- const event: Scene<T> & Event = {
512
- route,
513
- defaultPrevented: false,
514
- preventDefault: () => {
515
- event.defaultPrevented = true;
516
- },
517
- };
489
+ }
490
+ : undefined;
491
+
492
+ const onPress = () => {
493
+ const event: Scene<T> & Event = {
494
+ route,
495
+ defaultPrevented: false,
496
+ preventDefault: () => {
497
+ event.defaultPrevented = true;
498
+ },
499
+ };
518
500
 
519
- onTabPress?.(event);
501
+ onTabPress?.(event);
520
502
 
521
- if (event.defaultPrevented) {
522
- return;
523
- }
503
+ if (event.defaultPrevented) {
504
+ return;
505
+ }
506
+
507
+ jumpTo(route.key);
508
+ };
524
509
 
525
- jumpTo(route.key);
526
- },
527
- onLongPress: () => onTabLongPress?.({ route }),
528
- labelStyle: labelStyle,
510
+ const onLongPress = () => onTabLongPress?.({ route });
511
+
512
+ // Calculate the default width for tab for FlatList to work
513
+ const defaultTabWidth = !isWidthDynamic
514
+ ? getComputedTabWidth(
515
+ index,
516
+ layout,
517
+ routes,
518
+ scrollEnabled,
519
+ tabWidths,
520
+ getFlattenedTabWidth(tabStyle),
521
+ getFlattenedPaddingEnd(contentContainerStyle),
522
+ getFlattenedPaddingStart(contentContainerStyle),
523
+ gap
524
+ )
525
+ : undefined;
526
+
527
+ const props = {
528
+ ...rest,
529
+ key: route.key,
530
+ position,
531
+ route,
532
+ navigationState,
533
+ testID,
534
+ labelText,
535
+ accessible,
536
+ accessibilityLabel,
537
+ activeColor,
538
+ inactiveColor,
539
+ pressColor,
540
+ pressOpacity,
541
+ onLayout,
542
+ onPress,
543
+ onLongPress,
544
+ labelStyle,
529
545
  style: tabStyle,
530
- // Calculate the deafult width for tab for FlatList to work
531
- defaultTabWidth: !isWidthDynamic
532
- ? getComputedTabWidth(
533
- index,
534
- layout,
535
- routes,
536
- scrollEnabled,
537
- tabWidths,
538
- getFlattenedTabWidth(tabStyle),
539
- getFlattenedPaddingRight(contentContainerStyle),
540
- getFlattenedPaddingLeft(contentContainerStyle),
541
- gap
542
- )
543
- : undefined,
546
+ defaultTabWidth,
544
547
  android_ripple,
545
- };
548
+ } satisfies TabBarItemProps<T> & { key: string };
546
549
 
547
550
  return (
548
551
  <>
@@ -556,33 +559,28 @@ export function TabBar<T extends Route>({
556
559
  );
557
560
  },
558
561
  [
562
+ position,
563
+ navigationState,
564
+ commonOptions,
565
+ options,
559
566
  activeColor,
560
- android_ripple,
561
- gap,
562
- getAccessibilityLabel,
563
- getAccessible,
564
- getLabelText,
565
- getTestID,
566
567
  inactiveColor,
568
+ pressColor,
569
+ pressOpacity,
567
570
  isWidthDynamic,
568
- jumpTo,
569
571
  labelStyle,
572
+ tabStyle,
570
573
  layout,
571
- navigationState,
572
- onTabLongPress,
573
- onTabPress,
574
- position,
575
- pressColor,
576
- pressOpacity,
577
- renderBadge,
578
- renderIcon,
579
- renderLabel,
580
- renderTabBarItem,
581
574
  routes,
582
575
  scrollEnabled,
583
- tabStyle,
584
- contentContainerStyle,
585
576
  tabWidths,
577
+ contentContainerStyle,
578
+ gap,
579
+ android_ripple,
580
+ renderTabBarItem,
581
+ onTabPress,
582
+ jumpTo,
583
+ onTabLongPress,
586
584
  ]
587
585
  );
588
586
 
@@ -656,7 +654,7 @@ export function TabBar<T extends Route>({
656
654
  ),
657
655
  style: [
658
656
  indicatorStyle,
659
- { left: flattenedPaddingLeft, right: flattenedPaddingRight },
657
+ { start: flattenedPaddingStart, end: flattenedPaddingEnd },
660
658
  ],
661
659
  getTabWidth: (i: number) =>
662
660
  getComputedTabWidth(
@@ -666,8 +664,8 @@ export function TabBar<T extends Route>({
666
664
  scrollEnabled,
667
665
  tabWidths,
668
666
  flattenedTabWidth,
669
- flattenedPaddingRight,
670
- flattenedPaddingLeft,
667
+ flattenedPaddingEnd,
668
+ flattenedPaddingStart,
671
669
  gap
672
670
  ),
673
671
  gap,
@@ -726,8 +724,8 @@ const styles = StyleSheet.create({
726
724
  indicatorContainer: {
727
725
  position: 'absolute',
728
726
  top: 0,
729
- left: 0,
730
- right: 0,
727
+ start: 0,
728
+ end: 0,
731
729
  bottom: 0,
732
730
  },
733
731
  });
@@ -131,19 +131,27 @@ export function TabBarIndicator<T extends Route>({
131
131
  );
132
132
  }
133
133
 
134
+ const styleList: StyleProp<ViewStyle> = [];
135
+
136
+ // scaleX doesn't work properly on chrome and opera for linux and android
137
+ if (Platform.OS === 'web' && width === 'auto') {
138
+ styleList.push(
139
+ { width: transform[1].scaleX },
140
+ { left: transform[0].translateX }
141
+ );
142
+ } else {
143
+ styleList.push(
144
+ { width: width === 'auto' ? 1 : width },
145
+ { start: `${(100 / routes.length) * navigationState.index}%` },
146
+ { transform }
147
+ );
148
+ }
149
+
134
150
  return (
135
151
  <Animated.View
136
152
  style={[
137
153
  styles.indicator,
138
- { width: width === 'auto' ? 1 : width },
139
- // If layout is not available, use `left` property for positioning the indicator
140
- // This avoids rendering delay until we are able to calculate translateX
141
- // If platform is macos use `left` property as `transform` is broken at the moment.
142
- // See: https://github.com/microsoft/react-native-macos/issues/280
143
- layout.width && Platform.OS !== 'macos'
144
- ? { left: 0 }
145
- : { left: `${(100 / routes.length) * navigationState.index}%` },
146
- { transform },
154
+ styleList,
147
155
  width === 'auto' ? { opacity: opacity } : null,
148
156
  style,
149
157
  ]}
@@ -157,9 +165,9 @@ const styles = StyleSheet.create({
157
165
  indicator: {
158
166
  backgroundColor: '#ffeb3b',
159
167
  position: 'absolute',
160
- left: 0,
168
+ start: 0,
161
169
  bottom: 0,
162
- right: 0,
170
+ end: 0,
163
171
  height: 2,
164
172
  },
165
173
  });