@amazon-devices/react-navigation__react-native-tab-view 8.0.9000000000 → 8.0.9000000002

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 (39) hide show
  1. package/SystemModules/amzn__react-navigation__react-native-tab-view-8.private.modules.txt +35 -29
  2. package/kepler-compatibility.json +4 -2
  3. package/lib/module/index.js +0 -7
  4. package/oss-attribution/attribution.txt +0 -0
  5. package/oss-attribution/licenseInfos.json +1 -0
  6. package/package.json +1 -1
  7. package/src/index.tsx +1 -15
  8. package/SystemBundles/6f915df16edbc21a601928d99e844a99397b9428146027dcf0d86b2a798f21f4.bundle +0 -8563
  9. package/SystemBundles/6f915df16edbc21a601928d99e844a99397b9428146027dcf0d86b2a798f21f4.map +0 -3217
  10. package/lib/module/Pager.android.js +0 -4
  11. package/lib/module/Pager.ios.js +0 -4
  12. package/lib/module/Pager.js +0 -4
  13. package/lib/module/PagerViewAdapter.js +0 -130
  14. package/lib/module/PanResponderAdapter.js +0 -209
  15. package/lib/module/PlatformPressable.js +0 -61
  16. package/lib/module/SceneMap.js +0 -24
  17. package/lib/module/SceneView.js +0 -72
  18. package/lib/module/TabBar.js +0 -472
  19. package/lib/module/TabBarIndicator.js +0 -122
  20. package/lib/module/TabBarItem.js +0 -217
  21. package/lib/module/TabBarItemLabel.js +0 -33
  22. package/lib/module/TabView.js +0 -141
  23. package/lib/module/types.js +0 -4
  24. package/lib/module/useAnimatedValue.js +0 -12
  25. package/src/Pager.android.tsx +0 -1
  26. package/src/Pager.ios.tsx +0 -1
  27. package/src/Pager.tsx +0 -1
  28. package/src/PagerViewAdapter.tsx +0 -185
  29. package/src/PanResponderAdapter.tsx +0 -344
  30. package/src/PlatformPressable.tsx +0 -91
  31. package/src/SceneMap.tsx +0 -30
  32. package/src/SceneView.tsx +0 -106
  33. package/src/TabBar.tsx +0 -728
  34. package/src/TabBarIndicator.tsx +0 -190
  35. package/src/TabBarItem.tsx +0 -308
  36. package/src/TabBarItemLabel.tsx +0 -42
  37. package/src/TabView.tsx +0 -198
  38. package/src/types.tsx +0 -87
  39. package/src/useAnimatedValue.tsx +0 -12
@@ -1,472 +0,0 @@
1
- "use strict";
2
-
3
- import * as React from 'react';
4
- import { Animated, I18nManager, Platform, StyleSheet, View } from 'react-native';
5
- import useLatestCallback from 'use-latest-callback';
6
- import { TabBarIndicator } from "./TabBarIndicator.js";
7
- import { TabBarItem } from "./TabBarItem.js";
8
- import { useAnimatedValue } from "./useAnimatedValue.js";
9
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
- const useNativeDriver = Platform.OS !== 'web';
11
- const Separator = ({
12
- width
13
- }) => {
14
- return /*#__PURE__*/_jsx(View, {
15
- style: {
16
- width
17
- }
18
- });
19
- };
20
- const getFlattenedTabWidth = style => {
21
- const tabStyle = StyleSheet.flatten(style);
22
- return tabStyle?.width;
23
- };
24
- const getFlattenedPaddingStart = style => {
25
- const flattenStyle = StyleSheet.flatten(style);
26
- return flattenStyle ? flattenStyle.paddingLeft || flattenStyle.paddingStart || flattenStyle.paddingHorizontal || 0 : 0;
27
- };
28
- const getFlattenedPaddingEnd = style => {
29
- const flattenStyle = StyleSheet.flatten(style);
30
- return flattenStyle ? flattenStyle.paddingRight || flattenStyle.paddingEnd || flattenStyle.paddingHorizontal || 0 : 0;
31
- };
32
- const convertPaddingPercentToSize = (value, layout) => {
33
- switch (typeof value) {
34
- case 'number':
35
- return value;
36
- case 'string':
37
- if (value.endsWith('%')) {
38
- const width = parseFloat(value);
39
- if (Number.isFinite(width)) {
40
- return layout.width * (width / 100);
41
- }
42
- }
43
- }
44
- return 0;
45
- };
46
- const getComputedTabWidth = (index, layout, routes, scrollEnabled, tabWidths, flattenedWidth, flattenedPaddingStart, flattenedPaddingEnd, gap) => {
47
- if (flattenedWidth === 'auto') {
48
- return tabWidths[routes[index].key] || 0;
49
- }
50
- switch (typeof flattenedWidth) {
51
- case 'number':
52
- return flattenedWidth;
53
- case 'string':
54
- if (flattenedWidth.endsWith('%')) {
55
- const width = parseFloat(flattenedWidth);
56
- if (Number.isFinite(width)) {
57
- return layout.width * (width / 100);
58
- }
59
- }
60
- }
61
- if (scrollEnabled) {
62
- return layout.width / 5 * 2;
63
- }
64
- const gapTotalWidth = (gap ?? 0) * (routes.length - 1);
65
- const paddingTotalWidth = convertPaddingPercentToSize(flattenedPaddingStart, layout) + convertPaddingPercentToSize(flattenedPaddingEnd, layout);
66
- return (layout.width - gapTotalWidth - paddingTotalWidth) / routes.length;
67
- };
68
- const getMaxScrollDistance = (tabBarWidth, layoutWidth) => tabBarWidth - layoutWidth;
69
- const getTranslateX = (scrollAmount, maxScrollDistance, direction) => Animated.multiply(Platform.OS === 'android' && direction === 'rtl' ? Animated.add(maxScrollDistance, Animated.multiply(scrollAmount, -1)) : scrollAmount, direction === 'rtl' ? 1 : -1);
70
- const getTabBarWidth = ({
71
- navigationState,
72
- layout,
73
- gap,
74
- scrollEnabled,
75
- flattenedTabWidth,
76
- flattenedPaddingStart,
77
- flattenedPaddingEnd,
78
- tabWidths
79
- }) => {
80
- const {
81
- routes
82
- } = navigationState;
83
- const paddingsWidth = Math.max(0, convertPaddingPercentToSize(flattenedPaddingStart, layout) + convertPaddingPercentToSize(flattenedPaddingEnd, layout));
84
- return routes.reduce((acc, _, i) => acc + (i > 0 ? gap ?? 0 : 0) + getComputedTabWidth(i, layout, routes, scrollEnabled, tabWidths, flattenedTabWidth, flattenedPaddingStart, flattenedPaddingEnd, gap), paddingsWidth);
85
- };
86
- const normalizeScrollValue = ({
87
- layout,
88
- navigationState,
89
- gap,
90
- scrollEnabled,
91
- tabWidths,
92
- value,
93
- flattenedTabWidth,
94
- flattenedPaddingStart,
95
- flattenedPaddingEnd,
96
- direction
97
- }) => {
98
- const tabBarWidth = getTabBarWidth({
99
- layout,
100
- navigationState,
101
- tabWidths,
102
- gap,
103
- scrollEnabled,
104
- flattenedTabWidth,
105
- flattenedPaddingStart,
106
- flattenedPaddingEnd
107
- });
108
- const maxDistance = getMaxScrollDistance(tabBarWidth, layout.width);
109
- const scrollValue = Math.max(Math.min(value, maxDistance), 0);
110
- if (Platform.OS === 'android' && direction === 'rtl') {
111
- // On Android, scroll value is not applied in reverse in RTL
112
- // so we need to manually adjust it to apply correct value
113
- return maxDistance - scrollValue;
114
- }
115
- return scrollValue;
116
- };
117
- const getScrollAmount = ({
118
- layout,
119
- navigationState,
120
- gap,
121
- scrollEnabled,
122
- flattenedTabWidth,
123
- tabWidths,
124
- flattenedPaddingStart,
125
- flattenedPaddingEnd,
126
- direction
127
- }) => {
128
- const paddingInitial = direction === 'rtl' ? convertPaddingPercentToSize(flattenedPaddingEnd, layout) : convertPaddingPercentToSize(flattenedPaddingStart, layout);
129
- const centerDistance = Array.from({
130
- length: navigationState.index + 1
131
- }).reduce((total, _, i) => {
132
- const tabWidth = getComputedTabWidth(i, layout, navigationState.routes, scrollEnabled, tabWidths, flattenedTabWidth, flattenedPaddingStart, flattenedPaddingEnd, gap);
133
-
134
- // To get the current index centered we adjust scroll amount by width of indexes
135
- // 0 through (i - 1) and add half the width of current index i
136
- return total + (i > 0 ? gap ?? 0 : 0) + (navigationState.index === i ? tabWidth / 2 : tabWidth);
137
- }, paddingInitial);
138
- const scrollAmount = centerDistance - layout.width / 2;
139
- return normalizeScrollValue({
140
- layout,
141
- navigationState,
142
- tabWidths,
143
- value: scrollAmount,
144
- gap,
145
- scrollEnabled,
146
- flattenedTabWidth,
147
- flattenedPaddingStart,
148
- flattenedPaddingEnd,
149
- direction
150
- });
151
- };
152
- const getLabelTextDefault = ({
153
- route
154
- }) => route.title;
155
- const getAccessibleDefault = ({
156
- route
157
- }) => typeof route.accessible !== 'undefined' ? route.accessible : true;
158
- const getAccessibilityLabelDefault = ({
159
- route
160
- }) => typeof route.accessibilityLabel === 'string' ? route.accessibilityLabel : typeof route.title === 'string' ? route.title : undefined;
161
- const renderIndicatorDefault = props => /*#__PURE__*/_jsx(TabBarIndicator, {
162
- ...props
163
- });
164
- const getTestIdDefault = ({
165
- route
166
- }) => route.testID;
167
-
168
- // How many items measurements should we update per batch.
169
- // Defaults to 10, since that's whats FlatList is using in initialNumToRender.
170
- const MEASURE_PER_BATCH = 10;
171
- export function TabBar({
172
- renderIndicator = renderIndicatorDefault,
173
- gap = 0,
174
- scrollEnabled,
175
- jumpTo,
176
- navigationState,
177
- position,
178
- activeColor,
179
- bounces,
180
- contentContainerStyle,
181
- inactiveColor,
182
- indicatorContainerStyle,
183
- indicatorStyle,
184
- onTabLongPress,
185
- onTabPress,
186
- pressColor,
187
- pressOpacity,
188
- direction = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr',
189
- renderTabBarItem,
190
- style,
191
- tabStyle,
192
- layout: propLayout,
193
- testID,
194
- android_ripple,
195
- options
196
- }) {
197
- const [layout, setLayout] = React.useState(propLayout ?? {
198
- width: 0,
199
- height: 0
200
- });
201
- const [tabWidths, setTabWidths] = React.useState({});
202
- const flatListRef = React.useRef(null);
203
- const isFirst = React.useRef(true);
204
- const scrollAmount = useAnimatedValue(0);
205
- const measuredTabWidths = React.useRef({});
206
- const {
207
- routes
208
- } = navigationState;
209
- const flattenedTabWidth = getFlattenedTabWidth(tabStyle);
210
- const isWidthDynamic = flattenedTabWidth === 'auto';
211
- const flattenedPaddingEnd = getFlattenedPaddingEnd(contentContainerStyle);
212
- const flattenedPaddingStart = getFlattenedPaddingStart(contentContainerStyle);
213
- const scrollOffset = getScrollAmount({
214
- layout,
215
- navigationState,
216
- tabWidths,
217
- gap,
218
- scrollEnabled,
219
- flattenedTabWidth,
220
- flattenedPaddingStart,
221
- flattenedPaddingEnd,
222
- direction
223
- });
224
- const hasMeasuredTabWidths = Boolean(layout.width) && routes.slice(0, navigationState.index).every(r => typeof tabWidths[r.key] === 'number');
225
- React.useEffect(() => {
226
- if (isFirst.current) {
227
- isFirst.current = false;
228
- return;
229
- }
230
- if (isWidthDynamic && !hasMeasuredTabWidths) {
231
- return;
232
- }
233
- if (scrollEnabled) {
234
- flatListRef.current?.scrollToOffset({
235
- offset: scrollOffset,
236
- animated: true
237
- });
238
- }
239
- }, [hasMeasuredTabWidths, isWidthDynamic, scrollEnabled, scrollOffset]);
240
- const handleLayout = e => {
241
- const {
242
- height,
243
- width
244
- } = e.nativeEvent.layout;
245
- setLayout(layout => layout.width === width && layout.height === height ? layout : {
246
- width,
247
- height
248
- });
249
- };
250
- const tabBarWidth = getTabBarWidth({
251
- layout,
252
- navigationState,
253
- tabWidths,
254
- gap,
255
- scrollEnabled,
256
- flattenedTabWidth,
257
- flattenedPaddingStart,
258
- flattenedPaddingEnd
259
- });
260
- const separatorsWidth = Math.max(0, routes.length - 1) * gap;
261
- const paddingsWidth = Math.max(0, convertPaddingPercentToSize(flattenedPaddingStart, layout) + convertPaddingPercentToSize(flattenedPaddingEnd, layout));
262
- const translateX = React.useMemo(() => getTranslateX(scrollAmount, getMaxScrollDistance(tabBarWidth, layout.width), direction), [direction, layout.width, scrollAmount, tabBarWidth]);
263
- const renderItem = React.useCallback(({
264
- item: route,
265
- index
266
- }) => {
267
- const {
268
- testID = getTestIdDefault({
269
- route
270
- }),
271
- labelText = getLabelTextDefault({
272
- route
273
- }),
274
- accessible = getAccessibleDefault({
275
- route
276
- }),
277
- accessibilityLabel = getAccessibilityLabelDefault({
278
- route
279
- }),
280
- ...rest
281
- } = options?.[route.key] ?? {};
282
- const onLayout = isWidthDynamic ? e => {
283
- measuredTabWidths.current[route.key] = e.nativeEvent.layout.width;
284
-
285
- // When we have measured widths for all of the tabs, we should updates the state
286
- // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
287
- // If we have more than 10 routes divide updating tabWidths into multiple batches. Here we update only first batch of 10 items.
288
- if (routes.length > MEASURE_PER_BATCH && index === MEASURE_PER_BATCH && routes.slice(0, MEASURE_PER_BATCH).every(r => typeof measuredTabWidths.current[r.key] === 'number')) {
289
- setTabWidths({
290
- ...measuredTabWidths.current
291
- });
292
- } else if (routes.every(r => typeof measuredTabWidths.current[r.key] === 'number')) {
293
- // When we have measured widths for all of the tabs, we should updates the state
294
- // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
295
- setTabWidths({
296
- ...measuredTabWidths.current
297
- });
298
- }
299
- } : undefined;
300
- const onPress = () => {
301
- const event = {
302
- route,
303
- defaultPrevented: false,
304
- preventDefault: () => {
305
- event.defaultPrevented = true;
306
- }
307
- };
308
- onTabPress?.(event);
309
- if (event.defaultPrevented) {
310
- return;
311
- }
312
- jumpTo(route.key);
313
- };
314
- const onLongPress = () => onTabLongPress?.({
315
- route
316
- });
317
-
318
- // Calculate the default width for tab for FlatList to work
319
- const defaultTabWidth = !isWidthDynamic ? getComputedTabWidth(index, layout, routes, scrollEnabled, tabWidths, getFlattenedTabWidth(tabStyle), getFlattenedPaddingEnd(contentContainerStyle), getFlattenedPaddingStart(contentContainerStyle), gap) : undefined;
320
- const props = {
321
- ...rest,
322
- position,
323
- route,
324
- navigationState,
325
- testID,
326
- labelText,
327
- accessible,
328
- accessibilityLabel,
329
- activeColor,
330
- inactiveColor,
331
- pressColor,
332
- pressOpacity,
333
- onLayout,
334
- onPress,
335
- onLongPress,
336
- style: tabStyle,
337
- defaultTabWidth,
338
- android_ripple
339
- };
340
- return /*#__PURE__*/_jsxs(_Fragment, {
341
- children: [gap > 0 && index > 0 ? /*#__PURE__*/_jsx(Separator, {
342
- width: gap
343
- }) : null, renderTabBarItem ? renderTabBarItem({
344
- key: route.key,
345
- ...props
346
- }) : /*#__PURE__*/_jsx(TabBarItem, {
347
- ...props
348
- }, route.key)]
349
- });
350
- }, [position, navigationState, options, activeColor, inactiveColor, pressColor, pressOpacity, isWidthDynamic, tabStyle, layout, routes, scrollEnabled, tabWidths, contentContainerStyle, gap, android_ripple, renderTabBarItem, onTabPress, jumpTo, onTabLongPress]);
351
- const keyExtractor = React.useCallback(item => item.key, []);
352
- const contentContainerStyleMemoized = React.useMemo(() => [styles.tabContent, scrollEnabled ? {
353
- width: tabBarWidth
354
- } : null, contentContainerStyle], [contentContainerStyle, scrollEnabled, tabBarWidth]);
355
- const handleScroll = React.useMemo(() => Animated.event([{
356
- nativeEvent: {
357
- contentOffset: {
358
- x: scrollAmount
359
- }
360
- }
361
- }], {
362
- useNativeDriver
363
- }), [scrollAmount]);
364
- const handleViewableItemsChanged = useLatestCallback(({
365
- changed
366
- }) => {
367
- if (routes.length <= MEASURE_PER_BATCH) {
368
- return;
369
- }
370
- // Get next vievable item
371
- const item = changed[changed.length - 1];
372
- const index = item?.index || 0;
373
- if (item.isViewable && (index % 10 === 0 || index === navigationState.index || index === routes.length - 1)) {
374
- setTabWidths({
375
- ...measuredTabWidths.current
376
- });
377
- }
378
- });
379
- return /*#__PURE__*/_jsxs(Animated.View, {
380
- onLayout: handleLayout,
381
- style: [styles.tabBar, style],
382
- children: [/*#__PURE__*/_jsx(Animated.View, {
383
- pointerEvents: "none",
384
- style: [styles.indicatorContainer, scrollEnabled ? {
385
- transform: [{
386
- translateX
387
- }]
388
- } : null, scrollEnabled ? {
389
- width: tabBarWidth
390
- } : null, indicatorContainerStyle],
391
- children: renderIndicator({
392
- position,
393
- layout,
394
- navigationState,
395
- jumpTo,
396
- direction,
397
- width: isWidthDynamic ? 'auto' : Math.max(0, (tabBarWidth - separatorsWidth - paddingsWidth) / routes.length),
398
- style: [indicatorStyle, {
399
- start: flattenedPaddingStart,
400
- end: flattenedPaddingEnd
401
- }],
402
- getTabWidth: i => getComputedTabWidth(i, layout, routes, scrollEnabled, tabWidths, flattenedTabWidth, flattenedPaddingEnd, flattenedPaddingStart, gap),
403
- gap
404
- })
405
- }), /*#__PURE__*/_jsx(View, {
406
- style: styles.scroll,
407
- children: /*#__PURE__*/_jsx(Animated.FlatList, {
408
- data: routes,
409
- keyExtractor: keyExtractor,
410
- horizontal: true,
411
- role: "tablist",
412
- keyboardShouldPersistTaps: "handled",
413
- scrollEnabled: scrollEnabled,
414
- bounces: bounces,
415
- initialNumToRender: MEASURE_PER_BATCH,
416
- onViewableItemsChanged: handleViewableItemsChanged,
417
- alwaysBounceHorizontal: false,
418
- scrollsToTop: false,
419
- showsHorizontalScrollIndicator: false,
420
- showsVerticalScrollIndicator: false,
421
- automaticallyAdjustContentInsets: false,
422
- overScrollMode: "never",
423
- contentContainerStyle: contentContainerStyleMemoized,
424
- scrollEventThrottle: 16,
425
- renderItem: renderItem,
426
- onScroll: handleScroll,
427
- ref: flatListRef,
428
- testID: testID
429
- })
430
- })]
431
- });
432
- }
433
- const styles = StyleSheet.create({
434
- scroll: {
435
- overflow: Platform.select({
436
- default: 'scroll',
437
- web: undefined
438
- })
439
- },
440
- tabBar: {
441
- zIndex: 1,
442
- backgroundColor: '#2196f3',
443
- elevation: 4,
444
- ...Platform.select({
445
- default: {
446
- shadowColor: 'black',
447
- shadowOpacity: 0.1,
448
- shadowRadius: StyleSheet.hairlineWidth,
449
- shadowOffset: {
450
- height: StyleSheet.hairlineWidth,
451
- width: 0
452
- }
453
- },
454
- web: {
455
- boxShadow: '0 1px 1px rgba(0, 0, 0, 0.1)'
456
- }
457
- })
458
- },
459
- tabContent: {
460
- flexGrow: 1,
461
- flexDirection: 'row',
462
- flexWrap: 'nowrap'
463
- },
464
- indicatorContainer: {
465
- position: 'absolute',
466
- top: 0,
467
- start: 0,
468
- end: 0,
469
- bottom: 0
470
- }
471
- });
472
- //# sourceMappingURL=TabBar.js.map
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- import * as React from 'react';
4
- import { Animated, Easing, Platform, StyleSheet } from 'react-native';
5
- import { useAnimatedValue } from "./useAnimatedValue.js";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const useNativeDriver = Platform.OS !== 'web';
8
- const getTranslateX = (position, routes, getTabWidth, direction, gap, width) => {
9
- const inputRange = routes.map((_, i) => i);
10
-
11
- // every index contains widths at all previous indices
12
- const outputRange = routes.reduce((acc, _, i) => {
13
- if (typeof width === 'number') {
14
- if (i === 0) return [getTabWidth(i) / 2 - width / 2];
15
- let sumTabWidth = 0;
16
- for (let j = 0; j < i; j++) {
17
- sumTabWidth += getTabWidth(j);
18
- }
19
- return [...acc, sumTabWidth + getTabWidth(i) / 2 + (gap ? gap * i : 0) - width / 2];
20
- } else {
21
- if (i === 0) return [0];
22
- return [...acc, acc[i - 1] + getTabWidth(i - 1) + (gap ?? 0)];
23
- }
24
- }, []);
25
- const translateX = position.interpolate({
26
- inputRange,
27
- outputRange,
28
- extrapolate: 'clamp'
29
- });
30
- return Animated.multiply(translateX, direction === 'rtl' ? -1 : 1);
31
- };
32
- export function TabBarIndicator({
33
- getTabWidth,
34
- layout,
35
- navigationState,
36
- position,
37
- width,
38
- direction,
39
- gap,
40
- style,
41
- children
42
- }) {
43
- const isIndicatorShown = React.useRef(false);
44
- const isWidthDynamic = width === 'auto';
45
- const opacity = useAnimatedValue(isWidthDynamic ? 0 : 1);
46
- const indicatorVisible = isWidthDynamic ? layout.width && navigationState.routes.slice(0, navigationState.index).every((_, r) => getTabWidth(r)) : true;
47
- React.useEffect(() => {
48
- const fadeInIndicator = () => {
49
- if (!isIndicatorShown.current && isWidthDynamic &&
50
- // We should fade-in the indicator when we have widths for all the tab items
51
- indicatorVisible) {
52
- isIndicatorShown.current = true;
53
- Animated.timing(opacity, {
54
- toValue: 1,
55
- duration: 150,
56
- easing: Easing.in(Easing.linear),
57
- useNativeDriver
58
- }).start();
59
- }
60
- };
61
- fadeInIndicator();
62
- return () => opacity.stopAnimation();
63
- }, [indicatorVisible, isWidthDynamic, opacity]);
64
- const {
65
- routes
66
- } = navigationState;
67
- const transform = [];
68
- if (layout.width) {
69
- const translateX = routes.length > 1 ? getTranslateX(position, routes, getTabWidth, direction, gap, width) : 0;
70
- transform.push({
71
- translateX
72
- });
73
- }
74
- if (width === 'auto') {
75
- const inputRange = routes.map((_, i) => i);
76
- const outputRange = inputRange.map(getTabWidth);
77
- transform.push({
78
- scaleX: routes.length > 1 ? position.interpolate({
79
- inputRange,
80
- outputRange,
81
- extrapolate: 'clamp'
82
- }) : outputRange[0]
83
- }, {
84
- translateX: direction === 'rtl' ? -0.5 : 0.5
85
- });
86
- }
87
- const styleList = [];
88
-
89
- // scaleX doesn't work properly on chrome and opera for linux and android
90
- if (Platform.OS === 'web' && width === 'auto') {
91
- styleList.push({
92
- width: transform[1].scaleX
93
- }, {
94
- left: transform[0].translateX
95
- });
96
- } else {
97
- styleList.push({
98
- width: width === 'auto' ? 1 : width
99
- }, {
100
- start: `${100 / routes.length * navigationState.index}%`
101
- }, {
102
- transform
103
- });
104
- }
105
- return /*#__PURE__*/_jsx(Animated.View, {
106
- style: [styles.indicator, styleList, width === 'auto' ? {
107
- opacity: opacity
108
- } : null, style],
109
- children: children
110
- });
111
- }
112
- const styles = StyleSheet.create({
113
- indicator: {
114
- backgroundColor: '#ffeb3b',
115
- position: 'absolute',
116
- start: 0,
117
- bottom: 0,
118
- end: 0,
119
- height: 2
120
- }
121
- });
122
- //# sourceMappingURL=TabBarIndicator.js.map