react-native-tab-view 3.3.3 → 3.4.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 (88) hide show
  1. package/README.md +4 -0
  2. package/lib/commonjs/Pager.android.js +0 -2
  3. package/lib/commonjs/Pager.android.js.map +1 -1
  4. package/lib/commonjs/Pager.ios.js +0 -2
  5. package/lib/commonjs/Pager.ios.js.map +1 -1
  6. package/lib/commonjs/Pager.js +0 -2
  7. package/lib/commonjs/Pager.js.map +1 -1
  8. package/lib/commonjs/PagerViewAdapter.js +0 -24
  9. package/lib/commonjs/PagerViewAdapter.js.map +1 -1
  10. package/lib/commonjs/PanResponderAdapter.js +11 -42
  11. package/lib/commonjs/PanResponderAdapter.js.map +1 -1
  12. package/lib/commonjs/PlatformPressable.js +1 -7
  13. package/lib/commonjs/PlatformPressable.js.map +1 -1
  14. package/lib/commonjs/SceneMap.js +0 -5
  15. package/lib/commonjs/SceneMap.js.map +1 -1
  16. package/lib/commonjs/SceneView.js +4 -15
  17. package/lib/commonjs/SceneView.js.map +1 -1
  18. package/lib/commonjs/TabBar.js +24 -60
  19. package/lib/commonjs/TabBar.js.map +1 -1
  20. package/lib/commonjs/TabBarIndicator.js +7 -18
  21. package/lib/commonjs/TabBarIndicator.js.map +1 -1
  22. package/lib/commonjs/TabBarItem.js +7 -31
  23. package/lib/commonjs/TabBarItem.js.map +1 -1
  24. package/lib/commonjs/TabView.js +9 -19
  25. package/lib/commonjs/TabView.js.map +1 -1
  26. package/lib/commonjs/index.js +0 -6
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/commonjs/types.js.map +1 -1
  29. package/lib/commonjs/useAnimatedValue.js +0 -7
  30. package/lib/commonjs/useAnimatedValue.js.map +1 -1
  31. package/lib/module/Pager.android.js.map +1 -1
  32. package/lib/module/Pager.ios.js.map +1 -1
  33. package/lib/module/Pager.js.map +1 -1
  34. package/lib/module/PagerViewAdapter.js +0 -14
  35. package/lib/module/PagerViewAdapter.js.map +1 -1
  36. package/lib/module/PanResponderAdapter.js +11 -28
  37. package/lib/module/PanResponderAdapter.js.map +1 -1
  38. package/lib/module/PlatformPressable.js +1 -2
  39. package/lib/module/PlatformPressable.js.map +1 -1
  40. package/lib/module/SceneMap.js.map +1 -1
  41. package/lib/module/SceneView.js +4 -9
  42. package/lib/module/SceneView.js.map +1 -1
  43. package/lib/module/TabBar.js +24 -48
  44. package/lib/module/TabBar.js.map +1 -1
  45. package/lib/module/TabBarIndicator.js +7 -10
  46. package/lib/module/TabBarIndicator.js.map +1 -1
  47. package/lib/module/TabBarItem.js +7 -19
  48. package/lib/module/TabBarItem.js.map +1 -1
  49. package/lib/module/TabView.js +9 -9
  50. package/lib/module/TabView.js.map +1 -1
  51. package/lib/module/index.js.map +1 -1
  52. package/lib/module/types.js.map +1 -1
  53. package/lib/module/useAnimatedValue.js +0 -2
  54. package/lib/module/useAnimatedValue.js.map +1 -1
  55. package/lib/typescript/src/Pager.android.d.ts +1 -0
  56. package/lib/typescript/src/Pager.android.d.ts.map +1 -0
  57. package/lib/typescript/src/Pager.d.ts +1 -0
  58. package/lib/typescript/src/Pager.d.ts.map +1 -0
  59. package/lib/typescript/src/Pager.ios.d.ts +1 -0
  60. package/lib/typescript/src/Pager.ios.d.ts.map +1 -0
  61. package/lib/typescript/src/PagerViewAdapter.d.ts +1 -0
  62. package/lib/typescript/src/PagerViewAdapter.d.ts.map +1 -0
  63. package/lib/typescript/src/PanResponderAdapter.d.ts +1 -0
  64. package/lib/typescript/src/PanResponderAdapter.d.ts.map +1 -0
  65. package/lib/typescript/src/PlatformPressable.d.ts +1 -0
  66. package/lib/typescript/src/PlatformPressable.d.ts.map +1 -0
  67. package/lib/typescript/src/SceneMap.d.ts +1 -0
  68. package/lib/typescript/src/SceneMap.d.ts.map +1 -0
  69. package/lib/typescript/src/SceneView.d.ts +1 -0
  70. package/lib/typescript/src/SceneView.d.ts.map +1 -0
  71. package/lib/typescript/src/TabBar.d.ts +4 -2
  72. package/lib/typescript/src/TabBar.d.ts.map +1 -0
  73. package/lib/typescript/src/TabBarIndicator.d.ts +1 -0
  74. package/lib/typescript/src/TabBarIndicator.d.ts.map +1 -0
  75. package/lib/typescript/src/TabBarItem.d.ts +3 -1
  76. package/lib/typescript/src/TabBarItem.d.ts.map +1 -0
  77. package/lib/typescript/src/TabView.d.ts +2 -1
  78. package/lib/typescript/src/TabView.d.ts.map +1 -0
  79. package/lib/typescript/src/index.d.ts +1 -0
  80. package/lib/typescript/src/index.d.ts.map +1 -0
  81. package/lib/typescript/src/types.d.ts +1 -0
  82. package/lib/typescript/src/types.d.ts.map +1 -0
  83. package/lib/typescript/src/useAnimatedValue.d.ts +1 -0
  84. package/lib/typescript/src/useAnimatedValue.d.ts.map +1 -0
  85. package/package.json +3 -3
  86. package/src/TabBar.tsx +5 -0
  87. package/src/TabBarItem.tsx +4 -1
  88. package/src/TabView.tsx +2 -0
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
2
  import * as React from 'react';
4
3
  import { Animated, I18nManager, Keyboard, PanResponder, StyleSheet, View } from 'react-native';
5
4
  import useAnimatedValue from './useAnimatedValue';
@@ -44,16 +43,15 @@ export default function PanResponderAdapter(_ref) {
44
43
  timing,
45
44
  ...transitionConfig
46
45
  } = DefaultTransitionSpec;
47
-
48
46
  if (animate) {
49
- Animated.parallel([timing(panX, { ...transitionConfig,
47
+ Animated.parallel([timing(panX, {
48
+ ...transitionConfig,
50
49
  toValue: offset,
51
50
  useNativeDriver: false
52
51
  })]).start(_ref2 => {
53
52
  let {
54
53
  finished
55
54
  } = _ref2;
56
-
57
55
  if (finished) {
58
56
  onIndexChangeRef.current(index);
59
57
  pendingIndexRef.current = undefined;
@@ -79,84 +77,69 @@ export default function PanResponderAdapter(_ref) {
79
77
  if (keyboardDismissMode === 'auto') {
80
78
  Keyboard.dismiss();
81
79
  }
82
-
83
80
  if (layout.width && currentIndexRef.current !== index) {
84
81
  currentIndexRef.current = index;
85
82
  jumpToIndex(index);
86
83
  }
87
84
  }, [jumpToIndex, keyboardDismissMode, layout.width, index]);
88
-
89
85
  const isMovingHorizontally = (_, gestureState) => {
90
86
  return Math.abs(gestureState.dx) > Math.abs(gestureState.dy * 2) && Math.abs(gestureState.vx) > Math.abs(gestureState.vy * 2);
91
87
  };
92
-
93
88
  const canMoveScreen = (event, gestureState) => {
94
89
  if (swipeEnabled === false) {
95
90
  return false;
96
91
  }
97
-
98
92
  const diffX = I18nManager.isRTL ? -gestureState.dx : gestureState.dx;
99
93
  return isMovingHorizontally(event, gestureState) && (diffX >= DEAD_ZONE && currentIndexRef.current > 0 || diffX <= -DEAD_ZONE && currentIndexRef.current < routes.length - 1);
100
94
  };
101
-
102
95
  const startGesture = () => {
103
96
  onSwipeStart === null || onSwipeStart === void 0 ? void 0 : onSwipeStart();
104
-
105
97
  if (keyboardDismissMode === 'on-drag') {
106
98
  Keyboard.dismiss();
107
99
  }
108
-
109
- panX.stopAnimation(); // @ts-expect-error: _value is private, but docs use it as well
110
-
100
+ panX.stopAnimation();
101
+ // @ts-expect-error: _value is private, but docs use it as well
111
102
  panX.setOffset(panX._value);
112
103
  };
113
-
114
104
  const respondToGesture = (_, gestureState) => {
115
105
  const diffX = I18nManager.isRTL ? -gestureState.dx : gestureState.dx;
116
-
117
- if ( // swiping left
118
- diffX > 0 && index <= 0 || // swiping right
106
+ if (
107
+ // swiping left
108
+ diffX > 0 && index <= 0 ||
109
+ // swiping right
119
110
  diffX < 0 && index >= routes.length - 1) {
120
111
  return;
121
112
  }
122
-
123
113
  if (layout.width) {
124
114
  // @ts-expect-error: _offset is private, but docs use it as well
125
115
  const position = (panX._offset + diffX) / -layout.width;
126
116
  const next = position > index ? Math.ceil(position) : Math.floor(position);
127
-
128
117
  if (next !== index) {
129
118
  listenersRef.current.forEach(listener => listener(next));
130
119
  }
131
120
  }
132
-
133
121
  panX.setValue(diffX);
134
122
  };
135
-
136
123
  const finishGesture = (_, gestureState) => {
137
124
  panX.flattenOffset();
138
125
  onSwipeEnd === null || onSwipeEnd === void 0 ? void 0 : onSwipeEnd();
139
126
  const currentIndex = typeof pendingIndexRef.current === 'number' ? pendingIndexRef.current : currentIndexRef.current;
140
127
  let nextIndex = currentIndex;
141
-
142
128
  if (Math.abs(gestureState.dx) > Math.abs(gestureState.dy) && Math.abs(gestureState.vx) > Math.abs(gestureState.vy) && (Math.abs(gestureState.dx) > swipeDistanceThreshold || Math.abs(gestureState.vx) > swipeVelocityThreshold)) {
143
129
  nextIndex = Math.round(Math.min(Math.max(0, I18nManager.isRTL ? currentIndex + gestureState.dx / Math.abs(gestureState.dx) : currentIndex - gestureState.dx / Math.abs(gestureState.dx)), routes.length - 1));
144
130
  currentIndexRef.current = nextIndex;
145
131
  }
146
-
147
132
  if (!isFinite(nextIndex)) {
148
133
  nextIndex = currentIndex;
149
134
  }
150
-
151
135
  jumpToIndex(nextIndex, true);
152
- }; // TODO: use the listeners
153
-
136
+ };
154
137
 
138
+ // TODO: use the listeners
155
139
  const addEnterListener = React.useCallback(listener => {
156
140
  listenersRef.current.push(listener);
157
141
  return () => {
158
142
  const index = listenersRef.current.indexOf(listener);
159
-
160
143
  if (index > -1) {
161
144
  listenersRef.current.splice(index, 1);
162
145
  }
@@ -183,7 +166,7 @@ export default function PanResponderAdapter(_ref) {
183
166
  }), I18nManager.isRTL ? -1 : 1);
184
167
  const position = React.useMemo(() => layout.width ? Animated.divide(panX, -layout.width) : null, [layout.width, panX]);
185
168
  return children({
186
- position: position !== null && position !== void 0 ? position : new Animated.Value(index),
169
+ position: position ?? new Animated.Value(index),
187
170
  addEnterListener,
188
171
  jumpTo,
189
172
  render: children => /*#__PURE__*/React.createElement(Animated.View, _extends({
@@ -1 +1 @@
1
- {"version":3,"names":["React","Animated","I18nManager","Keyboard","PanResponder","StyleSheet","View","useAnimatedValue","DEAD_ZONE","DefaultTransitionSpec","timing","spring","stiffness","damping","mass","overshootClamping","PanResponderAdapter","layout","keyboardDismissMode","swipeEnabled","navigationState","onIndexChange","onSwipeStart","onSwipeEnd","children","style","animationEnabled","routes","index","panX","listenersRef","useRef","navigationStateRef","layoutRef","onIndexChangeRef","currentIndexRef","pendingIndexRef","swipeVelocityThreshold","swipeDistanceThreshold","width","jumpToIndex","useCallback","animate","offset","current","transitionConfig","parallel","toValue","useNativeDriver","start","finished","undefined","setValue","useEffect","dismiss","isMovingHorizontally","_","gestureState","Math","abs","dx","dy","vx","vy","canMoveScreen","event","diffX","isRTL","length","startGesture","stopAnimation","setOffset","_value","respondToGesture","position","_offset","next","ceil","floor","forEach","listener","finishGesture","flattenOffset","currentIndex","nextIndex","round","min","max","isFinite","addEnterListener","push","indexOf","splice","jumpTo","key","findIndex","route","panResponder","create","onMoveShouldSetPanResponder","onMoveShouldSetPanResponderCapture","onPanResponderGrant","onPanResponderMove","onPanResponderTerminate","onPanResponderRelease","onPanResponderTerminationRequest","maxTranslate","translateX","multiply","interpolate","inputRange","outputRange","extrapolate","useMemo","divide","Value","render","styles","sheet","transform","panHandlers","Children","map","child","i","focused","absoluteFill","flex","flexDirection","alignItems"],"sources":["PanResponderAdapter.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n GestureResponderEvent,\n I18nManager,\n Keyboard,\n PanResponder,\n PanResponderGestureState,\n StyleSheet,\n View,\n} from 'react-native';\n\nimport type {\n EventEmitterProps,\n Layout,\n Listener,\n NavigationState,\n PagerProps,\n Route,\n} from './types';\nimport useAnimatedValue from './useAnimatedValue';\n\ntype Props<T extends Route> = PagerProps & {\n layout: Layout;\n onIndexChange: (index: number) => void;\n navigationState: NavigationState<T>;\n children: (\n props: EventEmitterProps & {\n // Animated value which represents the state of current index\n // It can include fractional digits as it represents the intermediate value\n position: Animated.AnimatedInterpolation;\n // Function to actually render the content of the pager\n // The parent component takes care of rendering\n render: (children: React.ReactNode) => React.ReactNode;\n // Callback to call when switching the tab\n // The tab switch animation is performed even if the index in state is unchanged\n jumpTo: (key: string) => void;\n }\n ) => React.ReactElement;\n};\n\nconst DEAD_ZONE = 12;\n\nconst DefaultTransitionSpec = {\n timing: Animated.spring,\n stiffness: 1000,\n damping: 500,\n mass: 3,\n overshootClamping: true,\n};\n\nexport default function PanResponderAdapter<T extends Route>({\n layout,\n keyboardDismissMode = 'auto',\n swipeEnabled = true,\n navigationState,\n onIndexChange,\n onSwipeStart,\n onSwipeEnd,\n children,\n style,\n animationEnabled = false,\n}: Props<T>) {\n const { routes, index } = navigationState;\n\n const panX = useAnimatedValue(0);\n\n const listenersRef = React.useRef<Listener[]>([]);\n\n const navigationStateRef = React.useRef(navigationState);\n const layoutRef = React.useRef(layout);\n const onIndexChangeRef = React.useRef(onIndexChange);\n\n const currentIndexRef = React.useRef(index);\n const pendingIndexRef = React.useRef<number>();\n\n const swipeVelocityThreshold = 0.15;\n const swipeDistanceThreshold = layout.width / 1.75;\n\n const jumpToIndex = React.useCallback(\n (index: number, animate = animationEnabled) => {\n const offset = -index * layoutRef.current.width;\n\n const { timing, ...transitionConfig } = DefaultTransitionSpec;\n\n if (animate) {\n Animated.parallel([\n timing(panX, {\n ...transitionConfig,\n toValue: offset,\n useNativeDriver: false,\n }),\n ]).start(({ finished }) => {\n if (finished) {\n onIndexChangeRef.current(index);\n pendingIndexRef.current = undefined;\n }\n });\n pendingIndexRef.current = index;\n } else {\n panX.setValue(offset);\n onIndexChangeRef.current(index);\n pendingIndexRef.current = undefined;\n }\n },\n [animationEnabled, panX]\n );\n\n React.useEffect(() => {\n navigationStateRef.current = navigationState;\n layoutRef.current = layout;\n onIndexChangeRef.current = onIndexChange;\n });\n\n React.useEffect(() => {\n const offset = -navigationStateRef.current.index * layout.width;\n\n panX.setValue(offset);\n }, [layout.width, panX]);\n\n React.useEffect(() => {\n if (keyboardDismissMode === 'auto') {\n Keyboard.dismiss();\n }\n\n if (layout.width && currentIndexRef.current !== index) {\n currentIndexRef.current = index;\n jumpToIndex(index);\n }\n }, [jumpToIndex, keyboardDismissMode, layout.width, index]);\n\n const isMovingHorizontally = (\n _: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => {\n return (\n Math.abs(gestureState.dx) > Math.abs(gestureState.dy * 2) &&\n Math.abs(gestureState.vx) > Math.abs(gestureState.vy * 2)\n );\n };\n\n const canMoveScreen = (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => {\n if (swipeEnabled === false) {\n return false;\n }\n\n const diffX = I18nManager.isRTL ? -gestureState.dx : gestureState.dx;\n\n return (\n isMovingHorizontally(event, gestureState) &&\n ((diffX >= DEAD_ZONE && currentIndexRef.current > 0) ||\n (diffX <= -DEAD_ZONE && currentIndexRef.current < routes.length - 1))\n );\n };\n\n const startGesture = () => {\n onSwipeStart?.();\n\n if (keyboardDismissMode === 'on-drag') {\n Keyboard.dismiss();\n }\n\n panX.stopAnimation();\n // @ts-expect-error: _value is private, but docs use it as well\n panX.setOffset(panX._value);\n };\n\n const respondToGesture = (\n _: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => {\n const diffX = I18nManager.isRTL ? -gestureState.dx : gestureState.dx;\n\n if (\n // swiping left\n (diffX > 0 && index <= 0) ||\n // swiping right\n (diffX < 0 && index >= routes.length - 1)\n ) {\n return;\n }\n\n if (layout.width) {\n // @ts-expect-error: _offset is private, but docs use it as well\n const position = (panX._offset + diffX) / -layout.width;\n const next =\n position > index ? Math.ceil(position) : Math.floor(position);\n\n if (next !== index) {\n listenersRef.current.forEach((listener) => listener(next));\n }\n }\n\n panX.setValue(diffX);\n };\n\n const finishGesture = (\n _: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => {\n panX.flattenOffset();\n\n onSwipeEnd?.();\n\n const currentIndex =\n typeof pendingIndexRef.current === 'number'\n ? pendingIndexRef.current\n : currentIndexRef.current;\n\n let nextIndex = currentIndex;\n\n if (\n Math.abs(gestureState.dx) > Math.abs(gestureState.dy) &&\n Math.abs(gestureState.vx) > Math.abs(gestureState.vy) &&\n (Math.abs(gestureState.dx) > swipeDistanceThreshold ||\n Math.abs(gestureState.vx) > swipeVelocityThreshold)\n ) {\n nextIndex = Math.round(\n Math.min(\n Math.max(\n 0,\n I18nManager.isRTL\n ? currentIndex + gestureState.dx / Math.abs(gestureState.dx)\n : currentIndex - gestureState.dx / Math.abs(gestureState.dx)\n ),\n routes.length - 1\n )\n );\n\n currentIndexRef.current = nextIndex;\n }\n\n if (!isFinite(nextIndex)) {\n nextIndex = currentIndex;\n }\n\n jumpToIndex(nextIndex, true);\n };\n\n // TODO: use the listeners\n const addEnterListener = React.useCallback((listener: Listener) => {\n listenersRef.current.push(listener);\n\n return () => {\n const index = listenersRef.current.indexOf(listener);\n\n if (index > -1) {\n listenersRef.current.splice(index, 1);\n }\n };\n }, []);\n\n const jumpTo = React.useCallback(\n (key: string) => {\n const index = navigationStateRef.current.routes.findIndex(\n (route: { key: string }) => route.key === key\n );\n\n jumpToIndex(index);\n },\n [jumpToIndex]\n );\n\n const panResponder = PanResponder.create({\n onMoveShouldSetPanResponder: canMoveScreen,\n onMoveShouldSetPanResponderCapture: canMoveScreen,\n onPanResponderGrant: startGesture,\n onPanResponderMove: respondToGesture,\n onPanResponderTerminate: finishGesture,\n onPanResponderRelease: finishGesture,\n onPanResponderTerminationRequest: () => true,\n });\n\n const maxTranslate = layout.width * (routes.length - 1);\n const translateX = Animated.multiply(\n panX.interpolate({\n inputRange: [-maxTranslate, 0],\n outputRange: [-maxTranslate, 0],\n extrapolate: 'clamp',\n }),\n I18nManager.isRTL ? -1 : 1\n );\n\n const position = React.useMemo(\n () => (layout.width ? Animated.divide(panX, -layout.width) : null),\n [layout.width, panX]\n );\n\n return children({\n position: position ?? new Animated.Value(index),\n addEnterListener,\n jumpTo,\n render: (children) => (\n <Animated.View\n style={[\n styles.sheet,\n layout.width\n ? {\n width: routes.length * layout.width,\n transform: [{ translateX }],\n }\n : null,\n style,\n ]}\n {...panResponder.panHandlers}\n >\n {React.Children.map(children, (child, i) => {\n const route = routes[i];\n const focused = i === index;\n\n return (\n <View\n key={route.key}\n style={\n layout.width\n ? { width: layout.width }\n : focused\n ? StyleSheet.absoluteFill\n : null\n }\n >\n {focused || layout.width ? child : null}\n </View>\n );\n })}\n </Animated.View>\n ),\n });\n}\n\nconst styles = StyleSheet.create({\n sheet: {\n flex: 1,\n flexDirection: 'row',\n alignItems: 'stretch',\n },\n});\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,QADF,EAGEC,WAHF,EAIEC,QAJF,EAKEC,YALF,EAOEC,UAPF,EAQEC,IARF,QASO,cATP;AAmBA,OAAOC,gBAAP,MAA6B,oBAA7B;AAqBA,MAAMC,SAAS,GAAG,EAAlB;AAEA,MAAMC,qBAAqB,GAAG;EAC5BC,MAAM,EAAET,QAAQ,CAACU,MADW;EAE5BC,SAAS,EAAE,IAFiB;EAG5BC,OAAO,EAAE,GAHmB;EAI5BC,IAAI,EAAE,CAJsB;EAK5BC,iBAAiB,EAAE;AALS,CAA9B;AAQA,eAAe,SAASC,mBAAT,OAWF;EAAA,IAXgD;IAC3DC,MAD2D;IAE3DC,mBAAmB,GAAG,MAFqC;IAG3DC,YAAY,GAAG,IAH4C;IAI3DC,eAJ2D;IAK3DC,aAL2D;IAM3DC,YAN2D;IAO3DC,UAP2D;IAQ3DC,QAR2D;IAS3DC,KAT2D;IAU3DC,gBAAgB,GAAG;EAVwC,CAWhD;EACX,MAAM;IAAEC,MAAF;IAAUC;EAAV,IAAoBR,eAA1B;EAEA,MAAMS,IAAI,GAAGtB,gBAAgB,CAAC,CAAD,CAA7B;EAEA,MAAMuB,YAAY,GAAG9B,KAAK,CAAC+B,MAAN,CAAyB,EAAzB,CAArB;EAEA,MAAMC,kBAAkB,GAAGhC,KAAK,CAAC+B,MAAN,CAAaX,eAAb,CAA3B;EACA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A6B,CAACmG,KAAD,EAAQC,CAAR,KAAc;MAC1C,MAAM5B,KAAK,GAAGrE,MAAM,CAACiG,CAAD,CAApB;MACA,MAAMC,OAAO,GAAGD,CAAC,KAAKhG,KAAtB;MAEA,oBACE,oBAAC,IAAD;QACE,GAAG,EAAEoE,KAAK,CAACF,GADb;QAEE,KAAK,EACH7E,MAAM,CAACsB,KAAP,GACI;UAAEA,KAAK,EAAEtB,MAAM,CAACsB;QAAhB,CADJ,GAEIsF,OAAO,GACPxH,UAAU,CAACyH,YADJ,GAEP;MAPR,GAUGD,OAAO,IAAI5G,MAAM,CAACsB,KAAlB,GAA0BoF,KAA1B,GAAkC,IAVrC,CADF;IAcD,CAlBA,CAbH;EALY,CAAD,CAAf;AAwCD;AAED,MAAMN,MAAM,GAAGhH,UAAU,CAAC6F,MAAX,CAAkB;EAC/BoB,KAAK,EAAE;IACLS,IAAI,EAAE,CADD;IAELC,aAAa,EAAE,KAFV;IAGLC,UAAU,EAAE;EAHP;AADwB,CAAlB,CAAf"}
1
+ {"version":3,"names":["React","Animated","I18nManager","Keyboard","PanResponder","StyleSheet","View","useAnimatedValue","DEAD_ZONE","DefaultTransitionSpec","timing","spring","stiffness","damping","mass","overshootClamping","PanResponderAdapter","layout","keyboardDismissMode","swipeEnabled","navigationState","onIndexChange","onSwipeStart","onSwipeEnd","children","style","animationEnabled","routes","index","panX","listenersRef","useRef","navigationStateRef","layoutRef","onIndexChangeRef","currentIndexRef","pendingIndexRef","swipeVelocityThreshold","swipeDistanceThreshold","width","jumpToIndex","useCallback","animate","offset","current","transitionConfig","parallel","toValue","useNativeDriver","start","finished","undefined","setValue","useEffect","dismiss","isMovingHorizontally","_","gestureState","Math","abs","dx","dy","vx","vy","canMoveScreen","event","diffX","isRTL","length","startGesture","stopAnimation","setOffset","_value","respondToGesture","position","_offset","next","ceil","floor","forEach","listener","finishGesture","flattenOffset","currentIndex","nextIndex","round","min","max","isFinite","addEnterListener","push","indexOf","splice","jumpTo","key","findIndex","route","panResponder","create","onMoveShouldSetPanResponder","onMoveShouldSetPanResponderCapture","onPanResponderGrant","onPanResponderMove","onPanResponderTerminate","onPanResponderRelease","onPanResponderTerminationRequest","maxTranslate","translateX","multiply","interpolate","inputRange","outputRange","extrapolate","useMemo","divide","Value","render","styles","sheet","transform","panHandlers","Children","map","child","i","focused","absoluteFill","flex","flexDirection","alignItems"],"sourceRoot":"../../src","sources":["PanResponderAdapter.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EAERC,WAAW,EACXC,QAAQ,EACRC,YAAY,EAEZC,UAAU,EACVC,IAAI,QACC,cAAc;AAUrB,OAAOC,gBAAgB,MAAM,oBAAoB;AAqBjD,MAAMC,SAAS,GAAG,EAAE;AAEpB,MAAMC,qBAAqB,GAAG;EAC5BC,MAAM,EAAET,QAAQ,CAACU,MAAM;EACvBC,SAAS,EAAE,IAAI;EACfC,OAAO,EAAE,GAAG;EACZC,IAAI,EAAE,CAAC;EACPC,iBAAiB,EAAE;AACrB,CAAC;AAED,eAAe,SAASC,mBAAmB,OAW9B;EAAA,IAXgD;IAC3DC,MAAM;IACNC,mBAAmB,GAAG,MAAM;IAC5BC,YAAY,GAAG,IAAI;IACnBC,eAAe;IACfC,aAAa;IACbC,YAAY;IACZC,UAAU;IACVC,QAAQ;IACRC,KAAK;IACLC,gBAAgB,GAAG;EACX,CAAC;EACT,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGR,eAAe;EAEzC,MAAMS,IAAI,GAAGtB,gBAAgB,CAAC,CAAC,CAAC;EAEhC,MAAMuB,YAAY,GAAG9B,KAAK,CAAC+B,MAAM,CAAa,EAAE,CAAC;EAEjD,MAAMC,kBAAkB,GAAGhC,KAAK,CAAC+B,MAAM,CAACX,eAAe,CAAC;EACxD,MAAMa,SAAS,GAAGjC,KAAK,CAAC+B,MAAM,CAACd,MAAM,CAAC;EACtC,MAAMiB,gBAAgB,GAAGlC,KAAK,C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oE,KAAK,CAACF,GAAI;QACf,KAAK,EACH7E,MAAM,CAACsB,KAAK,GACR;UAAEA,KAAK,EAAEtB,MAAM,CAACsB;QAAM,CAAC,GACvBsF,OAAO,GACPxH,UAAU,CAACyH,YAAY,GACvB;MACL,GAEAD,OAAO,IAAI5G,MAAM,CAACsB,KAAK,GAAGoF,KAAK,GAAG,IAAI,CAClC;IAEX,CAAC,CAAC;EAGR,CAAC,CAAC;AACJ;AAEA,MAAMN,MAAM,GAAGhH,UAAU,CAAC6F,MAAM,CAAC;EAC/BoB,KAAK,EAAE;IACLS,IAAI,EAAE,CAAC;IACPC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
2
  import * as React from 'react';
4
3
  import { Platform, Pressable } from 'react-native';
5
4
  const ANDROID_VERSION_LOLLIPOP = 21;
6
5
  const ANDROID_SUPPORTS_RIPPLE = Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_LOLLIPOP;
6
+
7
7
  /**
8
8
  * PlatformPressable provides an abstraction on top of TouchableNativeFeedback and
9
9
  * TouchableOpacity to handle platform differences.
@@ -11,7 +11,6 @@ const ANDROID_SUPPORTS_RIPPLE = Platform.OS === 'android' && Platform.Version >=
11
11
  * On Android, you can pass the props of TouchableNativeFeedback.
12
12
  * On other platforms, you can pass the props of TouchableOpacity.
13
13
  */
14
-
15
14
  export default function PlatformPressable(_ref) {
16
15
  let {
17
16
  android_ripple,
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","Pressable","ANDROID_VERSION_LOLLIPOP","ANDROID_SUPPORTS_RIPPLE","OS","Version","PlatformPressable","android_ripple","pressColor","pressOpacity","style","rest","color","undefined","pressed","opacity"],"sources":["PlatformPressable.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Platform, Pressable, PressableProps } from 'react-native';\n\nexport type Props = PressableProps & {\n pressColor?: string;\n pressOpacity?: number;\n children: React.ReactNode;\n};\n\nconst ANDROID_VERSION_LOLLIPOP = 21;\nconst ANDROID_SUPPORTS_RIPPLE =\n Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_LOLLIPOP;\n\n/**\n * PlatformPressable provides an abstraction on top of TouchableNativeFeedback and\n * TouchableOpacity to handle platform differences.\n *\n * On Android, you can pass the props of TouchableNativeFeedback.\n * On other platforms, you can pass the props of TouchableOpacity.\n */\nexport default function PlatformPressable({\n android_ripple,\n pressColor = 'rgba(0, 0, 0, .32)',\n pressOpacity,\n style,\n ...rest\n}: Props) {\n return (\n <Pressable\n android_ripple={\n ANDROID_SUPPORTS_RIPPLE\n ? { color: pressColor, ...android_ripple }\n : undefined\n }\n style={({ pressed }) => [\n { opacity: pressed && !ANDROID_SUPPORTS_RIPPLE ? pressOpacity : 1 },\n typeof style === 'function' ? style({ pressed }) : style,\n ]}\n {...rest}\n />\n );\n}\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoD,cAApD;AAQA,MAAMC,wBAAwB,GAAG,EAAjC;AACA,MAAMC,uBAAuB,GAC3BH,QAAQ,CAACI,EAAT,KAAgB,SAAhB,IAA6BJ,QAAQ,CAACK,OAAT,IAAoBH,wBADnD;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASI,iBAAT,OAML;EAAA,IANgC;IACxCC,cADwC;IAExCC,UAAU,GAAG,oBAF2B;IAGxCC,YAHwC;IAIxCC,KAJwC;IAKxC,GAAGC;EALqC,CAMhC;EACR,oBACE,oBAAC,SAAD;IACE,cAAc,EACZR,uBAAuB,GACnB;MAAES,KAAK,EAAEJ,UAAT;MAAqB,GAAGD;IAAxB,CADmB,GAEnBM,SAJR;IAME,KAAK,EAAE;MAAA,IAAC;QAAEC;MAAF,CAAD;MAAA,OAAiB,CACtB;QAAEC,OAAO,EAAED,OAAO,IAAI,CAACX,uBAAZ,GAAsCM,YAAtC,GAAqD;MAAhE,CADsB,EAEtB,OAAOC,KAAP,KAAiB,UAAjB,GAA8BA,KAAK,CAAC;QAAEI;MAAF,CAAD,CAAnC,GAAmDJ,KAF7B,CAAjB;IAAA;EANT,GAUMC,IAVN,EADF;AAcD"}
1
+ {"version":3,"names":["React","Platform","Pressable","ANDROID_VERSION_LOLLIPOP","ANDROID_SUPPORTS_RIPPLE","OS","Version","PlatformPressable","android_ripple","pressColor","pressOpacity","style","rest","color","undefined","pressed","opacity"],"sourceRoot":"../../src","sources":["PlatformPressable.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,SAAS,QAAwB,cAAc;AAQlE,MAAMC,wBAAwB,GAAG,EAAE;AACnC,MAAMC,uBAAuB,GAC3BH,QAAQ,CAACI,EAAE,KAAK,SAAS,IAAIJ,QAAQ,CAACK,OAAO,IAAIH,wBAAwB;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASI,iBAAiB,OAM/B;EAAA,IANgC;IACxCC,cAAc;IACdC,UAAU,GAAG,oBAAoB;IACjCC,YAAY;IACZC,KAAK;IACL,GAAGC;EACE,CAAC;EACN,oBACE,oBAAC,SAAS;IACR,cAAc,EACZR,uBAAuB,GACnB;MAAES,KAAK,EAAEJ,UAAU;MAAE,GAAGD;IAAe,CAAC,GACxCM,SACL;IACD,KAAK,EAAE;MAAA,IAAC;QAAEC;MAAQ,CAAC;MAAA,OAAK,CACtB;QAAEC,OAAO,EAAED,OAAO,IAAI,CAACX,uBAAuB,GAAGM,YAAY,GAAG;MAAE,CAAC,EACnE,OAAOC,KAAK,KAAK,UAAU,GAAGA,KAAK,CAAC;QAAEI;MAAQ,CAAC,CAAC,GAAGJ,KAAK,CACzD;IAAA;EAAC,GACEC,IAAI,EACR;AAEN"}
@@ -1 +1 @@
1
- {"version":3,"names":["React","SceneComponent","memo","component","rest","createElement","SceneMap","scenes","route","jumpTo","position","key"],"sources":["SceneMap.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport type { SceneRendererProps } from './types';\n\ntype SceneProps = {\n route: any;\n} & Omit<SceneRendererProps, 'layout'>;\n\nconst SceneComponent = React.memo(\n <T extends { component: React.ComponentType<any> } & SceneProps>({\n component,\n ...rest\n }: T) => {\n return React.createElement(component, rest);\n }\n);\n\nexport default function SceneMap<T extends any>(scenes: {\n [key: string]: React.ComponentType<T>;\n}) {\n return ({ route, jumpTo, position }: SceneProps) => (\n <SceneComponent\n key={route.key}\n component={scenes[route.key]}\n route={route}\n jumpTo={jumpTo}\n position={position}\n />\n );\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAQA,MAAMC,cAAc,gBAAGD,KAAK,CAACE,IAAN,CACrB,QAGS;EAAA,IAHwD;IAC/DC,SAD+D;IAE/D,GAAGC;EAF4D,CAGxD;EACP,oBAAOJ,KAAK,CAACK,aAAN,CAAoBF,SAApB,EAA+BC,IAA/B,CAAP;AACD,CANoB,CAAvB;AASA,eAAe,SAASE,QAAT,CAAiCC,MAAjC,EAEZ;EACD,OAAO;IAAA,IAAC;MAAEC,KAAF;MAASC,MAAT;MAAiBC;IAAjB,CAAD;IAAA,oBACL,oBAAC,cAAD;MACE,GAAG,EAAEF,KAAK,CAACG,GADb;MAEE,SAAS,EAAEJ,MAAM,CAACC,KAAK,CAACG,GAAP,CAFnB;MAGE,KAAK,EAAEH,KAHT;MAIE,MAAM,EAAEC,MAJV;MAKE,QAAQ,EAAEC;IALZ,EADK;EAAA,CAAP;AASD"}
1
+ {"version":3,"names":["React","SceneComponent","memo","component","rest","createElement","SceneMap","scenes","route","jumpTo","position","key"],"sourceRoot":"../../src","sources":["SceneMap.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAQ9B,MAAMC,cAAc,gBAAGD,KAAK,CAACE,IAAI,CAC/B,QAGS;EAAA,IAHwD;IAC/DC,SAAS;IACT,GAAGC;EACF,CAAC;EACF,oBAAOJ,KAAK,CAACK,aAAa,CAACF,SAAS,EAAEC,IAAI,CAAC;AAC7C,CAAC,CACF;AAED,eAAe,SAASE,QAAQ,CAAgBC,MAE/C,EAAE;EACD,OAAO;IAAA,IAAC;MAAEC,KAAK;MAAEC,MAAM;MAAEC;IAAqB,CAAC;IAAA,oBAC7C,oBAAC,cAAc;MACb,GAAG,EAAEF,KAAK,CAACG,GAAI;MACf,SAAS,EAAEJ,MAAM,CAACC,KAAK,CAACG,GAAG,CAAE;MAC7B,KAAK,EAAEH,KAAM;MACb,MAAM,EAAEC,MAAO;MACf,QAAQ,EAAEC;IAAS,EACnB;EAAA,CACH;AACH"}
@@ -12,12 +12,10 @@ export default function SceneView(_ref) {
12
12
  style
13
13
  } = _ref;
14
14
  const [isLoading, setIsLoading] = React.useState(Math.abs(navigationState.index - index) > lazyPreloadDistance);
15
-
16
15
  if (isLoading && Math.abs(navigationState.index - index) <= lazyPreloadDistance) {
17
16
  // Always render the route when it becomes focused
18
17
  setIsLoading(false);
19
18
  }
20
-
21
19
  React.useEffect(() => {
22
20
  const handleEnter = value => {
23
21
  // If we're entering the current route, we need to load it
@@ -26,15 +24,12 @@ export default function SceneView(_ref) {
26
24
  if (prevState) {
27
25
  return false;
28
26
  }
29
-
30
27
  return prevState;
31
28
  });
32
29
  }
33
30
  };
34
-
35
31
  let unsubscribe;
36
32
  let timer;
37
-
38
33
  if (lazy && isLoading) {
39
34
  // If lazy mode is enabled, listen to when we enter screens
40
35
  unsubscribe = addEnterListener(handleEnter);
@@ -43,10 +38,8 @@ export default function SceneView(_ref) {
43
38
  // This improves the initial startup time as the scene is no longer blocking
44
39
  timer = setTimeout(() => setIsLoading(false), 0);
45
40
  }
46
-
47
41
  return () => {
48
42
  var _unsubscribe;
49
-
50
43
  (_unsubscribe = unsubscribe) === null || _unsubscribe === void 0 ? void 0 : _unsubscribe();
51
44
  clearTimeout(timer);
52
45
  };
@@ -55,12 +48,14 @@ export default function SceneView(_ref) {
55
48
  return /*#__PURE__*/React.createElement(View, {
56
49
  accessibilityElementsHidden: !focused,
57
50
  importantForAccessibility: focused ? 'auto' : 'no-hide-descendants',
58
- style: [styles.route, // If we don't have the layout yet, make the focused screen fill the container
51
+ style: [styles.route,
52
+ // If we don't have the layout yet, make the focused screen fill the container
59
53
  // This avoids delay before we are able to render pages side by side
60
54
  layout.width ? {
61
55
  width: layout.width
62
56
  } : focused ? StyleSheet.absoluteFill : null, style]
63
- }, // Only render the route only if it's either focused or layout is available
57
+ },
58
+ // Only render the route only if it's either focused or layout is available
64
59
  // When layout is not available, we must not render unfocused routes
65
60
  // so that the focused route can fill the screen
66
61
  focused || layout.width ? children({
@@ -1 +1 @@
1
- {"version":3,"names":["React","StyleSheet","View","SceneView","children","navigationState","lazy","layout","index","lazyPreloadDistance","addEnterListener","style","isLoading","setIsLoading","useState","Math","abs","useEffect","handleEnter","value","prevState","unsubscribe","timer","setTimeout","clearTimeout","focused","styles","route","width","absoluteFill","loading","create","flex","overflow"],"sources":["SceneView.tsx"],"sourcesContent":["import * as React from 'react';\nimport { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport type {\n EventEmitterProps,\n NavigationState,\n Route,\n SceneRendererProps,\n} from './types';\n\ntype Props<T extends Route> = SceneRendererProps &\n EventEmitterProps & {\n navigationState: NavigationState<T>;\n lazy: boolean;\n lazyPreloadDistance: number;\n index: number;\n children: (props: { loading: boolean }) => React.ReactNode;\n style?: StyleProp<ViewStyle>;\n };\n\nexport default function SceneView<T extends Route>({\n children,\n navigationState,\n lazy,\n layout,\n index,\n lazyPreloadDistance,\n addEnterListener,\n style,\n}: Props<T>) {\n const [isLoading, setIsLoading] = React.useState(\n Math.abs(navigationState.index - index) > lazyPreloadDistance\n );\n\n if (\n isLoading &&\n Math.abs(navigationState.index - index) <= lazyPreloadDistance\n ) {\n // Always render the route when it becomes focused\n setIsLoading(false);\n }\n\n React.useEffect(() => {\n const handleEnter = (value: number) => {\n // If we're entering the current route, we need to load it\n if (value === index) {\n setIsLoading((prevState) => {\n if (prevState) {\n return false;\n }\n return prevState;\n });\n }\n };\n\n let unsubscribe: (() => void) | undefined;\n let timer: NodeJS.Timeout;\n\n if (lazy && isLoading) {\n // If lazy mode is enabled, listen to when we enter screens\n unsubscribe = addEnterListener(handleEnter);\n } else if (isLoading) {\n // If lazy mode is not enabled, render the scene with a delay if not loaded already\n // This improves the initial startup time as the scene is no longer blocking\n timer = setTimeout(() => setIsLoading(false), 0);\n }\n\n return () => {\n unsubscribe?.();\n clearTimeout(timer);\n };\n }, [addEnterListener, index, isLoading, lazy]);\n\n const focused = navigationState.index === index;\n\n return (\n <View\n accessibilityElementsHidden={!focused}\n importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}\n style={[\n styles.route,\n // If we don't have the layout yet, make the focused screen fill the container\n // This avoids delay before we are able to render pages side by side\n layout.width\n ? { width: layout.width }\n : focused\n ? StyleSheet.absoluteFill\n : null,\n style,\n ]}\n >\n {\n // Only render the route only if it's either focused or layout is available\n // When layout is not available, we must not render unfocused routes\n // so that the focused route can fill the screen\n focused || layout.width ? children({ loading: isLoading }) : null\n }\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n route: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAAoBC,UAApB,EAAgCC,IAAhC,QAAuD,cAAvD;AAmBA,eAAe,SAASC,SAAT,OASF;EAAA,IATsC;IACjDC,QADiD;IAEjDC,eAFiD;IAGjDC,IAHiD;IAIjDC,MAJiD;IAKjDC,KALiD;IAMjDC,mBANiD;IAOjDC,gBAPiD;IAQjDC;EARiD,CAStC;EACX,MAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4Bb,KAA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,KAAK,EAAErB,MAAM,CAACqB;IAAhB,CADJ,GAEIH,OAAO,GACPxB,UAAU,CAAC4B,YADJ,GAEP,IARC,EASLlB,KATK;EAHT,GAgBI;EACA;EACA;EACAc,OAAO,IAAIlB,MAAM,CAACqB,KAAlB,GAA0BxB,QAAQ,CAAC;IAAE0B,OAAO,EAAElB;EAAX,CAAD,CAAlC,GAA6D,IAnBjE,CADF;AAwBD;AAED,MAAMc,MAAM,GAAGzB,UAAU,CAAC8B,MAAX,CAAkB;EAC/BJ,KAAK,EAAE;IACLK,IAAI,EAAE,CADD;IAELC,QAAQ,EAAE;EAFL;AADwB,CAAlB,CAAf"}
1
+ {"version":3,"names":["React","StyleSheet","View","SceneView","children","navigationState","lazy","layout","index","lazyPreloadDistance","addEnterListener","style","isLoading","setIsLoading","useState","Math","abs","useEffect","handleEnter","value","prevState","unsubscribe","timer","setTimeout","clearTimeout","focused","styles","route","width","absoluteFill","loading","create","flex","overflow"],"sourceRoot":"../../src","sources":["SceneView.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAAoBC,UAAU,EAAEC,IAAI,QAAmB,cAAc;AAmBrE,eAAe,SAASC,SAAS,OASpB;EAAA,IATsC;IACjDC,QAAQ;IACRC,eAAe;IACfC,IAAI;IACJC,MAAM;IACNC,KAAK;IACLC,mBAAmB;IACnBC,gBAAgB;IAChBC;EACQ,CAAC;EACT,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGb,KAAK,CAACc,QAAQ,CAC9CC,IAAI,CAACC,GAAG,CAACX,eAAe,CAACG,KAAK,GAAGA,KAAK,CAAC,GAAGC,mBAAmB,CAC9D;EAED,IACEG,SAAS,IACTG,IAAI,CAACC,GAAG,CAACX,eAAe,CAACG,KAAK,GAAGA,KAAK,CAAC,IAAIC,mBAAmB,EAC9D;IACA;IACAI,YAAY,CAAC,KAAK,CAAC;EACrB;EAEAb,KAAK,CAACiB,SAAS,CAAC,MAAM;IACpB,MA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EAC/BJ,KAAK,EAAE;IACLK,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC"}
@@ -4,7 +4,6 @@ import useLatestCallback from 'use-latest-callback';
4
4
  import TabBarIndicator from './TabBarIndicator';
5
5
  import TabBarItem from './TabBarItem';
6
6
  import useAnimatedValue from './useAnimatedValue';
7
-
8
7
  const Separator = _ref => {
9
8
  let {
10
9
  width
@@ -15,43 +14,32 @@ const Separator = _ref => {
15
14
  }
16
15
  });
17
16
  };
18
-
19
17
  const getFlattenedTabWidth = style => {
20
18
  const tabStyle = StyleSheet.flatten(style);
21
19
  return tabStyle === null || tabStyle === void 0 ? void 0 : tabStyle.width;
22
20
  };
23
-
24
21
  const getComputedTabWidth = (index, layout, routes, scrollEnabled, tabWidths, flattenedWidth) => {
25
22
  if (flattenedWidth === 'auto') {
26
23
  return tabWidths[routes[index].key] || 0;
27
24
  }
28
-
29
25
  switch (typeof flattenedWidth) {
30
26
  case 'number':
31
27
  return flattenedWidth;
32
-
33
28
  case 'string':
34
29
  if (flattenedWidth.endsWith('%')) {
35
30
  const width = parseFloat(flattenedWidth);
36
-
37
31
  if (Number.isFinite(width)) {
38
32
  return layout.width * (width / 100);
39
33
  }
40
34
  }
41
-
42
35
  }
43
-
44
36
  if (scrollEnabled) {
45
37
  return layout.width / 5 * 2;
46
38
  }
47
-
48
39
  return layout.width / routes.length;
49
40
  };
50
-
51
41
  const getMaxScrollDistance = (tabBarWidth, layoutWidth) => tabBarWidth - layoutWidth;
52
-
53
42
  const getTranslateX = (scrollAmount, maxScrollDistance) => Animated.multiply(Platform.OS === 'android' && I18nManager.isRTL ? Animated.add(maxScrollDistance, Animated.multiply(scrollAmount, -1)) : scrollAmount, I18nManager.isRTL ? 1 : -1);
54
-
55
43
  const getTabBarWidth = _ref2 => {
56
44
  let {
57
45
  navigationState,
@@ -64,9 +52,8 @@ const getTabBarWidth = _ref2 => {
64
52
  const {
65
53
  routes
66
54
  } = navigationState;
67
- return routes.reduce((acc, _, i) => acc + (i > 0 ? gap !== null && gap !== void 0 ? gap : 0 : 0) + getComputedTabWidth(i, layout, routes, scrollEnabled, tabWidths, flattenedTabWidth), 0);
55
+ return routes.reduce((acc, _, i) => acc + (i > 0 ? gap ?? 0 : 0) + getComputedTabWidth(i, layout, routes, scrollEnabled, tabWidths, flattenedTabWidth), 0);
68
56
  };
69
-
70
57
  const normalizeScrollValue = _ref3 => {
71
58
  let {
72
59
  layout,
@@ -87,16 +74,13 @@ const normalizeScrollValue = _ref3 => {
87
74
  });
88
75
  const maxDistance = getMaxScrollDistance(tabBarWidth, layout.width);
89
76
  const scrollValue = Math.max(Math.min(value, maxDistance), 0);
90
-
91
77
  if (Platform.OS === 'android' && I18nManager.isRTL) {
92
78
  // On Android, scroll value is not applied in reverse in RTL
93
79
  // so we need to manually adjust it to apply correct value
94
80
  return maxDistance - scrollValue;
95
81
  }
96
-
97
82
  return scrollValue;
98
83
  };
99
-
100
84
  const getScrollAmount = _ref4 => {
101
85
  let {
102
86
  layout,
@@ -109,10 +93,11 @@ const getScrollAmount = _ref4 => {
109
93
  const centerDistance = Array.from({
110
94
  length: navigationState.index + 1
111
95
  }).reduce((total, _, i) => {
112
- const tabWidth = getComputedTabWidth(i, layout, navigationState.routes, scrollEnabled, tabWidths, flattenedTabWidth); // To get the current index centered we adjust scroll amount by width of indexes
113
- // 0 through (i - 1) and add half the width of current index i
96
+ const tabWidth = getComputedTabWidth(i, layout, navigationState.routes, scrollEnabled, tabWidths, flattenedTabWidth);
114
97
 
115
- return total + (navigationState.index === i ? (tabWidth + (gap !== null && gap !== void 0 ? gap : 0)) / 2 : tabWidth + (gap !== null && gap !== void 0 ? gap : 0));
98
+ // To get the current index centered we adjust scroll amount by width of indexes
99
+ // 0 through (i - 1) and add half the width of current index i
100
+ return total + (navigationState.index === i ? (tabWidth + (gap ?? 0)) / 2 : tabWidth + (gap ?? 0));
116
101
  }, 0);
117
102
  const scrollAmount = centerDistance - layout.width / 2;
118
103
  return normalizeScrollValue({
@@ -125,39 +110,34 @@ const getScrollAmount = _ref4 => {
125
110
  flattenedTabWidth
126
111
  });
127
112
  };
128
-
129
113
  const getLabelTextDefault = _ref5 => {
130
114
  let {
131
115
  route
132
116
  } = _ref5;
133
117
  return route.title;
134
118
  };
135
-
136
119
  const getAccessibleDefault = _ref6 => {
137
120
  let {
138
121
  route
139
122
  } = _ref6;
140
123
  return typeof route.accessible !== 'undefined' ? route.accessible : true;
141
124
  };
142
-
143
125
  const getAccessibilityLabelDefault = _ref7 => {
144
126
  let {
145
127
  route
146
128
  } = _ref7;
147
129
  return typeof route.accessibilityLabel === 'string' ? route.accessibilityLabel : typeof route.title === 'string' ? route.title : undefined;
148
130
  };
149
-
150
131
  const renderIndicatorDefault = props => /*#__PURE__*/React.createElement(TabBarIndicator, props);
151
-
152
132
  const getTestIdDefault = _ref8 => {
153
133
  let {
154
134
  route
155
135
  } = _ref8;
156
136
  return route.testID;
157
- }; // How many items measurements should we update per batch.
158
- // Defaults to 10, since that's whats FlatList is using in initialNumToRender.
159
-
137
+ };
160
138
 
139
+ // How many items measurements should we update per batch.
140
+ // Defaults to 10, since that's whats FlatList is using in initialNumToRender.
161
141
  const MEASURE_PER_BATCH = 10;
162
142
  export default function TabBar(_ref9) {
163
143
  let {
@@ -188,7 +168,8 @@ export default function TabBar(_ref9) {
188
168
  renderTabBarItem,
189
169
  style,
190
170
  tabStyle,
191
- testID
171
+ testID,
172
+ android_ripple
192
173
  } = _ref9;
193
174
  const [layout, setLayout] = React.useState({
194
175
  width: 0,
@@ -218,21 +199,17 @@ export default function TabBar(_ref9) {
218
199
  isFirst.current = false;
219
200
  return;
220
201
  }
221
-
222
202
  if (isWidthDynamic && !hasMeasuredTabWidths) {
223
203
  return;
224
204
  }
225
-
226
205
  if (scrollEnabled) {
227
206
  var _flatListRef$current;
228
-
229
207
  (_flatListRef$current = flatListRef.current) === null || _flatListRef$current === void 0 ? void 0 : _flatListRef$current.scrollToOffset({
230
208
  offset: scrollOffset,
231
209
  animated: true
232
210
  });
233
211
  }
234
212
  }, [hasMeasuredTabWidths, isWidthDynamic, scrollEnabled, scrollOffset]);
235
-
236
213
  const handleLayout = e => {
237
214
  const {
238
215
  height,
@@ -243,7 +220,6 @@ export default function TabBar(_ref9) {
243
220
  height
244
221
  });
245
222
  };
246
-
247
223
  const tabBarWidth = getTabBarWidth({
248
224
  layout,
249
225
  navigationState,
@@ -278,17 +254,20 @@ export default function TabBar(_ref9) {
278
254
  pressColor: pressColor,
279
255
  pressOpacity: pressOpacity,
280
256
  onLayout: isWidthDynamic ? e => {
281
- measuredTabWidths.current[route.key] = e.nativeEvent.layout.width; // When we have measured widths for all of the tabs, we should updates the state
257
+ measuredTabWidths.current[route.key] = e.nativeEvent.layout.width;
258
+
259
+ // When we have measured widths for all of the tabs, we should updates the state
282
260
  // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
283
261
  // If we have more than 10 routes divide updating tabWidths into multiple batches. Here we update only first batch of 10 items.
284
-
285
262
  if (routes.length > MEASURE_PER_BATCH && index === MEASURE_PER_BATCH && routes.slice(0, MEASURE_PER_BATCH).every(r => typeof measuredTabWidths.current[r.key] === 'number')) {
286
- setTabWidths({ ...measuredTabWidths.current
263
+ setTabWidths({
264
+ ...measuredTabWidths.current
287
265
  });
288
266
  } else if (routes.every(r => typeof measuredTabWidths.current[r.key] === 'number')) {
289
267
  // When we have measured widths for all of the tabs, we should updates the state
290
268
  // We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
291
- setTabWidths({ ...measuredTabWidths.current
269
+ setTabWidths({
270
+ ...measuredTabWidths.current
292
271
  });
293
272
  }
294
273
  } : undefined,
@@ -301,11 +280,9 @@ export default function TabBar(_ref9) {
301
280
  }
302
281
  };
303
282
  onTabPress === null || onTabPress === void 0 ? void 0 : onTabPress(event);
304
-
305
283
  if (event.defaultPrevented) {
306
284
  return;
307
285
  }
308
-
309
286
  jumpTo(route.key);
310
287
  },
311
288
  onLongPress: () => onTabLongPress === null || onTabLongPress === void 0 ? void 0 : onTabLongPress({
@@ -314,12 +291,13 @@ export default function TabBar(_ref9) {
314
291
  labelStyle: labelStyle,
315
292
  style: tabStyle,
316
293
  // Calculate the deafult width for tab for FlatList to work
317
- defaultTabWidth: !isWidthDynamic ? getComputedTabWidth(index, layout, routes, scrollEnabled, tabWidths, getFlattenedTabWidth(tabStyle)) : undefined
294
+ defaultTabWidth: !isWidthDynamic ? getComputedTabWidth(index, layout, routes, scrollEnabled, tabWidths, getFlattenedTabWidth(tabStyle)) : undefined,
295
+ android_ripple
318
296
  };
319
297
  return /*#__PURE__*/React.createElement(React.Fragment, null, gap > 0 && index > 0 ? /*#__PURE__*/React.createElement(Separator, {
320
298
  width: gap
321
299
  }) : null, renderTabBarItem ? renderTabBarItem(props) : /*#__PURE__*/React.createElement(TabBarItem, props));
322
- }, [activeColor, gap, getAccessibilityLabel, getAccessible, getLabelText, getTestID, inactiveColor, isWidthDynamic, jumpTo, labelStyle, layout, navigationState, onTabLongPress, onTabPress, position, pressColor, pressOpacity, renderBadge, renderIcon, renderLabel, renderTabBarItem, routes, scrollEnabled, tabStyle, tabWidths]);
300
+ }, [activeColor, android_ripple, gap, getAccessibilityLabel, getAccessible, getLabelText, getTestID, inactiveColor, isWidthDynamic, jumpTo, labelStyle, layout, navigationState, onTabLongPress, onTabPress, position, pressColor, pressOpacity, renderBadge, renderIcon, renderLabel, renderTabBarItem, routes, scrollEnabled, tabStyle, tabWidths]);
323
301
  const keyExtractor = React.useCallback(item => item.key, []);
324
302
  const contentContainerStyleMemoized = React.useMemo(() => [styles.tabContent, scrollEnabled ? {
325
303
  width: tabBarWidth > separatorsWidth ? tabBarWidth : tabBarWidthPercent
@@ -337,17 +315,15 @@ export default function TabBar(_ref9) {
337
315
  let {
338
316
  changed
339
317
  } = _ref11;
340
-
341
318
  if (routes.length <= MEASURE_PER_BATCH) {
342
319
  return;
343
- } // Get next vievable item
344
-
345
-
320
+ }
321
+ // Get next vievable item
346
322
  const item = changed[changed.length - 1];
347
323
  const index = (item === null || item === void 0 ? void 0 : item.index) || 0;
348
-
349
324
  if (item.isViewable && (index % 10 === 0 || index === navigationState.index || index === routes.length - 1)) {
350
- setTabWidths({ ...measuredTabWidths.current
325
+ setTabWidths({
326
+ ...measuredTabWidths.current
351
327
  });
352
328
  }
353
329
  });