react-native-tab-view 3.1.1 → 3.2.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 (59) hide show
  1. package/README.md +9 -1
  2. package/lib/commonjs/Pager.android.js.map +1 -1
  3. package/lib/commonjs/Pager.ios.js.map +1 -1
  4. package/lib/commonjs/Pager.js.map +1 -1
  5. package/lib/commonjs/PagerViewAdapter.js +17 -15
  6. package/lib/commonjs/PagerViewAdapter.js.map +1 -1
  7. package/lib/commonjs/PanResponderAdapter.js +20 -16
  8. package/lib/commonjs/PanResponderAdapter.js.map +1 -1
  9. package/lib/commonjs/PlatformPressable.js +19 -15
  10. package/lib/commonjs/PlatformPressable.js.map +1 -1
  11. package/lib/commonjs/SceneMap.js +14 -11
  12. package/lib/commonjs/SceneMap.js.map +1 -1
  13. package/lib/commonjs/SceneView.js +2 -2
  14. package/lib/commonjs/SceneView.js.map +1 -1
  15. package/lib/commonjs/TabBar.js +124 -81
  16. package/lib/commonjs/TabBar.js.map +1 -1
  17. package/lib/commonjs/TabBarIndicator.js +7 -6
  18. package/lib/commonjs/TabBarIndicator.js.map +1 -1
  19. package/lib/commonjs/TabBarItem.js +7 -6
  20. package/lib/commonjs/TabBarItem.js.map +1 -1
  21. package/lib/commonjs/TabView.js +40 -33
  22. package/lib/commonjs/TabView.js.map +1 -1
  23. package/lib/commonjs/index.js +6 -6
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/types.js +4 -0
  26. package/lib/commonjs/types.js.map +1 -1
  27. package/lib/commonjs/useAnimatedValue.js.map +1 -1
  28. package/lib/module/Pager.android.js.map +1 -1
  29. package/lib/module/Pager.ios.js.map +1 -1
  30. package/lib/module/Pager.js.map +1 -1
  31. package/lib/module/PagerViewAdapter.js +17 -15
  32. package/lib/module/PagerViewAdapter.js.map +1 -1
  33. package/lib/module/PanResponderAdapter.js +20 -16
  34. package/lib/module/PanResponderAdapter.js.map +1 -1
  35. package/lib/module/PlatformPressable.js +19 -15
  36. package/lib/module/PlatformPressable.js.map +1 -1
  37. package/lib/module/SceneMap.js +14 -11
  38. package/lib/module/SceneMap.js.map +1 -1
  39. package/lib/module/SceneView.js +2 -2
  40. package/lib/module/SceneView.js.map +1 -1
  41. package/lib/module/TabBar.js +125 -81
  42. package/lib/module/TabBar.js.map +1 -1
  43. package/lib/module/TabBarIndicator.js +7 -6
  44. package/lib/module/TabBarIndicator.js.map +1 -1
  45. package/lib/module/TabBarItem.js +7 -6
  46. package/lib/module/TabBarItem.js.map +1 -1
  47. package/lib/module/TabView.js +39 -32
  48. package/lib/module/TabView.js.map +1 -1
  49. package/lib/module/index.js.map +1 -1
  50. package/lib/module/types.js +1 -1
  51. package/lib/module/types.js.map +1 -1
  52. package/lib/module/useAnimatedValue.js.map +1 -1
  53. package/lib/typescript/TabBar.d.ts +3 -1
  54. package/lib/typescript/TabBarIndicator.d.ts +1 -0
  55. package/lib/typescript/TabView.d.ts +2 -1
  56. package/package.json +19 -18
  57. package/src/TabBar.tsx +75 -31
  58. package/src/TabBarIndicator.tsx +14 -5
  59. package/src/TabView.tsx +3 -0
@@ -21,9 +21,20 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
21
 
22
22
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
23
 
24
+ const Separator = _ref => {
25
+ let {
26
+ width
27
+ } = _ref;
28
+ return /*#__PURE__*/React.createElement(_reactNative.View, {
29
+ style: {
30
+ width
31
+ }
32
+ });
33
+ };
34
+
24
35
  class TabBar extends React.Component {
25
- constructor(...args) {
26
- super(...args);
36
+ constructor() {
37
+ super(...arguments);
27
38
 
28
39
  _defineProperty(this, "state", {
29
40
  layout: {
@@ -37,7 +48,7 @@ class TabBar extends React.Component {
37
48
 
38
49
  _defineProperty(this, "scrollAmount", new _reactNative.Animated.Value(0));
39
50
 
40
- _defineProperty(this, "scrollViewRef", /*#__PURE__*/React.createRef());
51
+ _defineProperty(this, "flatListRef", /*#__PURE__*/React.createRef());
41
52
 
42
53
  _defineProperty(this, "getFlattenedTabWidth", style => {
43
54
  const tabStyle = _reactNative.StyleSheet.flatten(style);
@@ -86,7 +97,7 @@ class TabBar extends React.Component {
86
97
  const {
87
98
  routes
88
99
  } = props.navigationState;
89
- return routes.reduce((acc, _, i) => acc + this.getComputedTabWidth(i, layout, routes, scrollEnabled, tabWidths, this.getFlattenedTabWidth(tabStyle)), 0);
100
+ return routes.reduce((acc, _, i) => acc + (i > 0 ? props.gap ?? 0 : 0) + this.getComputedTabWidth(i, layout, routes, scrollEnabled, tabWidths, this.getFlattenedTabWidth(tabStyle)), 0);
90
101
  });
91
102
 
92
103
  _defineProperty(this, "normalizeScrollValue", (props, state, value) => {
@@ -124,7 +135,7 @@ class TabBar extends React.Component {
124
135
  const tabWidth = this.getComputedTabWidth(i, layout, routes, scrollEnabled, tabWidths, this.getFlattenedTabWidth(tabStyle)); // To get the current index centered we adjust scroll amount by width of indexes
125
136
  // 0 through (i - 1) and add half the width of current index i
126
137
 
127
- return total + (index === i ? tabWidth / 2 : tabWidth);
138
+ return total + (index === i ? (tabWidth + (props.gap ?? 0)) / 2 : tabWidth + (props.gap ?? 0));
128
139
  }, 0);
129
140
  const scrollAmount = centerDistance - layout.width / 2;
130
141
  return this.normalizeScrollValue(props, state, scrollAmount);
@@ -132,10 +143,10 @@ class TabBar extends React.Component {
132
143
 
133
144
  _defineProperty(this, "resetScroll", index => {
134
145
  if (this.props.scrollEnabled) {
135
- var _this$scrollViewRef$c;
146
+ var _this$flatListRef$cur;
136
147
 
137
- (_this$scrollViewRef$c = this.scrollViewRef.current) === null || _this$scrollViewRef$c === void 0 ? void 0 : _this$scrollViewRef$c.scrollTo({
138
- x: this.getScrollAmount(this.props, this.state, index),
148
+ (_this$flatListRef$cur = this.flatListRef.current) === null || _this$flatListRef$cur === void 0 ? void 0 : _this$flatListRef$cur.scrollToOffset({
149
+ offset: this.getScrollAmount(this.props, this.state, index),
139
150
  animated: true
140
151
  });
141
152
  }
@@ -209,7 +220,8 @@ class TabBar extends React.Component {
209
220
  indicatorStyle,
210
221
  contentContainerStyle,
211
222
  style,
212
- indicatorContainerStyle
223
+ indicatorContainerStyle,
224
+ gap = 0
213
225
  } = this.props;
214
226
  const {
215
227
  layout,
@@ -220,6 +232,8 @@ class TabBar extends React.Component {
220
232
  } = navigationState;
221
233
  const isWidthDynamic = this.getFlattenedTabWidth(tabStyle) === 'auto';
222
234
  const tabBarWidth = this.getTabBarWidth(this.props, this.state);
235
+ const separatorsWidth = Math.max(0, routes.length - 1) * gap;
236
+ const separatorPercent = separatorsWidth / tabBarWidth * 100;
223
237
  const tabBarWidthPercent = `${routes.length * 40}%`;
224
238
  const translateX = this.getTranslateX(this.scrollAmount, this.getMaxScrollDistance(tabBarWidth, layout.width));
225
239
  return /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
@@ -231,8 +245,8 @@ class TabBar extends React.Component {
231
245
  transform: [{
232
246
  translateX
233
247
  }]
234
- } : null, tabBarWidth ? {
235
- width: tabBarWidth
248
+ } : null, tabBarWidth > separatorsWidth ? {
249
+ width: tabBarWidth - separatorsWidth
236
250
  } : scrollEnabled ? {
237
251
  width: tabBarWidthPercent
238
252
  } : null, indicatorContainerStyle]
@@ -241,12 +255,15 @@ class TabBar extends React.Component {
241
255
  layout,
242
256
  navigationState,
243
257
  jumpTo,
244
- width: isWidthDynamic ? 'auto' : `${100 / routes.length}%`,
258
+ width: isWidthDynamic ? 'auto' : `${(100 - separatorPercent) / routes.length}%`,
245
259
  style: indicatorStyle,
246
- getTabWidth: i => this.getComputedTabWidth(i, layout, routes, scrollEnabled, tabWidths, this.getFlattenedTabWidth(tabStyle))
260
+ getTabWidth: i => this.getComputedTabWidth(i, layout, routes, scrollEnabled, tabWidths, this.getFlattenedTabWidth(tabStyle)),
261
+ gap
247
262
  })), /*#__PURE__*/React.createElement(_reactNative.View, {
248
263
  style: styles.scroll
249
- }, /*#__PURE__*/React.createElement(_reactNative.Animated.ScrollView, {
264
+ }, /*#__PURE__*/React.createElement(_reactNative.Animated.FlatList, {
265
+ data: routes,
266
+ keyExtractor: item => item.key,
250
267
  horizontal: true,
251
268
  accessibilityRole: "tablist",
252
269
  keyboardShouldPersistTaps: "handled",
@@ -255,12 +272,76 @@ class TabBar extends React.Component {
255
272
  alwaysBounceHorizontal: false,
256
273
  scrollsToTop: false,
257
274
  showsHorizontalScrollIndicator: false,
275
+ showsVerticalScrollIndicator: false,
258
276
  automaticallyAdjustContentInsets: false,
259
277
  overScrollMode: "never",
260
278
  contentContainerStyle: [styles.tabContent, scrollEnabled ? {
261
- width: tabBarWidth || tabBarWidthPercent
279
+ width: tabBarWidth > separatorsWidth ? tabBarWidth : tabBarWidthPercent
262
280
  } : styles.container, contentContainerStyle],
263
281
  scrollEventThrottle: 16,
282
+ renderItem: _ref2 => {
283
+ let {
284
+ item: route,
285
+ index
286
+ } = _ref2;
287
+ const props = {
288
+ key: route.key,
289
+ position: position,
290
+ route: route,
291
+ navigationState: navigationState,
292
+ getAccessibilityLabel: getAccessibilityLabel,
293
+ getAccessible: getAccessible,
294
+ getLabelText: getLabelText,
295
+ getTestID: getTestID,
296
+ renderBadge: renderBadge,
297
+ renderIcon: renderIcon,
298
+ renderLabel: renderLabel,
299
+ activeColor: activeColor,
300
+ inactiveColor: inactiveColor,
301
+ pressColor: pressColor,
302
+ pressOpacity: pressOpacity,
303
+ onLayout: isWidthDynamic ? e => {
304
+ this.measuredTabWidths[route.key] = e.nativeEvent.layout.width; // When we have measured widths for all of the tabs, we should updates the state
305
+ // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
306
+
307
+ if (routes.every(r => typeof this.measuredTabWidths[r.key] === 'number')) {
308
+ this.setState({
309
+ tabWidths: { ...this.measuredTabWidths
310
+ }
311
+ });
312
+ }
313
+ } : undefined,
314
+ onPress: () => {
315
+ const event = {
316
+ route,
317
+ defaultPrevented: false,
318
+ preventDefault: () => {
319
+ event.defaultPrevented = true;
320
+ }
321
+ };
322
+ onTabPress === null || onTabPress === void 0 ? void 0 : onTabPress(event);
323
+
324
+ if (event.defaultPrevented) {
325
+ return;
326
+ }
327
+
328
+ this.props.jumpTo(route.key);
329
+ },
330
+ onLongPress: () => onTabLongPress === null || onTabLongPress === void 0 ? void 0 : onTabLongPress({
331
+ route
332
+ }),
333
+ labelStyle: labelStyle,
334
+ style: [tabStyle, // Calculate the deafult width for tab for FlatList to work.
335
+ this.getFlattenedTabWidth(tabStyle) === undefined && {
336
+ width: this.getComputedTabWidth(index, layout, routes, scrollEnabled, tabWidths, this.getFlattenedTabWidth(tabStyle))
337
+ }]
338
+ };
339
+ return /*#__PURE__*/React.createElement(React.Fragment, {
340
+ key: route.key
341
+ }, gap > 0 && index > 0 ? /*#__PURE__*/React.createElement(Separator, {
342
+ width: gap
343
+ }) : null, renderTabBarItem ? renderTabBarItem(props) : /*#__PURE__*/React.createElement(_TabBarItem.default, props));
344
+ },
264
345
  onScroll: _reactNative.Animated.event([{
265
346
  nativeEvent: {
266
347
  contentOffset: {
@@ -270,59 +351,8 @@ class TabBar extends React.Component {
270
351
  }], {
271
352
  useNativeDriver: true
272
353
  }),
273
- ref: this.scrollViewRef
274
- }, routes.map(route => {
275
- const props = {
276
- key: route.key,
277
- position: position,
278
- route: route,
279
- navigationState: navigationState,
280
- getAccessibilityLabel: getAccessibilityLabel,
281
- getAccessible: getAccessible,
282
- getLabelText: getLabelText,
283
- getTestID: getTestID,
284
- renderBadge: renderBadge,
285
- renderIcon: renderIcon,
286
- renderLabel: renderLabel,
287
- activeColor: activeColor,
288
- inactiveColor: inactiveColor,
289
- pressColor: pressColor,
290
- pressOpacity: pressOpacity,
291
- onLayout: isWidthDynamic ? e => {
292
- this.measuredTabWidths[route.key] = e.nativeEvent.layout.width; // When we have measured widths for all of the tabs, we should updates the state
293
- // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
294
-
295
- if (routes.every(r => typeof this.measuredTabWidths[r.key] === 'number')) {
296
- this.setState({
297
- tabWidths: { ...this.measuredTabWidths
298
- }
299
- });
300
- }
301
- } : undefined,
302
- onPress: () => {
303
- const event = {
304
- route,
305
- defaultPrevented: false,
306
- preventDefault: () => {
307
- event.defaultPrevented = true;
308
- }
309
- };
310
- onTabPress === null || onTabPress === void 0 ? void 0 : onTabPress(event);
311
-
312
- if (event.defaultPrevented) {
313
- return;
314
- }
315
-
316
- this.props.jumpTo(route.key);
317
- },
318
- onLongPress: () => onTabLongPress === null || onTabLongPress === void 0 ? void 0 : onTabLongPress({
319
- route
320
- }),
321
- labelStyle: labelStyle,
322
- style: tabStyle
323
- };
324
- return renderTabBarItem ? renderTabBarItem(props) : /*#__PURE__*/React.createElement(_TabBarItem.default, props);
325
- }))));
354
+ ref: this.flatListRef
355
+ })));
326
356
  }
327
357
 
328
358
  }
@@ -330,19 +360,32 @@ class TabBar extends React.Component {
330
360
  exports.default = TabBar;
331
361
 
332
362
  _defineProperty(TabBar, "defaultProps", {
333
- getLabelText: ({
334
- route
335
- }) => route.title,
336
- getAccessible: ({
337
- route
338
- }) => typeof route.accessible !== 'undefined' ? route.accessible : true,
339
- getAccessibilityLabel: ({
340
- route
341
- }) => typeof route.accessibilityLabel === 'string' ? route.accessibilityLabel : typeof route.title === 'string' ? route.title : undefined,
342
- getTestID: ({
343
- route
344
- }) => route.testID,
345
- renderIndicator: props => /*#__PURE__*/React.createElement(_TabBarIndicator.default, props)
363
+ getLabelText: _ref3 => {
364
+ let {
365
+ route
366
+ } = _ref3;
367
+ return route.title;
368
+ },
369
+ getAccessible: _ref4 => {
370
+ let {
371
+ route
372
+ } = _ref4;
373
+ return typeof route.accessible !== 'undefined' ? route.accessible : true;
374
+ },
375
+ getAccessibilityLabel: _ref5 => {
376
+ let {
377
+ route
378
+ } = _ref5;
379
+ return typeof route.accessibilityLabel === 'string' ? route.accessibilityLabel : typeof route.title === 'string' ? route.title : undefined;
380
+ },
381
+ getTestID: _ref6 => {
382
+ let {
383
+ route
384
+ } = _ref6;
385
+ return route.testID;
386
+ },
387
+ renderIndicator: props => /*#__PURE__*/React.createElement(_TabBarIndicator.default, props),
388
+ gap: 0
346
389
  });
347
390
 
348
391
  const styles = _reactNative.StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"sources":["TabBar.tsx"],"names":["TabBar","React","Component","layout","width","height","tabWidths","Animated","Value","createRef","style","tabStyle","StyleSheet","flatten","undefined","index","routes","scrollEnabled","flattenedWidth","key","endsWith","parseFloat","Number","isFinite","length","tabBarWidth","layoutWidth","props","state","navigationState","reduce","acc","_","i","getComputedTabWidth","getFlattenedTabWidth","value","getTabBarWidth","maxDistance","getMaxScrollDistance","scrollValue","Math","max","min","Platform","OS","I18nManager","isRTL","centerDistance","Array","from","total","tabWidth","scrollAmount","normalizeScrollValue","scrollViewRef","current","scrollTo","x","getScrollAmount","animated","e","nativeEvent","setState","maxScrollDistance","multiply","add","componentDidUpdate","prevProps","prevState","every","r","resetScroll","render","position","jumpTo","bounces","getAccessibilityLabel","getAccessible","getLabelText","getTestID","renderBadge","renderIcon","renderLabel","renderTabBarItem","activeColor","inactiveColor","pressColor","pressOpacity","onTabPress","onTabLongPress","labelStyle","indicatorStyle","contentContainerStyle","indicatorContainerStyle","isWidthDynamic","tabBarWidthPercent","translateX","getTranslateX","handleLayout","styles","tabBar","indicatorContainer","transform","renderIndicator","getTabWidth","scroll","tabContent","container","event","contentOffset","useNativeDriver","map","route","onLayout","measuredTabWidths","onPress","defaultPrevented","preventDefault","onLongPress","title","accessible","accessibilityLabel","testID","create","flex","overflow","select","default","web","backgroundColor","elevation","shadowColor","shadowOpacity","shadowRadius","hairlineWidth","shadowOffset","zIndex","flexDirection","flexWrap","top","left","right","bottom"],"mappings":";;;;;;;AAAA;;AACA;;AAYA;;AACA;;;;;;;;;;AAsDe,MAAMA,MAAN,SAAsCC,KAAK,CAACC,SAA5C,CAGb;AAAA;AAAA;;AAAA,mCAiBe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YAAY,EAAE;AACZnI,MAAAA,MAAM,EAAEO,wBAAW2H,aADP;AAEZnI,MAAAA,KAAK,EAAE;AAFK,KANR;AAUNqI,IAAAA,MAAM,EAAE;AAVF,GAPuB;AAmB/B9B,EAAAA,UAAU,EAAE;AACV+B,IAAAA,aAAa,EAAE,KADL;AAEVC,IAAAA,QAAQ,EAAE;AAFA,GAnBmB;AAuB/BrC,EAAAA,kBAAkB,EAAE;AAClB5B,IAAAA,QAAQ,EAAE,UADQ;AAElBkE,IAAAA,GAAG,EAAE,CAFa;AAGlBC,IAAAA,IAAI,EAAE,CAHY;AAIlBC,IAAAA,KAAK,EAAE,CAJW;AAKlBC,IAAAA,MAAM,EAAE;AALU;AAvBW,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n StyleSheet,\n View,\n ScrollView,\n StyleProp,\n ViewStyle,\n TextStyle,\n LayoutChangeEvent,\n I18nManager,\n Platform,\n} from 'react-native';\nimport TabBarItem, { Props as TabBarItemProps } from './TabBarItem';\nimport TabBarIndicator, { Props as IndicatorProps } from './TabBarIndicator';\nimport type {\n Route,\n Scene,\n SceneRendererProps,\n NavigationState,\n Layout,\n Event,\n} from './types';\n\nexport type Props<T extends Route> = SceneRendererProps & {\n navigationState: NavigationState<T>;\n scrollEnabled?: boolean;\n bounces?: boolean;\n activeColor?: string;\n inactiveColor?: string;\n pressColor?: string;\n pressOpacity?: number;\n getLabelText: (scene: Scene<T>) => string | undefined;\n getAccessible: (scene: Scene<T>) => boolean | undefined;\n getAccessibilityLabel: (scene: Scene<T>) => string | undefined;\n getTestID: (scene: Scene<T>) => string | undefined;\n renderLabel?: (\n scene: Scene<T> & {\n focused: boolean;\n color: string;\n }\n ) => React.ReactNode;\n renderIcon?: (\n scene: Scene<T> & {\n focused: boolean;\n color: string;\n }\n ) => React.ReactNode;\n renderBadge?: (scene: Scene<T>) => React.ReactNode;\n renderIndicator: (props: IndicatorProps<T>) => React.ReactNode;\n renderTabBarItem?: (\n props: TabBarItemProps<T> & { key: string }\n ) => React.ReactElement;\n onTabPress?: (scene: Scene<T> & Event) => void;\n onTabLongPress?: (scene: Scene<T>) => void;\n tabStyle?: StyleProp<ViewStyle>;\n indicatorStyle?: StyleProp<ViewStyle>;\n indicatorContainerStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n contentContainerStyle?: StyleProp<ViewStyle>;\n style?: StyleProp<ViewStyle>;\n};\n\ntype State = {\n layout: Layout;\n tabWidths: { [key: string]: number };\n};\n\nexport default class TabBar<T extends Route> extends React.Component<\n Props<T>,\n State\n> {\n static defaultProps = {\n getLabelText: ({ route }: Scene<Route>) => route.title,\n getAccessible: ({ route }: Scene<Route>) =>\n typeof route.accessible !== 'undefined' ? route.accessible : true,\n getAccessibilityLabel: ({ route }: Scene<Route>) =>\n typeof route.accessibilityLabel === 'string'\n ? route.accessibilityLabel\n : typeof route.title === 'string'\n ? route.title\n : undefined,\n getTestID: ({ route }: Scene<Route>) => route.testID,\n renderIndicator: (props: IndicatorProps<Route>) => (\n <TabBarIndicator {...props} />\n ),\n };\n\n state: State = {\n layout: { width: 0, height: 0 },\n tabWidths: {},\n };\n\n componentDidUpdate(prevProps: Props<T>, prevState: State) {\n const { navigationState } = this.props;\n const { layout, tabWidths } = this.state;\n\n if (\n prevProps.navigationState.routes.length !==\n navigationState.routes.length ||\n prevProps.navigationState.index !== navigationState.index ||\n prevState.layout.width !== layout.width ||\n prevState.tabWidths !== tabWidths\n ) {\n if (\n this.getFlattenedTabWidth(this.props.tabStyle) === 'auto' &&\n !(\n layout.width &&\n navigationState.routes.every(\n (r) => typeof tabWidths[r.key] === 'number'\n )\n )\n ) {\n // When tab width is dynamic, only adjust the scroll once we have all tab widths and layout\n return;\n }\n\n this.resetScroll(navigationState.index);\n }\n }\n\n // to store the layout.width of each tab\n // when all onLayout's are fired, this would be set in state\n private measuredTabWidths: { [key: string]: number } = {};\n\n private scrollAmount = new Animated.Value(0);\n\n private scrollViewRef = React.createRef<ScrollView>();\n\n private getFlattenedTabWidth = (style: StyleProp<ViewStyle>) => {\n const tabStyle = StyleSheet.flatten(style);\n\n return tabStyle ? tabStyle.width : undefined;\n };\n\n private getComputedTabWidth = (\n index: number,\n layout: Layout,\n routes: Route[],\n scrollEnabled: boolean | undefined,\n tabWidths: { [key: string]: number },\n flattenedWidth: string | number | undefined\n ) => {\n if (flattenedWidth === 'auto') {\n return tabWidths[routes[index].key] || 0;\n }\n\n switch (typeof flattenedWidth) {\n case 'number':\n return flattenedWidth;\n case 'string':\n if (flattenedWidth.endsWith('%')) {\n const width = parseFloat(flattenedWidth);\n if (Number.isFinite(width)) {\n return layout.width * (width / 100);\n }\n }\n }\n\n if (scrollEnabled) {\n return (layout.width / 5) * 2;\n }\n\n return layout.width / routes.length;\n };\n\n private getMaxScrollDistance = (tabBarWidth: number, layoutWidth: number) =>\n tabBarWidth - layoutWidth;\n\n private getTabBarWidth = (props: Props<T>, state: State) => {\n const { layout, tabWidths } = state;\n const { scrollEnabled, tabStyle } = props;\n const { routes } = props.navigationState;\n\n return routes.reduce<number>(\n (acc, _, i) =>\n acc +\n this.getComputedTabWidth(\n i,\n layout,\n routes,\n scrollEnabled,\n tabWidths,\n this.getFlattenedTabWidth(tabStyle)\n ),\n 0\n );\n };\n\n private normalizeScrollValue = (\n props: Props<T>,\n state: State,\n value: number\n ) => {\n const { layout } = state;\n const tabBarWidth = this.getTabBarWidth(props, state);\n const maxDistance = this.getMaxScrollDistance(tabBarWidth, layout.width);\n const scrollValue = Math.max(Math.min(value, maxDistance), 0);\n\n if (Platform.OS === 'android' && I18nManager.isRTL) {\n // On Android, scroll value is not applied in reverse in RTL\n // so we need to manually adjust it to apply correct value\n return maxDistance - scrollValue;\n }\n\n return scrollValue;\n };\n\n private getScrollAmount = (props: Props<T>, state: State, index: number) => {\n const { layout, tabWidths } = state;\n const { scrollEnabled, tabStyle } = props;\n const { routes } = props.navigationState;\n\n const centerDistance = Array.from({ length: index + 1 }).reduce<number>(\n (total, _, i) => {\n const tabWidth = this.getComputedTabWidth(\n i,\n layout,\n routes,\n scrollEnabled,\n tabWidths,\n this.getFlattenedTabWidth(tabStyle)\n );\n\n // To get the current index centered we adjust scroll amount by width of indexes\n // 0 through (i - 1) and add half the width of current index i\n return total + (index === i ? tabWidth / 2 : tabWidth);\n },\n 0\n );\n\n const scrollAmount = centerDistance - layout.width / 2;\n\n return this.normalizeScrollValue(props, state, scrollAmount);\n };\n\n private resetScroll = (index: number) => {\n if (this.props.scrollEnabled) {\n this.scrollViewRef.current?.scrollTo({\n x: this.getScrollAmount(this.props, this.state, index),\n animated: true,\n });\n }\n };\n\n private handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n if (\n this.state.layout.width === width &&\n this.state.layout.height === height\n ) {\n return;\n }\n\n this.setState({\n layout: {\n height,\n width,\n },\n });\n };\n\n private getTranslateX = (\n scrollAmount: Animated.Value,\n maxScrollDistance: number\n ) =>\n Animated.multiply(\n Platform.OS === 'android' && I18nManager.isRTL\n ? Animated.add(maxScrollDistance, Animated.multiply(scrollAmount, -1))\n : scrollAmount,\n I18nManager.isRTL ? 1 : -1\n );\n\n render() {\n const {\n position,\n navigationState,\n jumpTo,\n scrollEnabled,\n bounces,\n getAccessibilityLabel,\n getAccessible,\n getLabelText,\n getTestID,\n renderBadge,\n renderIcon,\n renderLabel,\n renderTabBarItem,\n activeColor,\n inactiveColor,\n pressColor,\n pressOpacity,\n onTabPress,\n onTabLongPress,\n tabStyle,\n labelStyle,\n indicatorStyle,\n contentContainerStyle,\n style,\n indicatorContainerStyle,\n } = this.props;\n const { layout, tabWidths } = this.state;\n const { routes } = navigationState;\n\n const isWidthDynamic = this.getFlattenedTabWidth(tabStyle) === 'auto';\n const tabBarWidth = this.getTabBarWidth(this.props, this.state);\n const tabBarWidthPercent = `${routes.length * 40}%`;\n const translateX = this.getTranslateX(\n this.scrollAmount,\n this.getMaxScrollDistance(tabBarWidth, layout.width)\n );\n\n return (\n <Animated.View\n onLayout={this.handleLayout}\n style={[styles.tabBar, style]}\n >\n <Animated.View\n pointerEvents=\"none\"\n style={[\n styles.indicatorContainer,\n scrollEnabled ? { transform: [{ translateX }] as any } : null,\n tabBarWidth\n ? { width: tabBarWidth }\n : scrollEnabled\n ? { width: tabBarWidthPercent }\n : null,\n indicatorContainerStyle,\n ]}\n >\n {this.props.renderIndicator({\n position,\n layout,\n navigationState,\n jumpTo,\n width: isWidthDynamic ? 'auto' : `${100 / routes.length}%`,\n style: indicatorStyle,\n getTabWidth: (i: number) =>\n this.getComputedTabWidth(\n i,\n layout,\n routes,\n scrollEnabled,\n tabWidths,\n this.getFlattenedTabWidth(tabStyle)\n ),\n })}\n </Animated.View>\n <View style={styles.scroll}>\n <Animated.ScrollView\n horizontal\n accessibilityRole=\"tablist\"\n keyboardShouldPersistTaps=\"handled\"\n scrollEnabled={scrollEnabled}\n bounces={bounces}\n alwaysBounceHorizontal={false}\n scrollsToTop={false}\n showsHorizontalScrollIndicator={false}\n automaticallyAdjustContentInsets={false}\n overScrollMode=\"never\"\n contentContainerStyle={[\n styles.tabContent,\n scrollEnabled\n ? { width: tabBarWidth || tabBarWidthPercent }\n : styles.container,\n contentContainerStyle,\n ]}\n scrollEventThrottle={16}\n onScroll={Animated.event(\n [\n {\n nativeEvent: {\n contentOffset: { x: this.scrollAmount },\n },\n },\n ],\n { useNativeDriver: true }\n )}\n ref={this.scrollViewRef}\n >\n {routes.map((route: T) => {\n const props: TabBarItemProps<T> & { key: string } = {\n key: route.key,\n position: position,\n route: route,\n navigationState: navigationState,\n getAccessibilityLabel: getAccessibilityLabel,\n getAccessible: getAccessible,\n getLabelText: getLabelText,\n getTestID: getTestID,\n renderBadge: renderBadge,\n renderIcon: renderIcon,\n renderLabel: renderLabel,\n activeColor: activeColor,\n inactiveColor: inactiveColor,\n pressColor: pressColor,\n pressOpacity: pressOpacity,\n onLayout: isWidthDynamic\n ? (e) => {\n this.measuredTabWidths[route.key] =\n e.nativeEvent.layout.width;\n\n // When we have measured widths for all of the tabs, we should updates the state\n // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app\n if (\n routes.every(\n (r) =>\n typeof this.measuredTabWidths[r.key] === 'number'\n )\n ) {\n this.setState({\n tabWidths: { ...this.measuredTabWidths },\n });\n }\n }\n : undefined,\n onPress: () => {\n const event: Scene<T> & Event = {\n route,\n defaultPrevented: false,\n preventDefault: () => {\n event.defaultPrevented = true;\n },\n };\n\n onTabPress?.(event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n this.props.jumpTo(route.key);\n },\n onLongPress: () => onTabLongPress?.({ route }),\n labelStyle: labelStyle,\n style: tabStyle,\n };\n\n return renderTabBarItem ? (\n renderTabBarItem(props)\n ) : (\n <TabBarItem {...props} />\n );\n })}\n </Animated.ScrollView>\n </View>\n </Animated.View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n scroll: {\n overflow: Platform.select({ default: 'scroll', web: undefined }),\n },\n tabBar: {\n backgroundColor: '#2196f3',\n elevation: 4,\n shadowColor: 'black',\n shadowOpacity: 0.1,\n shadowRadius: StyleSheet.hairlineWidth,\n shadowOffset: {\n height: StyleSheet.hairlineWidth,\n width: 0,\n },\n zIndex: 1,\n },\n tabContent: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n },\n indicatorContainer: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]}
1
+ {"version":3,"names":["Separator","width","TabBar","React","Component","layout","height","tabWidths","Animated","Value","createRef","style","tabStyle","StyleSheet","flatten","undefined","index","routes","scrollEnabled","flattenedWidth","key","endsWith","parseFloat","Number","isFinite","length","tabBarWidth","layoutWidth","props","state","navigationState","reduce","acc","_","i","gap","getComputedTabWidth","getFlattenedTabWidth","value","getTabBarWidth","maxDistance","getMaxScrollDistance","scrollValue","Math","max","min","Platform","OS","I18nManager","isRTL","centerDistance","Array","from","total","tabWidth","scrollAmount","normalizeScrollValue","flatListRef","current","scrollToOffset","offset","getScrollAmount","animated","e","nativeEvent","setState","maxScrollDistance","multiply","add","componentDidUpdate","prevProps","prevState","every","r","resetScroll","render","position","jumpTo","bounces","getAccessibilityLabel","getAccessible","getLabelText","getTestID","renderBadge","renderIcon","renderLabel","renderTabBarItem","activeColor","inactiveColor","pressColor","pressOpacity","onTabPress","onTabLongPress","labelStyle","indicatorStyle","contentContainerStyle","indicatorContainerStyle","isWidthDynamic","separatorsWidth","separatorPercent","tabBarWidthPercent","translateX","getTranslateX","handleLayout","styles","tabBar","indicatorContainer","transform","renderIndicator","getTabWidth","scroll","item","tabContent","container","route","onLayout","measuredTabWidths","onPress","event","defaultPrevented","preventDefault","onLongPress","contentOffset","x","useNativeDriver","title","accessible","accessibilityLabel","testID","create","flex","overflow","select","default","web","backgroundColor","elevation","shadowColor","shadowOpacity","shadowRadius","hairlineWidth","shadowOffset","zIndex","flexDirection","flexWrap","top","left","right","bottom"],"sources":["TabBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n StyleSheet,\n View,\n StyleProp,\n ViewStyle,\n TextStyle,\n LayoutChangeEvent,\n I18nManager,\n Platform,\n FlatList,\n ListRenderItemInfo,\n} from 'react-native';\nimport TabBarItem, { Props as TabBarItemProps } from './TabBarItem';\nimport TabBarIndicator, { Props as IndicatorProps } from './TabBarIndicator';\nimport type {\n Route,\n Scene,\n SceneRendererProps,\n NavigationState,\n Layout,\n Event,\n} from './types';\n\nexport type Props<T extends Route> = SceneRendererProps & {\n navigationState: NavigationState<T>;\n scrollEnabled?: boolean;\n bounces?: boolean;\n activeColor?: string;\n inactiveColor?: string;\n pressColor?: string;\n pressOpacity?: number;\n getLabelText: (scene: Scene<T>) => string | undefined;\n getAccessible: (scene: Scene<T>) => boolean | undefined;\n getAccessibilityLabel: (scene: Scene<T>) => string | undefined;\n getTestID: (scene: Scene<T>) => string | undefined;\n renderLabel?: (\n scene: Scene<T> & {\n focused: boolean;\n color: string;\n }\n ) => React.ReactNode;\n renderIcon?: (\n scene: Scene<T> & {\n focused: boolean;\n color: string;\n }\n ) => React.ReactNode;\n renderBadge?: (scene: Scene<T>) => React.ReactNode;\n renderIndicator: (props: IndicatorProps<T>) => React.ReactNode;\n renderTabBarItem?: (\n props: TabBarItemProps<T> & { key: string }\n ) => React.ReactElement;\n onTabPress?: (scene: Scene<T> & Event) => void;\n onTabLongPress?: (scene: Scene<T>) => void;\n tabStyle?: StyleProp<ViewStyle>;\n indicatorStyle?: StyleProp<ViewStyle>;\n indicatorContainerStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n contentContainerStyle?: StyleProp<ViewStyle>;\n style?: StyleProp<ViewStyle>;\n gap?: number;\n};\n\ntype State = {\n layout: Layout;\n tabWidths: { [key: string]: number };\n};\n\nconst Separator = ({ width }: { width: number }) => {\n return <View style={{ width }} />;\n};\n\nexport default class TabBar<T extends Route> extends React.Component<\n Props<T>,\n State\n> {\n static defaultProps = {\n getLabelText: ({ route }: Scene<Route>) => route.title,\n getAccessible: ({ route }: Scene<Route>) =>\n typeof route.accessible !== 'undefined' ? route.accessible : true,\n getAccessibilityLabel: ({ route }: Scene<Route>) =>\n typeof route.accessibilityLabel === 'string'\n ? route.accessibilityLabel\n : typeof route.title === 'string'\n ? route.title\n : undefined,\n getTestID: ({ route }: Scene<Route>) => route.testID,\n renderIndicator: (props: IndicatorProps<Route>) => (\n <TabBarIndicator {...props} />\n ),\n gap: 0,\n };\n\n state: State = {\n layout: { width: 0, height: 0 },\n tabWidths: {},\n };\n\n componentDidUpdate(prevProps: Props<T>, prevState: State) {\n const { navigationState } = this.props;\n const { layout, tabWidths } = this.state;\n\n if (\n prevProps.navigationState.routes.length !==\n navigationState.routes.length ||\n prevProps.navigationState.index !== navigationState.index ||\n prevState.layout.width !== layout.width ||\n prevState.tabWidths !== tabWidths\n ) {\n if (\n this.getFlattenedTabWidth(this.props.tabStyle) === 'auto' &&\n !(\n layout.width &&\n navigationState.routes.every(\n (r) => typeof tabWidths[r.key] === 'number'\n )\n )\n ) {\n // When tab width is dynamic, only adjust the scroll once we have all tab widths and layout\n return;\n }\n\n this.resetScroll(navigationState.index);\n }\n }\n\n // to store the layout.width of each tab\n // when all onLayout's are fired, this would be set in state\n private measuredTabWidths: { [key: string]: number } = {};\n\n private scrollAmount = new Animated.Value(0);\n\n private flatListRef = React.createRef<FlatList>();\n\n private getFlattenedTabWidth = (style: StyleProp<ViewStyle>) => {\n const tabStyle = StyleSheet.flatten(style);\n\n return tabStyle ? tabStyle.width : undefined;\n };\n\n private getComputedTabWidth = (\n index: number,\n layout: Layout,\n routes: Route[],\n scrollEnabled: boolean | undefined,\n tabWidths: { [key: string]: number },\n flattenedWidth: string | number | undefined\n ) => {\n if (flattenedWidth === 'auto') {\n return tabWidths[routes[index].key] || 0;\n }\n\n switch (typeof flattenedWidth) {\n case 'number':\n return flattenedWidth;\n case 'string':\n if (flattenedWidth.endsWith('%')) {\n const width = parseFloat(flattenedWidth);\n if (Number.isFinite(width)) {\n return layout.width * (width / 100);\n }\n }\n }\n\n if (scrollEnabled) {\n return (layout.width / 5) * 2;\n }\n return layout.width / routes.length;\n };\n\n private getMaxScrollDistance = (tabBarWidth: number, layoutWidth: number) =>\n tabBarWidth - layoutWidth;\n\n private getTabBarWidth = (props: Props<T>, state: State) => {\n const { layout, tabWidths } = state;\n const { scrollEnabled, tabStyle } = props;\n const { routes } = props.navigationState;\n\n return routes.reduce<number>(\n (acc, _, i) =>\n acc +\n (i > 0 ? props.gap ?? 0 : 0) +\n this.getComputedTabWidth(\n i,\n layout,\n routes,\n scrollEnabled,\n tabWidths,\n this.getFlattenedTabWidth(tabStyle)\n ),\n 0\n );\n };\n\n private normalizeScrollValue = (\n props: Props<T>,\n state: State,\n value: number\n ) => {\n const { layout } = state;\n const tabBarWidth = this.getTabBarWidth(props, state);\n const maxDistance = this.getMaxScrollDistance(tabBarWidth, layout.width);\n const scrollValue = Math.max(Math.min(value, maxDistance), 0);\n\n if (Platform.OS === 'android' && I18nManager.isRTL) {\n // On Android, scroll value is not applied in reverse in RTL\n // so we need to manually adjust it to apply correct value\n return maxDistance - scrollValue;\n }\n\n return scrollValue;\n };\n\n private getScrollAmount = (props: Props<T>, state: State, index: number) => {\n const { layout, tabWidths } = state;\n const { scrollEnabled, tabStyle } = props;\n const { routes } = props.navigationState;\n\n const centerDistance = Array.from({ length: index + 1 }).reduce<number>(\n (total, _, i) => {\n const tabWidth = this.getComputedTabWidth(\n i,\n layout,\n routes,\n scrollEnabled,\n tabWidths,\n this.getFlattenedTabWidth(tabStyle)\n );\n\n // To get the current index centered we adjust scroll amount by width of indexes\n // 0 through (i - 1) and add half the width of current index i\n return (\n total +\n (index === i\n ? (tabWidth + (props.gap ?? 0)) / 2\n : tabWidth + (props.gap ?? 0))\n );\n },\n 0\n );\n\n const scrollAmount = centerDistance - layout.width / 2;\n\n return this.normalizeScrollValue(props, state, scrollAmount);\n };\n\n private resetScroll = (index: number) => {\n if (this.props.scrollEnabled) {\n this.flatListRef.current?.scrollToOffset({\n offset: this.getScrollAmount(this.props, this.state, index),\n animated: true,\n });\n }\n };\n\n private handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n if (\n this.state.layout.width === width &&\n this.state.layout.height === height\n ) {\n return;\n }\n\n this.setState({\n layout: {\n height,\n width,\n },\n });\n };\n\n private getTranslateX = (\n scrollAmount: Animated.Value,\n maxScrollDistance: number\n ) =>\n Animated.multiply(\n Platform.OS === 'android' && I18nManager.isRTL\n ? Animated.add(maxScrollDistance, Animated.multiply(scrollAmount, -1))\n : scrollAmount,\n I18nManager.isRTL ? 1 : -1\n );\n\n render() {\n const {\n position,\n navigationState,\n jumpTo,\n scrollEnabled,\n bounces,\n getAccessibilityLabel,\n getAccessible,\n getLabelText,\n getTestID,\n renderBadge,\n renderIcon,\n renderLabel,\n renderTabBarItem,\n activeColor,\n inactiveColor,\n pressColor,\n pressOpacity,\n onTabPress,\n onTabLongPress,\n tabStyle,\n labelStyle,\n indicatorStyle,\n contentContainerStyle,\n style,\n indicatorContainerStyle,\n gap = 0,\n } = this.props;\n const { layout, tabWidths } = this.state;\n const { routes } = navigationState;\n\n const isWidthDynamic = this.getFlattenedTabWidth(tabStyle) === 'auto';\n const tabBarWidth = this.getTabBarWidth(this.props, this.state);\n const separatorsWidth = Math.max(0, routes.length - 1) * gap;\n const separatorPercent = (separatorsWidth / tabBarWidth) * 100;\n\n const tabBarWidthPercent = `${routes.length * 40}%`;\n const translateX = this.getTranslateX(\n this.scrollAmount,\n this.getMaxScrollDistance(tabBarWidth, layout.width)\n );\n\n return (\n <Animated.View\n onLayout={this.handleLayout}\n style={[styles.tabBar, style]}\n >\n <Animated.View\n pointerEvents=\"none\"\n style={[\n styles.indicatorContainer,\n scrollEnabled ? { transform: [{ translateX }] as any } : null,\n tabBarWidth > separatorsWidth\n ? { width: tabBarWidth - separatorsWidth }\n : scrollEnabled\n ? { width: tabBarWidthPercent }\n : null,\n indicatorContainerStyle,\n ]}\n >\n {this.props.renderIndicator({\n position,\n layout,\n navigationState,\n jumpTo,\n width: isWidthDynamic\n ? 'auto'\n : `${(100 - separatorPercent) / routes.length}%`,\n style: indicatorStyle,\n getTabWidth: (i: number) =>\n this.getComputedTabWidth(\n i,\n layout,\n routes,\n scrollEnabled,\n tabWidths,\n this.getFlattenedTabWidth(tabStyle)\n ),\n gap,\n })}\n </Animated.View>\n <View style={styles.scroll}>\n <Animated.FlatList\n data={routes as Animated.WithAnimatedValue<T>[]}\n keyExtractor={(item) => item.key}\n horizontal\n accessibilityRole=\"tablist\"\n keyboardShouldPersistTaps=\"handled\"\n scrollEnabled={scrollEnabled}\n bounces={bounces}\n alwaysBounceHorizontal={false}\n scrollsToTop={false}\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n automaticallyAdjustContentInsets={false}\n overScrollMode=\"never\"\n contentContainerStyle={[\n styles.tabContent,\n scrollEnabled\n ? {\n width:\n tabBarWidth > separatorsWidth\n ? tabBarWidth\n : tabBarWidthPercent,\n }\n : styles.container,\n contentContainerStyle,\n ]}\n scrollEventThrottle={16}\n renderItem={({ item: route, index }: ListRenderItemInfo<T>) => {\n const props: TabBarItemProps<T> & { key: string } = {\n key: route.key,\n position: position,\n route: route,\n navigationState: navigationState,\n getAccessibilityLabel: getAccessibilityLabel,\n getAccessible: getAccessible,\n getLabelText: getLabelText,\n getTestID: getTestID,\n renderBadge: renderBadge,\n renderIcon: renderIcon,\n renderLabel: renderLabel,\n activeColor: activeColor,\n inactiveColor: inactiveColor,\n pressColor: pressColor,\n pressOpacity: pressOpacity,\n onLayout: isWidthDynamic\n ? (e) => {\n this.measuredTabWidths[route.key] =\n e.nativeEvent.layout.width;\n\n // When we have measured widths for all of the tabs, we should updates the state\n // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app\n if (\n routes.every(\n (r) =>\n typeof this.measuredTabWidths[r.key] === 'number'\n )\n ) {\n this.setState({\n tabWidths: { ...this.measuredTabWidths },\n });\n }\n }\n : undefined,\n onPress: () => {\n const event: Scene<T> & Event = {\n route,\n defaultPrevented: false,\n preventDefault: () => {\n event.defaultPrevented = true;\n },\n };\n\n onTabPress?.(event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n this.props.jumpTo(route.key);\n },\n onLongPress: () => onTabLongPress?.({ route }),\n labelStyle: labelStyle,\n style: [\n tabStyle,\n // Calculate the deafult width for tab for FlatList to work.\n this.getFlattenedTabWidth(tabStyle) === undefined && {\n width: this.getComputedTabWidth(\n index,\n layout,\n routes,\n scrollEnabled,\n tabWidths,\n this.getFlattenedTabWidth(tabStyle)\n ),\n },\n ],\n };\n\n return (\n <React.Fragment key={route.key}>\n {gap > 0 && index > 0 ? <Separator width={gap} /> : null}\n {renderTabBarItem ? (\n renderTabBarItem(props)\n ) : (\n <TabBarItem {...props} />\n )}\n </React.Fragment>\n );\n }}\n onScroll={Animated.event(\n [\n {\n nativeEvent: {\n contentOffset: { x: this.scrollAmount },\n },\n },\n ],\n { useNativeDriver: true }\n )}\n ref={this.flatListRef}\n />\n </View>\n </Animated.View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n scroll: {\n overflow: Platform.select({ default: 'scroll', web: undefined }),\n },\n tabBar: {\n backgroundColor: '#2196f3',\n elevation: 4,\n shadowColor: 'black',\n shadowOpacity: 0.1,\n shadowRadius: StyleSheet.hairlineWidth,\n shadowOffset: {\n height: StyleSheet.hairlineWidth,\n width: 0,\n },\n zIndex: 1,\n },\n tabContent: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n },\n indicatorContainer: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AAaA;;AACA;;;;;;;;;;AAuDA,MAAMA,SAAS,GAAG,QAAkC;EAAA,IAAjC;IAAEC;EAAF,CAAiC;EAClD,oBAAO,oBAAC,iBAAD;IAAM,KAAK,EAAE;MAAEA;IAAF;EAAb,EAAP;AACD,CAFD;;AAIe,MAAMC,MAAN,SAAsCC,KAAK,CAACC,SAA5C,CAGb;EAAA;IAAA;;IAAA,+BAkBe;MACbC,MAAM,EAAE;QAAEJ,KAAK,EAAE,CAAT;QAAYK,MAAM,EAAE;MAApB,CADK;MAEbC,SAAS,EAAE;IAFE,CAlBf;;IAAA,2CAqDuD,EArDvD;;IAAA,sCAuDuB,IAAIC,qBAAA,CAASC,KAAb,CAAmB,CAAnB,CAvDvB;;IAAA,kDAyDsBN,KAAK,CAACO,SAAN,EAzDtB;;IAAA,8CA2DgCC,KAAD,IAAiC;MAC9D,MAAMC,QAAQ,GAAGC,uBAAA,CAAWC,OAAX,CAAmBH,KAAnB,CAAjB;;MAEA,OAAOC,QAAQ,GAAGA,QAAQ,CAACX,KAAZ,GAAoBc,SAAnC;IACD,CA/DD;;IAAA,6CAiE8B,CAC5BC,KAD4B,EAE5BX,MAF4B,EAG5BY,MAH4B,EAI5BC,aAJ4B,EAK5BX,SAL4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,EAAE;IAClB9B,QAAQ,EAAE,UADQ;IAElBqE,GAAG,EAAE,CAFa;IAGlBC,IAAI,EAAE,CAHY;IAIlBC,KAAK,EAAE,CAJW;IAKlBC,MAAM,EAAE;EALU;AAvBW,CAAlB,CAAf"}
@@ -16,8 +16,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
16
16
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
17
 
18
18
  class TabBarIndicator extends React.Component {
19
- constructor(...args) {
20
- super(...args);
19
+ constructor() {
20
+ super(...arguments);
21
21
 
22
22
  _defineProperty(this, "fadeInIndicator", () => {
23
23
  const {
@@ -44,12 +44,12 @@ class TabBarIndicator extends React.Component {
44
44
 
45
45
  _defineProperty(this, "opacity", new _reactNative.Animated.Value(this.props.width === 'auto' ? 0 : 1));
46
46
 
47
- _defineProperty(this, "getTranslateX", (position, routes, getTabWidth) => {
47
+ _defineProperty(this, "getTranslateX", (position, routes, getTabWidth, gap) => {
48
48
  const inputRange = routes.map((_, i) => i); // every index contains widths at all previous indices
49
49
 
50
50
  const outputRange = routes.reduce((acc, _, i) => {
51
51
  if (i === 0) return [0];
52
- return [...acc, acc[i - 1] + getTabWidth(i - 1)];
52
+ return [...acc, acc[i - 1] + getTabWidth(i - 1) + (gap ?? 0)];
53
53
  }, []);
54
54
  const translateX = position.interpolate({
55
55
  inputRange,
@@ -75,7 +75,8 @@ class TabBarIndicator extends React.Component {
75
75
  getTabWidth,
76
76
  width,
77
77
  style,
78
- layout
78
+ layout,
79
+ gap
79
80
  } = this.props;
80
81
  const {
81
82
  routes
@@ -83,7 +84,7 @@ class TabBarIndicator extends React.Component {
83
84
  const transform = [];
84
85
 
85
86
  if (layout.width) {
86
- const translateX = routes.length > 1 ? this.getTranslateX(position, routes, getTabWidth) : 0;
87
+ const translateX = routes.length > 1 ? this.getTranslateX(position, routes, getTabWidth, gap) : 0;
87
88
  transform.push({
88
89
  translateX
89
90
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["TabBarIndicator.tsx"],"names":["TabBarIndicator","React","Component","navigationState","layout","width","getTabWidth","props","isIndicatorShown","routes","every","_","i","Animated","timing","opacity","toValue","duration","easing","Easing","in","linear","useNativeDriver","start","Value","position","inputRange","map","outputRange","reduce","acc","translateX","interpolate","extrapolate","multiply","I18nManager","isRTL","componentDidMount","fadeInIndicator","componentDidUpdate","render","style","transform","length","getTranslateX","push","scaleX","styles","indicator","Platform","OS","left","index","StyleSheet","create","backgroundColor","bottom","right","height"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;AAqBe,MAAMA,eAAN,SAA+CC,KAAK,CAACC,SAArD,CAEb;AAAA;AAAA;;AAAA,6CAS0B,MAAM;AAC9B,YAAM;AAAEC,QAAAA,eAAF;AAAmBC,QAAAA,MAAnB;AAA2BC,QAAAA,KAA3B;AAAkCC,QAAAA;AAAlC,UAAkD,KAAKC,KAA7D;;AAEA,UACE,CAAC,KAAKC,gBAAN,IACAH,KAAK,KAAK,MADV,IAEAD,MAAM,CAACC,KAFP,IAGA;AACAF,MAAAA,eAAe,CAACM,MAAhB,CAAuBC,KAAvB,CAA6B,CAACC,CAAD,EAAIC,CAAJ,KAAUN,WAAW,CAACM,CAAD,CAAlD,CALF,EAME;AACA,aAAKJ,gBAAL,GAAwB,IAAxB;;AAEAK,8BAASC,MAAT,CAAgB,KAAKC,OAArB,EAA8B;AAC5BC,UAAAA,OAAO,EAAE,CADmB;AAE5BC,UAAAA,QAAQ,EAAE,GAFkB;AAG5BC,UAAAA,MAAM,EAAEC,oBAAOC,EAAP,CAAUD,oBAAOE,MAAjB,CAHoB;AAI5BC,UAAAA,eAAe,EAAE;AAJW,SAA9B,EAKGC,KALH;AAMD;AACF,KA5BD;;AAAA,8CA8B2B,KA9B3B;;AAAA,qCAgCkB,IAAIV,sBAASW,KAAb,CAAmB,KAAKjB,KAAL,CAAWF,KAAX,K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AA,OAAO,EAAE,KAAKA;AAAhB,OAAnB,GAA+C,IAX1C,EAYL0B,KAZK;AADT,MADF;AAkBD;;AA7GD;;;;AAgHF,MAAMM,MAAM,GAAGM,wBAAWC,MAAX,CAAkB;AAC/BN,EAAAA,SAAS,EAAE;AACTO,IAAAA,eAAe,EAAE,SADR;AAET9B,IAAAA,QAAQ,EAAE,UAFD;AAGT0B,IAAAA,IAAI,EAAE,CAHG;AAITK,IAAAA,MAAM,EAAE,CAJC;AAKTC,IAAAA,KAAK,EAAE,CALE;AAMTC,IAAAA,MAAM,EAAE;AANC;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n Easing,\n StyleSheet,\n I18nManager,\n StyleProp,\n ViewStyle,\n Platform,\n} from 'react-native';\n\nimport type { Route, SceneRendererProps, NavigationState } from './types';\n\nexport type GetTabWidth = (index: number) => number;\n\nexport type Props<T extends Route> = SceneRendererProps & {\n navigationState: NavigationState<T>;\n width: string | number;\n style?: StyleProp<ViewStyle>;\n getTabWidth: GetTabWidth;\n};\n\nexport default class TabBarIndicator<T extends Route> extends React.Component<\n Props<T>\n> {\n componentDidMount() {\n this.fadeInIndicator();\n }\n\n componentDidUpdate() {\n this.fadeInIndicator();\n }\n\n private fadeInIndicator = () => {\n const { navigationState, layout, width, getTabWidth } = this.props;\n\n if (\n !this.isIndicatorShown &&\n width === 'auto' &&\n layout.width &&\n // We should fade-in the indicator when we have widths for all the tab items\n navigationState.routes.every((_, i) => getTabWidth(i))\n ) {\n this.isIndicatorShown = true;\n\n Animated.timing(this.opacity, {\n toValue: 1,\n duration: 150,\n easing: Easing.in(Easing.linear),\n useNativeDriver: true,\n }).start();\n }\n };\n\n private isIndicatorShown = false;\n\n private opacity = new Animated.Value(this.props.width === 'auto' ? 0 : 1);\n\n private getTranslateX = (\n position: Animated.AnimatedInterpolation,\n routes: Route[],\n getTabWidth: GetTabWidth\n ) => {\n const inputRange = routes.map((_, i) => i);\n\n // every index contains widths at all previous indices\n const outputRange = routes.reduce<number[]>((acc, _, i) => {\n if (i === 0) return [0];\n return [...acc, acc[i - 1] + getTabWidth(i - 1)];\n }, []);\n\n const translateX = position.interpolate({\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n });\n\n return Animated.multiply(translateX, I18nManager.isRTL ? -1 : 1);\n };\n\n render() {\n const { position, navigationState, getTabWidth, width, style, layout } =\n this.props;\n const { routes } = navigationState;\n\n const transform = [];\n\n if (layout.width) {\n const translateX =\n routes.length > 1\n ? this.getTranslateX(position, routes, getTabWidth)\n : 0;\n\n transform.push({ translateX });\n }\n\n if (width === 'auto') {\n const inputRange = routes.map((_, i) => i);\n const outputRange = inputRange.map(getTabWidth);\n\n transform.push(\n {\n scaleX:\n routes.length > 1\n ? position.interpolate({\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n })\n : outputRange[0],\n },\n { translateX: 0.5 }\n );\n }\n\n return (\n <Animated.View\n style={[\n styles.indicator,\n { width: width === 'auto' ? 1 : width },\n // If layout is not available, use `left` property for positioning the indicator\n // This avoids rendering delay until we are able to calculate translateX\n // If platform is macos use `left` property as `transform` is broken at the moment.\n // See: https://github.com/microsoft/react-native-macos/issues/280\n layout.width && Platform.OS !== 'macos'\n ? { left: 0 }\n : { left: `${(100 / routes.length) * navigationState.index}%` },\n { transform },\n width === 'auto' ? { opacity: this.opacity } : null,\n style,\n ]}\n />\n );\n }\n}\n\nconst styles = StyleSheet.create({\n indicator: {\n backgroundColor: '#ffeb3b',\n position: 'absolute',\n left: 0,\n bottom: 0,\n right: 0,\n height: 2,\n },\n});\n"]}
1
+ {"version":3,"names":["TabBarIndicator","React","Component","navigationState","layout","width","getTabWidth","props","isIndicatorShown","routes","every","_","i","Animated","timing","opacity","toValue","duration","easing","Easing","in","linear","useNativeDriver","start","Value","position","gap","inputRange","map","outputRange","reduce","acc","translateX","interpolate","extrapolate","multiply","I18nManager","isRTL","componentDidMount","fadeInIndicator","componentDidUpdate","render","style","transform","length","getTranslateX","push","scaleX","styles","indicator","Platform","OS","left","index","StyleSheet","create","backgroundColor","bottom","right","height"],"sources":["TabBarIndicator.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n Easing,\n StyleSheet,\n I18nManager,\n StyleProp,\n ViewStyle,\n Platform,\n} from 'react-native';\n\nimport type { Route, SceneRendererProps, NavigationState } from './types';\n\nexport type GetTabWidth = (index: number) => number;\n\nexport type Props<T extends Route> = SceneRendererProps & {\n navigationState: NavigationState<T>;\n width: string | number;\n style?: StyleProp<ViewStyle>;\n getTabWidth: GetTabWidth;\n gap?: number;\n};\n\nexport default class TabBarIndicator<T extends Route> extends React.Component<\n Props<T>\n> {\n componentDidMount() {\n this.fadeInIndicator();\n }\n\n componentDidUpdate() {\n this.fadeInIndicator();\n }\n\n private fadeInIndicator = () => {\n const { navigationState, layout, width, getTabWidth } = this.props;\n\n if (\n !this.isIndicatorShown &&\n width === 'auto' &&\n layout.width &&\n // We should fade-in the indicator when we have widths for all the tab items\n navigationState.routes.every((_, i) => getTabWidth(i))\n ) {\n this.isIndicatorShown = true;\n\n Animated.timing(this.opacity, {\n toValue: 1,\n duration: 150,\n easing: Easing.in(Easing.linear),\n useNativeDriver: true,\n }).start();\n }\n };\n\n private isIndicatorShown = false;\n\n private opacity = new Animated.Value(this.props.width === 'auto' ? 0 : 1);\n\n private getTranslateX = (\n position: Animated.AnimatedInterpolation,\n routes: Route[],\n getTabWidth: GetTabWidth,\n gap?: number\n ) => {\n const inputRange = routes.map((_, i) => i);\n\n // every index contains widths at all previous indices\n const outputRange = routes.reduce<number[]>((acc, _, i) => {\n if (i === 0) return [0];\n return [...acc, acc[i - 1] + getTabWidth(i - 1) + (gap ?? 0)];\n }, []);\n\n const translateX = position.interpolate({\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n });\n\n return Animated.multiply(translateX, I18nManager.isRTL ? -1 : 1);\n };\n\n render() {\n const {\n position,\n navigationState,\n getTabWidth,\n width,\n style,\n layout,\n gap,\n } = this.props;\n const { routes } = navigationState;\n\n const transform = [];\n\n if (layout.width) {\n const translateX =\n routes.length > 1\n ? this.getTranslateX(position, routes, getTabWidth, gap)\n : 0;\n\n transform.push({ translateX });\n }\n\n if (width === 'auto') {\n const inputRange = routes.map((_, i) => i);\n const outputRange = inputRange.map(getTabWidth);\n\n transform.push(\n {\n scaleX:\n routes.length > 1\n ? position.interpolate({\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n })\n : outputRange[0],\n },\n { translateX: 0.5 }\n );\n }\n\n return (\n <Animated.View\n style={[\n styles.indicator,\n { width: width === 'auto' ? 1 : width },\n // If layout is not available, use `left` property for positioning the indicator\n // This avoids rendering delay until we are able to calculate translateX\n // If platform is macos use `left` property as `transform` is broken at the moment.\n // See: https://github.com/microsoft/react-native-macos/issues/280\n layout.width && Platform.OS !== 'macos'\n ? { left: 0 }\n : { left: `${(100 / routes.length) * navigationState.index}%` },\n { transform },\n width === 'auto' ? { opacity: this.opacity } : null,\n style,\n ]}\n />\n );\n }\n}\n\nconst styles = StyleSheet.create({\n indicator: {\n backgroundColor: '#ffeb3b',\n position: 'absolute',\n left: 0,\n bottom: 0,\n right: 0,\n height: 2,\n },\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;AAsBe,MAAMA,eAAN,SAA+CC,KAAK,CAACC,SAArD,CAEb;EAAA;IAAA;;IAAA,yCAS0B,MAAM;MAC9B,MAAM;QAAEC,eAAF;QAAmBC,MAAnB;QAA2BC,KAA3B;QAAkCC;MAAlC,IAAkD,KAAKC,KAA7D;;MAEA,IACE,CAAC,KAAKC,gBAAN,IACAH,KAAK,KAAK,MADV,IAEAD,MAAM,CAACC,KAFP,IAGA;MACAF,eAAe,CAACM,MAAhB,CAAuBC,KAAvB,CAA6B,CAACC,CAAD,EAAIC,CAAJ,KAAUN,WAAW,CAACM,CAAD,CAAlD,CALF,EAME;QACA,KAAKJ,gBAAL,GAAwB,IAAxB;;QAEAK,qBAAA,CAASC,MAAT,CAAgB,KAAKC,OAArB,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AAEC,IAAI,EAAE;MAAR,CADJ,GAEI;QAAEA,IAAI,EAAG,GAAG,MAAM3C,MAAM,CAACmC,MAAd,GAAwBzC,eAAe,CAACkD,KAAM;MAAzD,CATC,EAUL;QAAEV;MAAF,CAVK,EAWLtC,KAAK,KAAK,MAAV,GAAmB;QAAEU,OAAO,EAAE,KAAKA;MAAhB,CAAnB,GAA+C,IAX1C,EAYL2B,KAZK;IADT,EADF;EAkBD;;AArHD;;;;AAwHF,MAAMM,MAAM,GAAGM,uBAAA,CAAWC,MAAX,CAAkB;EAC/BN,SAAS,EAAE;IACTO,eAAe,EAAE,SADR;IAET/B,QAAQ,EAAE,UAFD;IAGT2B,IAAI,EAAE,CAHG;IAITK,MAAM,EAAE,CAJC;IAKTC,KAAK,EAAE,CALE;IAMTC,MAAM,EAAE;EANC;AADoB,CAAlB,CAAf"}
@@ -23,8 +23,8 @@ const DEFAULT_ACTIVE_COLOR = 'rgba(255, 255, 255, 1)';
23
23
  const DEFAULT_INACTIVE_COLOR = 'rgba(255, 255, 255, 0.7)';
24
24
 
25
25
  class TabBarItem extends React.Component {
26
- constructor(...args) {
27
- super(...args);
26
+ constructor() {
27
+ super(...arguments);
28
28
 
29
29
  _defineProperty(this, "getActiveOpacity", (position, routes, tabIndex) => {
30
30
  if (routes.length > 1) {
@@ -112,10 +112,11 @@ class TabBarItem extends React.Component {
112
112
  }
113
113
  }
114
114
 
115
- const renderLabel = renderLabelCustom !== undefined ? renderLabelCustom : ({
116
- route,
117
- color
118
- }) => {
115
+ const renderLabel = renderLabelCustom !== undefined ? renderLabelCustom : _ref => {
116
+ let {
117
+ route,
118
+ color
119
+ } = _ref;
119
120
  const labelText = getLabelText({
120
121
  route
121
122
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["TabBarItem.tsx"],"names":["DEFAULT_ACTIVE_COLOR","DEFAULT_INACTIVE_COLOR","TabBarItem","React","Component","position","routes","tabIndex","length","inputRange","map","_","i","interpolate","outputRange","render","route","navigationState","renderLabel","renderLabelCustom","renderIcon","renderBadge","getLabelText","getTestID","getAccessibilityLabel","getAccessible","activeColor","activeColorCustom","inactiveColor","inactiveColorCustom","pressColor","pressOpacity","labelStyle","style","onLayout","onPress","onLongPress","props","indexOf","isFocused","index","labelColorFromStyle","StyleSheet","flatten","color","undefined","activeOpacity","getActiveOpacity","inactiveOpacity","getInactiveOpacity","icon","label","activeIcon","focused","inactiveIcon","styles","opacity","absoluteFill","labelText","marginTop","activeLabel","inactiveLabel","tabStyle","isWidthSet","width","tabContainerStyle","flex","scene","accessibilityLabel","badge","borderless","selected","pressable","item","create","margin","backgroundColor","textTransform","alignItems","justifyContent","padding","minHeight","top","right"],"mappings":";;;;;;;AAAA;;AACA;;AASA;;;;;;;;;;AAiCA,MAAMA,oBAAoB,GAAG,wBAA7B;AACA,MAAMC,sBAAsB,GAAG,0BAA/B;;AAEe,MAAMC,UAAN,SAA0CC,KAAK,CAACC,SAAhD,CAEb;AAAA;AAAA;;AAAA,8CAC2B,CACzBC,QADyB,EAEzBC,MAFyB,EAGzBC,QAHyB,KAItB;AACH,UAAID,MAAM,CAACE,MAAP,GAAgB,CAApB,EAAuB;AACrB,cAAMC,UAAU,GAAGH,MAAM,CAACI,GAAP,CAAW,CAACC,CAAD,EAAIC,CAAJ,KAAUA,CAArB,CAAnB;AAEA,eAAOP,QAAQ,CAACQ,WAAT,CAAqB;AAC1BJ,UAAAA,UAD0B;AAE1BK,UAAAA,WAAW,EAAEL,UAAU,CAACC,GAAX,CAAgBE,CAAD,IAAQA,CAAC,KAAKL,QAAN,GAAiB,CAAjB,GAAqB,CAA5C;AAFa,SAArB,CAAP;AAID,OAPD,MAOO;AACL,eAAO,CAAP;AACD;AACF,KAhBD;;AAAA,gDAkB6B,CAC3BF,QAD2B,EAE3BC,MAF2B,EAG3BC,QAH2B,KAIxB;AACH,UAAID,MAAM,CAACE,MAAP,GAAgB,CAApB,EAAuB;AACrB,cAAMC,UAAU,GAAGH,MAAM,CAACI,GAAP,CAAW,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BAAC,iBAAD;AAAM,MAAA,KAAK,EAAEd,MAAM,CAACc;AAApB,OAA4BA,KAA5B,CAAhB,GAA4D,IAH/D,CAjBF,CADF;AAyBD;;AAhND;;;;AAmNF,MAAMd,MAAM,GAAGb,wBAAWgC,MAAX,CAAkB;AAC/BvB,EAAAA,KAAK,EAAE;AACLwB,IAAAA,MAAM,EAAE,CADH;AAELC,IAAAA,eAAe,EAAE,aAFZ;AAGLC,IAAAA,aAAa,EAAE;AAHV,GADwB;AAM/B3B,EAAAA,IAAI,EAAE;AACJyB,IAAAA,MAAM,EAAE;AADJ,GANyB;AAS/BF,EAAAA,IAAI,EAAE;AACJP,IAAAA,IAAI,EAAE,CADF;AAEJY,IAAAA,UAAU,EAAE,QAFR;AAGJC,IAAAA,cAAc,EAAE,QAHZ;AAIJC,IAAAA,OAAO,EAAE,EAJL;AAKJC,IAAAA,SAAS,EAAE;AALP,GATyB;AAgB/BZ,EAAAA,KAAK,EAAE;AACLhE,IAAAA,QAAQ,EAAE,UADL;AAEL6E,IAAAA,GAAG,EAAE,CAFA;AAGLC,IAAAA,KAAK,EAAE;AAHF,GAhBwB;AAqB/BX,EAAAA,SAAS,EAAE;AACT;AACA;AACAI,IAAAA,eAAe,EAAE;AAHR;AArBoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n StyleSheet,\n View,\n StyleProp,\n LayoutChangeEvent,\n TextStyle,\n ViewStyle,\n} from 'react-native';\nimport PlatformPressable from './PlatformPressable';\nimport type { Scene, Route, NavigationState } from './types';\n\nexport type Props<T extends Route> = {\n position: Animated.AnimatedInterpolation;\n route: T;\n navigationState: NavigationState<T>;\n activeColor?: string;\n inactiveColor?: string;\n pressColor?: string;\n pressOpacity?: number;\n getLabelText: (scene: Scene<T>) => string | undefined;\n getAccessible: (scene: Scene<T>) => boolean | undefined;\n getAccessibilityLabel: (scene: Scene<T>) => string | undefined;\n getTestID: (scene: Scene<T>) => string | undefined;\n renderLabel?: (scene: {\n route: T;\n focused: boolean;\n color: string;\n }) => React.ReactNode;\n renderIcon?: (scene: {\n route: T;\n focused: boolean;\n color: string;\n }) => React.ReactNode;\n renderBadge?: (scene: Scene<T>) => React.ReactNode;\n onLayout?: (event: LayoutChangeEvent) => void;\n onPress: () => void;\n onLongPress: () => void;\n labelStyle?: StyleProp<TextStyle>;\n style: StyleProp<ViewStyle>;\n};\n\nconst DEFAULT_ACTIVE_COLOR = 'rgba(255, 255, 255, 1)';\nconst DEFAULT_INACTIVE_COLOR = 'rgba(255, 255, 255, 0.7)';\n\nexport default class TabBarItem<T extends Route> extends React.Component<\n Props<T>\n> {\n private getActiveOpacity = (\n position: Animated.AnimatedInterpolation,\n routes: Route[],\n tabIndex: number\n ) => {\n if (routes.length > 1) {\n const inputRange = routes.map((_, i) => i);\n\n return position.interpolate({\n inputRange,\n outputRange: inputRange.map((i) => (i === tabIndex ? 1 : 0)),\n });\n } else {\n return 1;\n }\n };\n\n private getInactiveOpacity = (\n position: Animated.AnimatedInterpolation,\n routes: Route[],\n tabIndex: number\n ) => {\n if (routes.length > 1) {\n const inputRange = routes.map((_: Route, i: number) => i);\n\n return position.interpolate({\n inputRange,\n outputRange: inputRange.map((i: number) => (i === tabIndex ? 0 : 1)),\n });\n } else {\n return 0;\n }\n };\n\n render() {\n const {\n route,\n position,\n navigationState,\n renderLabel: renderLabelCustom,\n renderIcon,\n renderBadge,\n getLabelText,\n getTestID,\n getAccessibilityLabel,\n getAccessible,\n activeColor: activeColorCustom,\n inactiveColor: inactiveColorCustom,\n pressColor,\n pressOpacity,\n labelStyle,\n style,\n onLayout,\n onPress,\n onLongPress,\n } = this.props;\n\n const tabIndex = navigationState.routes.indexOf(route);\n const isFocused = navigationState.index === tabIndex;\n\n const labelColorFromStyle = StyleSheet.flatten(labelStyle || {}).color;\n\n const activeColor =\n activeColorCustom !== undefined\n ? activeColorCustom\n : typeof labelColorFromStyle === 'string'\n ? labelColorFromStyle\n : DEFAULT_ACTIVE_COLOR;\n const inactiveColor =\n inactiveColorCustom !== undefined\n ? inactiveColorCustom\n : typeof labelColorFromStyle === 'string'\n ? labelColorFromStyle\n : DEFAULT_INACTIVE_COLOR;\n\n const activeOpacity = this.getActiveOpacity(\n position,\n navigationState.routes,\n tabIndex\n );\n const inactiveOpacity = this.getInactiveOpacity(\n position,\n navigationState.routes,\n tabIndex\n );\n\n let icon: React.ReactNode | null = null;\n let label: React.ReactNode | null = null;\n\n if (renderIcon) {\n const activeIcon = renderIcon({\n route,\n focused: true,\n color: activeColor,\n });\n const inactiveIcon = renderIcon({\n route,\n focused: false,\n color: inactiveColor,\n });\n\n if (inactiveIcon != null && activeIcon != null) {\n icon = (\n <View style={styles.icon}>\n <Animated.View style={{ opacity: inactiveOpacity }}>\n {inactiveIcon}\n </Animated.View>\n <Animated.View\n style={[StyleSheet.absoluteFill, { opacity: activeOpacity }]}\n >\n {activeIcon}\n </Animated.View>\n </View>\n );\n }\n }\n\n const renderLabel =\n renderLabelCustom !== undefined\n ? renderLabelCustom\n : ({ route, color }: { route: T; color: string }) => {\n const labelText = getLabelText({ route });\n\n if (typeof labelText === 'string') {\n return (\n <Animated.Text\n style={[\n styles.label,\n icon ? { marginTop: 0 } : null,\n labelStyle,\n { color },\n ]}\n >\n {labelText}\n </Animated.Text>\n );\n }\n\n return labelText;\n };\n\n if (renderLabel) {\n const activeLabel = renderLabel({\n route,\n focused: true,\n color: activeColor,\n });\n const inactiveLabel = renderLabel({\n route,\n focused: false,\n color: inactiveColor,\n });\n\n label = (\n <View>\n <Animated.View style={{ opacity: inactiveOpacity }}>\n {inactiveLabel}\n </Animated.View>\n <Animated.View\n style={[StyleSheet.absoluteFill, { opacity: activeOpacity }]}\n >\n {activeLabel}\n </Animated.View>\n </View>\n );\n }\n\n const tabStyle = StyleSheet.flatten(style);\n const isWidthSet = tabStyle?.width !== undefined;\n const tabContainerStyle: ViewStyle | null = isWidthSet ? null : { flex: 1 };\n\n const scene = { route };\n\n let accessibilityLabel = getAccessibilityLabel(scene);\n\n accessibilityLabel =\n typeof accessibilityLabel !== 'undefined'\n ? accessibilityLabel\n : getLabelText(scene);\n\n const badge = renderBadge ? renderBadge(scene) : null;\n\n return (\n <PlatformPressable\n android_ripple={{ borderless: true }}\n testID={getTestID(scene)}\n accessible={getAccessible(scene)}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected: isFocused }}\n // @ts-ignore: this is to support older React Native versions\n accessibilityStates={isFocused ? ['selected'] : []}\n pressColor={pressColor}\n pressOpacity={pressOpacity}\n delayPressIn={0}\n onLayout={onLayout}\n onPress={onPress}\n onLongPress={onLongPress}\n style={[styles.pressable, tabContainerStyle]}\n >\n <View pointerEvents=\"none\" style={[styles.item, tabStyle]}>\n {icon}\n {label}\n {badge != null ? <View style={styles.badge}>{badge}</View> : null}\n </View>\n </PlatformPressable>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n label: {\n margin: 4,\n backgroundColor: 'transparent',\n textTransform: 'uppercase',\n },\n icon: {\n margin: 2,\n },\n item: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: 10,\n minHeight: 48,\n },\n badge: {\n position: 'absolute',\n top: 0,\n right: 0,\n },\n pressable: {\n // The label is not pressable on Windows\n // Adding backgroundColor: 'transparent' seems to fix it\n backgroundColor: 'transparent',\n },\n});\n"]}
1
+ {"version":3,"names":["DEFAULT_ACTIVE_COLOR","DEFAULT_INACTIVE_COLOR","TabBarItem","React","Component","position","routes","tabIndex","length","inputRange","map","_","i","interpolate","outputRange","render","route","navigationState","renderLabel","renderLabelCustom","renderIcon","renderBadge","getLabelText","getTestID","getAccessibilityLabel","getAccessible","activeColor","activeColorCustom","inactiveColor","inactiveColorCustom","pressColor","pressOpacity","labelStyle","style","onLayout","onPress","onLongPress","props","indexOf","isFocused","index","labelColorFromStyle","StyleSheet","flatten","color","undefined","activeOpacity","getActiveOpacity","inactiveOpacity","getInactiveOpacity","icon","label","activeIcon","focused","inactiveIcon","styles","opacity","absoluteFill","labelText","marginTop","activeLabel","inactiveLabel","tabStyle","isWidthSet","width","tabContainerStyle","flex","scene","accessibilityLabel","badge","borderless","selected","pressable","item","create","margin","backgroundColor","textTransform","alignItems","justifyContent","padding","minHeight","top","right"],"sources":["TabBarItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n StyleSheet,\n View,\n StyleProp,\n LayoutChangeEvent,\n TextStyle,\n ViewStyle,\n} from 'react-native';\nimport PlatformPressable from './PlatformPressable';\nimport type { Scene, Route, NavigationState } from './types';\n\nexport type Props<T extends Route> = {\n position: Animated.AnimatedInterpolation;\n route: T;\n navigationState: NavigationState<T>;\n activeColor?: string;\n inactiveColor?: string;\n pressColor?: string;\n pressOpacity?: number;\n getLabelText: (scene: Scene<T>) => string | undefined;\n getAccessible: (scene: Scene<T>) => boolean | undefined;\n getAccessibilityLabel: (scene: Scene<T>) => string | undefined;\n getTestID: (scene: Scene<T>) => string | undefined;\n renderLabel?: (scene: {\n route: T;\n focused: boolean;\n color: string;\n }) => React.ReactNode;\n renderIcon?: (scene: {\n route: T;\n focused: boolean;\n color: string;\n }) => React.ReactNode;\n renderBadge?: (scene: Scene<T>) => React.ReactNode;\n onLayout?: (event: LayoutChangeEvent) => void;\n onPress: () => void;\n onLongPress: () => void;\n labelStyle?: StyleProp<TextStyle>;\n style: StyleProp<ViewStyle>;\n};\n\nconst DEFAULT_ACTIVE_COLOR = 'rgba(255, 255, 255, 1)';\nconst DEFAULT_INACTIVE_COLOR = 'rgba(255, 255, 255, 0.7)';\n\nexport default class TabBarItem<T extends Route> extends React.Component<\n Props<T>\n> {\n private getActiveOpacity = (\n position: Animated.AnimatedInterpolation,\n routes: Route[],\n tabIndex: number\n ) => {\n if (routes.length > 1) {\n const inputRange = routes.map((_, i) => i);\n\n return position.interpolate({\n inputRange,\n outputRange: inputRange.map((i) => (i === tabIndex ? 1 : 0)),\n });\n } else {\n return 1;\n }\n };\n\n private getInactiveOpacity = (\n position: Animated.AnimatedInterpolation,\n routes: Route[],\n tabIndex: number\n ) => {\n if (routes.length > 1) {\n const inputRange = routes.map((_: Route, i: number) => i);\n\n return position.interpolate({\n inputRange,\n outputRange: inputRange.map((i: number) => (i === tabIndex ? 0 : 1)),\n });\n } else {\n return 0;\n }\n };\n\n render() {\n const {\n route,\n position,\n navigationState,\n renderLabel: renderLabelCustom,\n renderIcon,\n renderBadge,\n getLabelText,\n getTestID,\n getAccessibilityLabel,\n getAccessible,\n activeColor: activeColorCustom,\n inactiveColor: inactiveColorCustom,\n pressColor,\n pressOpacity,\n labelStyle,\n style,\n onLayout,\n onPress,\n onLongPress,\n } = this.props;\n\n const tabIndex = navigationState.routes.indexOf(route);\n const isFocused = navigationState.index === tabIndex;\n\n const labelColorFromStyle = StyleSheet.flatten(labelStyle || {}).color;\n\n const activeColor =\n activeColorCustom !== undefined\n ? activeColorCustom\n : typeof labelColorFromStyle === 'string'\n ? labelColorFromStyle\n : DEFAULT_ACTIVE_COLOR;\n const inactiveColor =\n inactiveColorCustom !== undefined\n ? inactiveColorCustom\n : typeof labelColorFromStyle === 'string'\n ? labelColorFromStyle\n : DEFAULT_INACTIVE_COLOR;\n\n const activeOpacity = this.getActiveOpacity(\n position,\n navigationState.routes,\n tabIndex\n );\n const inactiveOpacity = this.getInactiveOpacity(\n position,\n navigationState.routes,\n tabIndex\n );\n\n let icon: React.ReactNode | null = null;\n let label: React.ReactNode | null = null;\n\n if (renderIcon) {\n const activeIcon = renderIcon({\n route,\n focused: true,\n color: activeColor,\n });\n const inactiveIcon = renderIcon({\n route,\n focused: false,\n color: inactiveColor,\n });\n\n if (inactiveIcon != null && activeIcon != null) {\n icon = (\n <View style={styles.icon}>\n <Animated.View style={{ opacity: inactiveOpacity }}>\n {inactiveIcon}\n </Animated.View>\n <Animated.View\n style={[StyleSheet.absoluteFill, { opacity: activeOpacity }]}\n >\n {activeIcon}\n </Animated.View>\n </View>\n );\n }\n }\n\n const renderLabel =\n renderLabelCustom !== undefined\n ? renderLabelCustom\n : ({ route, color }: { route: T; color: string }) => {\n const labelText = getLabelText({ route });\n\n if (typeof labelText === 'string') {\n return (\n <Animated.Text\n style={[\n styles.label,\n icon ? { marginTop: 0 } : null,\n labelStyle,\n { color },\n ]}\n >\n {labelText}\n </Animated.Text>\n );\n }\n\n return labelText;\n };\n\n if (renderLabel) {\n const activeLabel = renderLabel({\n route,\n focused: true,\n color: activeColor,\n });\n const inactiveLabel = renderLabel({\n route,\n focused: false,\n color: inactiveColor,\n });\n\n label = (\n <View>\n <Animated.View style={{ opacity: inactiveOpacity }}>\n {inactiveLabel}\n </Animated.View>\n <Animated.View\n style={[StyleSheet.absoluteFill, { opacity: activeOpacity }]}\n >\n {activeLabel}\n </Animated.View>\n </View>\n );\n }\n\n const tabStyle = StyleSheet.flatten(style);\n const isWidthSet = tabStyle?.width !== undefined;\n const tabContainerStyle: ViewStyle | null = isWidthSet ? null : { flex: 1 };\n\n const scene = { route };\n\n let accessibilityLabel = getAccessibilityLabel(scene);\n\n accessibilityLabel =\n typeof accessibilityLabel !== 'undefined'\n ? accessibilityLabel\n : getLabelText(scene);\n\n const badge = renderBadge ? renderBadge(scene) : null;\n\n return (\n <PlatformPressable\n android_ripple={{ borderless: true }}\n testID={getTestID(scene)}\n accessible={getAccessible(scene)}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected: isFocused }}\n // @ts-ignore: this is to support older React Native versions\n accessibilityStates={isFocused ? ['selected'] : []}\n pressColor={pressColor}\n pressOpacity={pressOpacity}\n delayPressIn={0}\n onLayout={onLayout}\n onPress={onPress}\n onLongPress={onLongPress}\n style={[styles.pressable, tabContainerStyle]}\n >\n <View pointerEvents=\"none\" style={[styles.item, tabStyle]}>\n {icon}\n {label}\n {badge != null ? <View style={styles.badge}>{badge}</View> : null}\n </View>\n </PlatformPressable>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n label: {\n margin: 4,\n backgroundColor: 'transparent',\n textTransform: 'uppercase',\n },\n icon: {\n margin: 2,\n },\n item: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: 10,\n minHeight: 48,\n },\n badge: {\n position: 'absolute',\n top: 0,\n right: 0,\n },\n pressable: {\n // The label is not pressable on Windows\n // Adding backgroundColor: 'transparent' seems to fix it\n backgroundColor: 'transparent',\n },\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AASA;;;;;;;;;;AAiCA,MAAMA,oBAAoB,GAAG,wBAA7B;AACA,MAAMC,sBAAsB,GAAG,0BAA/B;;AAEe,MAAMC,UAAN,SAA0CC,KAAK,CAACC,SAAhD,CAEb;EAAA;IAAA;;IAAA,0CAC2B,CACzBC,QADyB,EAEzBC,MAFyB,EAGzBC,QAHyB,KAItB;MACH,IAAID,MAAM,CAACE,MAAP,GAAgB,CAApB,EAAuB;QACrB,MAAMC,UAAU,GAAGH,MAAM,CAACI,GAAP,CAAW,CAACC,CAAD,EAAIC,CAAJ,KAAUA,CAArB,CAAnB;QAEA,OAAOP,QAAQ,CAACQ,WAAT,CAAqB;UAC1BJ,UAD0B;UAE1BK,WAAW,EAAEL,UAAU,CAACC,GAAX,CAAgBE,CAAD,IAAQA,CAAC,KAAKL,QAAN,GAAiB,CAAjB,GAAqB,CAA5C;QAFa,CAArB,CAAP;MAID,CAPD,MAOO;QACL,OAAO,CAAP;MACD;IACF,CAhBD;;IAAA,4CAkB6B,CAC3BF,QAD2B,EAE3BC,MAF2B,EAG3BC,QAH2B,KAIxB;MACH,IAAID,MAAM,CAACE,MAAP,GAAgB,CAApB,EAAuB;QACrB,MAAMC,UAAU,GAAGH,MAAM,CAACI,GAAP,CAAW,CAACC,CAAD,EAAWC,CAAX,KAAyBA,CAApC,CAAnB;QAEA,OAAOP,QAAQ,CAACQ,WAAT,CAAqB;UAC1BJ,UAD0B;UAE1BK,WAAW,EAAEL,UAAU,CAACC,GAAX,CAAgBE,CAAD,IAAgBA,CAAC,KAAKL,QAAN,GAAiB,CAAjB,GAAqB,CAApD;QAFa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