@react-navigation/bottom-tabs 8.0.0-alpha.3 → 8.0.0-alpha.31

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 (54) hide show
  1. package/lib/module/index.js +1 -1
  2. package/lib/module/index.js.map +1 -1
  3. package/lib/module/navigators/createBottomTabNavigator.js +4 -25
  4. package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
  5. package/lib/module/utils/useBottomTabAnimation.js +1 -1
  6. package/lib/module/utils/useBottomTabAnimation.js.map +1 -1
  7. package/lib/module/utils/useBottomTabBarHeight.js +1 -1
  8. package/lib/module/utils/useBottomTabBarHeight.js.map +1 -1
  9. package/lib/module/views/BottomTabBar.js +14 -11
  10. package/lib/module/views/BottomTabBar.js.map +1 -1
  11. package/lib/module/views/BottomTabItem.js +1 -1
  12. package/lib/module/views/BottomTabItem.js.map +1 -1
  13. package/lib/module/views/{BottomTabViewCommon.js → BottomTabView.js} +1 -1
  14. package/lib/module/views/BottomTabView.js.map +1 -0
  15. package/lib/module/views/BottomTabViewCustom.js +64 -66
  16. package/lib/module/views/BottomTabViewCustom.js.map +1 -1
  17. package/lib/module/views/BottomTabViewNativeImpl.js +299 -100
  18. package/lib/module/views/BottomTabViewNativeImpl.js.map +1 -1
  19. package/lib/module/views/ScreenContent.js.map +1 -1
  20. package/lib/module/views/TabBarIcon.js +5 -14
  21. package/lib/module/views/TabBarIcon.js.map +1 -1
  22. package/lib/typescript/src/index.d.ts +3 -3
  23. package/lib/typescript/src/index.d.ts.map +1 -1
  24. package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +8 -14
  25. package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
  26. package/lib/typescript/src/types.d.ts +56 -108
  27. package/lib/typescript/src/types.d.ts.map +1 -1
  28. package/lib/typescript/src/views/BottomTabBar.d.ts.map +1 -1
  29. package/lib/typescript/src/views/BottomTabItem.d.ts +16 -16
  30. package/lib/typescript/src/views/BottomTabItem.d.ts.map +1 -1
  31. package/lib/typescript/src/views/{BottomTabViewCommon.d.ts → BottomTabView.d.ts} +1 -1
  32. package/lib/typescript/src/views/BottomTabView.d.ts.map +1 -0
  33. package/lib/typescript/src/views/BottomTabViewCustom.d.ts +1 -1
  34. package/lib/typescript/src/views/BottomTabViewCustom.d.ts.map +1 -1
  35. package/lib/typescript/src/views/BottomTabViewNativeImpl.d.ts.map +1 -1
  36. package/lib/typescript/src/views/ScreenContent.d.ts +2 -2
  37. package/lib/typescript/src/views/ScreenContent.d.ts.map +1 -1
  38. package/lib/typescript/src/views/TabBarIcon.d.ts +6 -6
  39. package/lib/typescript/src/views/TabBarIcon.d.ts.map +1 -1
  40. package/package.json +18 -21
  41. package/src/index.tsx +2 -2
  42. package/src/navigators/createBottomTabNavigator.tsx +10 -75
  43. package/src/types.tsx +56 -116
  44. package/src/utils/useBottomTabAnimation.tsx +1 -1
  45. package/src/utils/useBottomTabBarHeight.tsx +1 -1
  46. package/src/views/BottomTabBar.tsx +24 -12
  47. package/src/views/BottomTabItem.tsx +17 -19
  48. package/src/views/BottomTabViewCustom.tsx +119 -117
  49. package/src/views/BottomTabViewNativeImpl.tsx +447 -151
  50. package/src/views/ScreenContent.tsx +1 -2
  51. package/src/views/TabBarIcon.tsx +17 -24
  52. package/lib/module/views/BottomTabViewCommon.js.map +0 -1
  53. package/lib/typescript/src/views/BottomTabViewCommon.d.ts.map +0 -1
  54. /package/src/views/{BottomTabViewCommon.tsx → BottomTabView.tsx} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["Container","Lazy","SafeAreaProviderCompat","StackActions","React","Animated","Platform","StyleSheet","Screen","ScreenContainer","FadeTransition","ShiftTransition","BottomTabAnimationContext","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","useAnimatedHashMap","useTabBarPosition","BottomTabBar","getTabBarHeight","ScreenContent","jsx","_jsx","jsxs","_jsxs","EPSILON","STATE_INACTIVE","STATE_TRANSITIONING_OR_BELOW_TOP","STATE_ON_TOP","NAMED_TRANSITIONS_PRESETS","fade","shift","none","sceneStyleInterpolator","undefined","transitionSpec","animation","config","duration","useNativeDriver","OS","hasAnimation","options","Boolean","renderTabBarDefault","props","BottomTabViewCustom","tabBar","state","navigation","descriptors","detachInactiveScreens","routes","focusedRouteKey","index","key","previousRouteKeyRef","useRef","tabAnims","useEffect","previousRouteKey","current","popToTopAction","popToTopOnBlur","prevRoute","find","route","type","popToTop","target","animateToIndex","emit","parallel","map","spec","toValue","filter","start","finished","dispatch","tabBarHeight","setTabBarHeight","useState","dimensions","initialMetrics","frame","insets","style","tabBarStyle","tabBarElement","Provider","value","children","hasTwoStates","some","tabBarPosition","flexDirection","enabled","styles","screens","descriptor","render","lazy","sceneStyle","customSceneStyle","isFocused","isPreloaded","preloadedRouteKeys","includes","animationEnabled","content","AnimatedScreenContent","progress","visible","inert","absoluteFillObject","visibility","activityState","interpolate","inputRange","outputRange","extrapolate","absoluteFill","zIndex","pointerEvents","shouldFreeze","interpolationProps","useMemo","View","scene","create","flex","overflow"],"sourceRoot":"../../../src","sources":["views/BottomTabViewCustom.tsx"],"mappings":";;AAAA,SACEA,SAAS,EACTC,IAAI,EACJC,sBAAsB,QACjB,qCAAqC;AAC5C,SAGEC,YAAY,QAEP,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,QAAQ,EAERC,UAAU,QAEL,cAAc;AACrB,SAASC,MAAM,EAAEC,eAAe,QAAQ,sBAAsB;AAE9D,SACEC,cAAc,EACdC,eAAe,QACV,2CAAwC;AAS/C,SAASC,yBAAyB,QAAQ,uCAAoC;AAC9E,SAASC,iCAAiC,QAAQ,+CAA4C;AAC9F,SAASC,yBAAyB,QAAQ,uCAAoC;AAC9E,SAASC,kBAAkB,QAAQ,gCAA6B;AAChE,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,SAASC,YAAY,EAAEC,eAAe,QAAQ,mBAAgB;AAC9D,SAASC,aA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0H,OAAO,CAAC,MAAM;IAC7C,OAAO;MACLlE,OAAO,EAAE;QAAEmD;MAAS;IACtB,CAAC;EACH,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,MAAM;IAAET;EAAW,CAAC,GAAGtE,sBAAsB,GAAG6F,kBAAkB,CAAC,IAAI,CAAC,CAAC;EAEzE,oBACExG,IAAA,CAAChB,QAAQ,CAAC0H,IAAI;IACZzC,KAAK,EAAE,CAACW,MAAM,CAAC+B,KAAK,EAAE1C,KAAK,EAAEsB,gBAAgB,IAAIN,UAAU,CAAE;IAAAX,QAAA,eAE7DtE,IAAA,CAACT,yBAAyB,CAAC6E,QAAQ;MAACC,KAAK,EAAEmC,kBAAmB;MAAAlC,QAAA,EAC3DA;IAAQ,CACyB;EAAC,CACxB,CAAC;AAEpB;AAEA,MAAMM,MAAM,GAAG1F,UAAU,CAAC0H,MAAM,CAAC;EAC/B/B,OAAO,EAAE;IACPgC,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDH,KAAK,EAAE;IACLE,IAAI,EAAE,CAAC;IACPP,aAAa,EAAE;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ActivityView","Container","SafeAreaProviderCompat","StackActions","React","Animated","Platform","StyleSheet","FadeTransition","ShiftTransition","BottomTabAnimationContext","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","useAnimatedHashMap","useTabBarPosition","BottomTabBar","getTabBarHeight","ScreenContent","jsx","_jsx","jsxs","_jsxs","NAMED_TRANSITIONS_PRESETS","fade","shift","none","sceneStyleInterpolator","undefined","transitionSpec","animation","config","duration","useNativeDriver","OS","hasAnimation","options","Boolean","renderTabBarDefault","props","BottomTabViewCustom","tabBar","state","navigation","descriptors","routes","focusedRouteKey","index","key","loaded","setLoaded","useState","includes","lastUpdate","setLastUpdate","current","previous","tabAnims","isAnimating","setIsAnimating","previousRouteKeyRef","useRef","useEffect","previousRouteKey","popToTopAction","popToTopOnBlur","prevRoute","find","route","type","popToTop","target","timer","animateToIndex","emit","animations","map","spec","toValue","filter","anim","length","parallel","start","finished","dispatch","setTimeout","clearTimeout","tabBarHeight","setTabBarHeight","dimensions","initialMetrics","frame","insets","style","tabBarStyle","tabBarElement","Provider","value","children","tabBarPosition","flexDirection","styles","screens","descriptor","render","lazy","inactiveBehavior","sceneStyle","customSceneStyle","isFocused","isPreloaded","preloadedRouteKeys","animationEnabled","content","AnimatedScreenContent","progress","absoluteFill","isAnimatingRoute","isActive","mode","visible","zIndex","interpolationProps","useMemo","View","scene","create","flex","overflow","pointerEvents"],"sourceRoot":"../../../src","sources":["views/BottomTabViewCustom.tsx"],"mappings":";;AAAA,SACEA,YAAY,EACZC,SAAS,EACTC,sBAAsB,QACjB,qCAAqC;AAC5C,SAGEC,YAAY,QAEP,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,QAAQ,EAERC,UAAU,QAEL,cAAc;AAErB,SACEC,cAAc,EACdC,eAAe,QACV,2CAAwC;AAS/C,SAASC,yBAAyB,QAAQ,uCAAoC;AAC9E,SAASC,iCAAiC,QAAQ,+CAA4C;AAC9F,SAASC,yBAAyB,QAAQ,uCAAoC;AAC9E,SAASC,kBAAkB,QAAQ,gCAA6B;AAChE,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,SAASC,YAAY,EAAEC,eAAe,QAAQ,mBAAgB;AAC9D,SAASC,aAAa,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQhD,MAAMC,yBAAyB,GAAG;EAChCC,IAAI,EAAEf,cAAc;EACpBgB,KAAK,EAAEf,eAAe;EACtBgB,IAAI,EAAE;IACJC,sBAAsB,EAAEC,SAAS;IACjCC,cAAc,EAAE;MACdC,SAAS,EAAE,QAAQ;MACnBC,MAAM,EAAE;QAAEC,QAAQ,EAAE;MAAE;IACxB;EACF;AACF,CAAU;AAEV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C,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,MAAM;IAAER;EAAW,CAAC,GAAGjF,sBAAsB,GAAGgG,kBAAkB,CAAC,IAAI,CAAC,CAAC;EAEzE,oBACEvG,IAAA,CAACd,QAAQ,CAACuH,IAAI;IACZ/B,KAAK,EAAE,CAACQ,MAAM,CAACwB,KAAK,EAAEhC,KAAK,EAAEmB,gBAAgB,IAAIL,UAAU,CAAE;IAAAT,QAAA,eAE7D/E,IAAA,CAACT,yBAAyB,CAACsF,QAAQ;MAACC,KAAK,EAAEyB,kBAAmB;MAAAxB,QAAA,EAC3DA;IAAQ,CACyB;EAAC,CACxB,CAAC;AAEpB;AAEA,MAAMG,MAAM,GAAG9F,UAAU,CAACuH,MAAM,CAAC;EAC/BxB,OAAO,EAAE;IACPyB,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDH,KAAK,EAAE;IACLE,IAAI,EAAE,CAAC;IACPE,aAAa,EAAE;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  import { getLabel } from '@react-navigation/elements';
4
- import { Color, Lazy, SafeAreaProviderCompat } from '@react-navigation/elements/internal';
4
+ import { ActivityView, Color, SafeAreaProviderCompat } from '@react-navigation/elements/internal';
5
5
  import { CommonActions, MaterialSymbol, NavigationMetaContext, StackActions, useTheme } from '@react-navigation/native';
6
6
  import * as React from 'react';
7
- import { Animated, Platform, PlatformColor } from 'react-native';
7
+ import { Animated, Platform, PlatformColor, StyleSheet } from 'react-native';
8
8
  import { Tabs } from 'react-native-screens';
9
9
  import { BottomTabAnimationContext } from "../utils/BottomTabAnimationContext.js";
10
10
  import { BottomTabBarHeightContext } from "../utils/BottomTabBarHeightContext.js";
@@ -18,6 +18,26 @@ const ICON_SIZE = Platform.select({
18
18
  const meta = {
19
19
  type: 'native-tabs'
20
20
  };
21
+ function reducer(state, action) {
22
+ switch (action.type) {
23
+ case 'TRACK_TRANSITION':
24
+ return {
25
+ ...state,
26
+ lastTransition: action.lastTransition,
27
+ confirmed: action.confirmed
28
+ };
29
+ case 'CLEAR_TRANSITION':
30
+ return state.lastTransition?.to === action.to ? {
31
+ ...state,
32
+ lastTransition: null
33
+ } : state;
34
+ case 'CONFIRM_STATE':
35
+ return state.confirmed.routeKey === action.confirmed.routeKey && state.confirmed.provenance === action.confirmed.provenance ? state : {
36
+ ...state,
37
+ confirmed: action.confirmed
38
+ };
39
+ }
40
+ }
21
41
  export function BottomTabViewNative({
22
42
  state,
23
43
  navigation,
@@ -30,6 +50,17 @@ export function BottomTabViewNative({
30
50
  fonts
31
51
  } = useTheme();
32
52
  const focusedRouteKey = state.routes[state.index].key;
53
+ const [loaded, setLoaded] = React.useState([focusedRouteKey]);
54
+ if (!loaded.includes(focusedRouteKey)) {
55
+ setLoaded([...loaded, focusedRouteKey]);
56
+ }
57
+ const [nativeState, dispatch] = React.useReducer(reducer, {
58
+ lastTransition: null,
59
+ confirmed: {
60
+ routeKey: focusedRouteKey,
61
+ provenance: 0
62
+ }
63
+ });
33
64
  const previousRouteKeyRef = React.useRef(focusedRouteKey);
34
65
  React.useEffect(() => {
35
66
  const previousRouteKey = previousRouteKeyRef.current;
@@ -44,7 +75,116 @@ export function BottomTabViewNative({
44
75
  }
45
76
  }
46
77
  previousRouteKeyRef.current = focusedRouteKey;
78
+
79
+ // We dispatch `popToTop` for unfocused tabs when `popToTopOnBlur` is true
80
+ // So we delay clearing `lastTransition` to keep the screen active for longer
81
+ // This gives time for the action to be handled before the screen is paused,
82
+ const timer = setTimeout(() => {
83
+ dispatch({
84
+ type: 'CLEAR_TRANSITION',
85
+ to: focusedRouteKey
86
+ });
87
+ }, 32);
88
+ return () => clearTimeout(timer);
47
89
  }, [descriptors, focusedRouteKey, navigation, state.index, state.routes]);
90
+ const navigate = (route, confirmed) => {
91
+ dispatch({
92
+ type: 'TRACK_TRANSITION',
93
+ confirmed,
94
+ lastTransition: {
95
+ from: previousRouteKeyRef.current,
96
+ to: route.key
97
+ }
98
+ });
99
+ navigation.dispatch({
100
+ ...CommonActions.navigate(route.name, route.params),
101
+ target: state.key
102
+ });
103
+ };
104
+
105
+ // Native tabs are the source of truth for the selected tab.
106
+ // JS sends a requested tab with the native provenance it was based on.
107
+ // Native replies with the selected tab and its new provenance.
108
+ const onTabSelected = event => {
109
+ const {
110
+ selectedScreenKey,
111
+ provenance,
112
+ actionOrigin
113
+ } = event.nativeEvent;
114
+ const confirmed = {
115
+ routeKey: selectedScreenKey,
116
+ provenance
117
+ };
118
+ const route = state.routes.find(route => route.key === selectedScreenKey);
119
+ if (!route) {
120
+ console.error(`Received 'tabSelected' for route that doesn't exist: ${selectedScreenKey}`);
121
+ return;
122
+ }
123
+ if (actionOrigin === 'user') {
124
+ const event = navigation.emit({
125
+ type: 'tabPress',
126
+ target: route.key,
127
+ canPreventDefault: true
128
+ });
129
+ if (event.defaultPrevented) {
130
+ throw new Error("Preventing default for 'tabPress' is not supported with native tab bar. Use the 'tabBarSelectionEnabled: false' option instead.");
131
+ }
132
+ }
133
+ if (actionOrigin === 'programmatic-js' || focusedRouteKey === route.key) {
134
+ dispatch({
135
+ type: 'CONFIRM_STATE',
136
+ confirmed
137
+ });
138
+ return;
139
+ }
140
+ navigate(route, confirmed);
141
+ };
142
+
143
+ // If native rejects a JS request, keep native as the source of truth
144
+ // and move JS back to the tab that native says is selected.
145
+ const onTabSelectionRejected = event => {
146
+ const {
147
+ selectedScreenKey,
148
+ provenance
149
+ } = event.nativeEvent;
150
+ const confirmed = {
151
+ routeKey: selectedScreenKey,
152
+ provenance
153
+ };
154
+ const route = state.routes.find(route => route.key === selectedScreenKey);
155
+ if (!route) {
156
+ console.error(`Received 'tabSelectionRejected' for route that doesn't exist: ${selectedScreenKey}`);
157
+ return;
158
+ }
159
+ if (focusedRouteKey === route.key) {
160
+ dispatch({
161
+ type: 'CONFIRM_STATE',
162
+ confirmed
163
+ });
164
+ return;
165
+ }
166
+ navigate(route, confirmed);
167
+ };
168
+ const onTabSelectionPrevented = event => {
169
+ const {
170
+ selectedScreenKey,
171
+ provenance,
172
+ preventedScreenKey
173
+ } = event.nativeEvent;
174
+ const confirmed = {
175
+ routeKey: selectedScreenKey,
176
+ provenance
177
+ };
178
+ dispatch({
179
+ type: 'CONFIRM_STATE',
180
+ confirmed
181
+ });
182
+ navigation.emit({
183
+ type: 'tabPress',
184
+ target: preventedScreenKey,
185
+ canPreventDefault: true
186
+ });
187
+ };
48
188
  const currentOptions = descriptors[state.routes[state.index].key]?.options;
49
189
  const {
50
190
  fontFamily = Platform.select({
@@ -56,14 +196,48 @@ export function BottomTabViewNative({
56
196
  default: fonts.regular.fontWeight
57
197
  }),
58
198
  fontSize,
59
- fontStyle
199
+ fontStyle,
200
+ color: fontColor
60
201
  } = currentOptions.tabBarLabelStyle || {};
61
- const activeTintColor = currentOptions.tabBarActiveTintColor ?? colors.primary;
62
- const inactiveTintColor = currentOptions.tabBarInactiveTintColor ?? Platform.select({
202
+ const backgroundColor = currentOptions.tabBarStyle?.backgroundColor ?? colors.background;
203
+ const shouldHideTabBar = currentOptions.tabBarStyle?.display === 'none';
204
+ let activeIndicatorColor = currentOptions?.tabBarActiveIndicatorColor;
205
+ let activeTintColor = currentOptions.tabBarActiveTintColor;
206
+ let inactiveTintColor = currentOptions.tabBarInactiveTintColor;
207
+
208
+ // Derive colors based on Material Design guidelines
209
+ // https://m3.material.io/components/navigation-bar/specs
210
+ if (Platform.OS === 'android') {
211
+ switch (getAndroidColorName(backgroundColor)) {
212
+ case 'system_surface_container_light':
213
+ case 'system_surface_container_high_light':
214
+ case 'system_surface_container_highest_light':
215
+ case 'system_surface_container_low_light':
216
+ case 'system_surface_container_lowest_light':
217
+ inactiveTintColor = inactiveTintColor ?? PlatformColor('@android:color/system_on_surface_variant_light');
218
+ activeTintColor = activeTintColor ?? PlatformColor('@android:color/system_on_secondary_container_light');
219
+ activeIndicatorColor = activeIndicatorColor ?? PlatformColor('@android:color/system_secondary_container_light');
220
+ break;
221
+ case 'system_surface_container_dark':
222
+ case 'system_surface_container_high_dark':
223
+ case 'system_surface_container_highest_dark':
224
+ case 'system_surface_container_low_dark':
225
+ case 'system_surface_container_lowest_dark':
226
+ inactiveTintColor = inactiveTintColor ?? PlatformColor('@android:color/system_on_surface_variant_dark');
227
+ activeTintColor = activeTintColor ?? PlatformColor('@android:color/system_on_secondary_container_dark');
228
+ activeIndicatorColor = activeIndicatorColor ?? PlatformColor('@android:color/system_secondary_container_dark');
229
+ break;
230
+ }
231
+ }
232
+ inactiveTintColor = inactiveTintColor ?? Platform.select({
63
233
  ios: PlatformColor('label'),
64
234
  default: colors.text
65
235
  });
66
- const activeIndicatorColor = currentOptions?.tabBarActiveIndicatorColor ?? Color(activeTintColor)?.alpha(0.1).string();
236
+ activeTintColor = activeTintColor ?? colors.primary;
237
+ activeIndicatorColor = activeIndicatorColor ?? Platform.select({
238
+ android: Color(activeTintColor)?.alpha(0.075).string(),
239
+ default: undefined
240
+ });
67
241
  const onTransitionStart = ({
68
242
  route
69
243
  }) => {
@@ -95,47 +269,23 @@ export function BottomTabViewNative({
95
269
  flexDirection: tabBarPosition === 'left' || tabBarPosition === 'right' ? 'row' : 'column'
96
270
  },
97
271
  children: [tabBarPosition === 'top' || tabBarPosition === 'left' ? tabBarElement : null, /*#__PURE__*/_jsx(Tabs.Host, {
98
- tabBarHidden: hasCustomTabBar,
99
- bottomAccessory: bottomAccessory ? environment => bottomAccessory({
100
- placement: environment
101
- }) : undefined,
102
- tabBarItemLabelVisibilityMode: currentOptions?.tabBarLabelVisibilityMode,
103
- tabBarControllerMode: tabBarControllerMode,
104
- tabBarMinimizeBehavior: tabBarMinimizeBehavior,
105
- tabBarTintColor: activeTintColor,
106
- tabBarItemIconColor: inactiveTintColor,
107
- tabBarItemIconColorActive: activeTintColor,
108
- tabBarItemTitleFontColor: inactiveTintColor,
109
- tabBarItemTitleFontColorActive: activeTintColor,
110
- tabBarItemTitleFontFamily: fontFamily,
111
- tabBarItemTitleFontWeight: fontWeight,
112
- tabBarItemTitleFontSize: fontSize,
113
- tabBarItemTitleFontSizeActive: fontSize,
114
- tabBarItemTitleFontStyle: fontStyle,
115
- tabBarBackgroundColor: currentOptions.tabBarStyle?.backgroundColor ?? colors.card,
116
- tabBarItemActiveIndicatorColor: activeIndicatorColor,
117
- tabBarItemActiveIndicatorEnabled: currentOptions?.tabBarActiveIndicatorEnabled,
118
- tabBarItemRippleColor: currentOptions?.tabBarRippleColor,
119
- experimentalControlNavigationStateInJS: false,
120
- onNativeFocusChange: e => {
121
- const route = state.routes.find(route => route.key === e.nativeEvent.tabKey);
122
- if (route) {
123
- const event = navigation.emit({
124
- type: 'tabPress',
125
- target: route.key,
126
- canPreventDefault: true
127
- });
128
- if (event.defaultPrevented) {
129
- throw new Error("Preventing default for 'tabPress' is not supported with native tab bar.");
130
- }
131
- const isFocused = state.index === state.routes.findIndex(r => r.key === route.key);
132
- if (!isFocused) {
133
- navigation.dispatch({
134
- ...CommonActions.navigate(route.name, route.params),
135
- target: state.key
136
- });
137
- }
138
- }
272
+ navStateRequest: {
273
+ selectedScreenKey: focusedRouteKey,
274
+ baseProvenance: nativeState.confirmed.provenance
275
+ },
276
+ rejectStaleNavStateUpdates: true,
277
+ onTabSelected: onTabSelected,
278
+ onTabSelectionRejected: onTabSelectionRejected,
279
+ onTabSelectionPrevented: onTabSelectionPrevented,
280
+ tabBarHidden: hasCustomTabBar || shouldHideTabBar,
281
+ colorScheme: dark ? 'dark' : 'light',
282
+ ios: {
283
+ bottomAccessory: bottomAccessory ? environment => bottomAccessory({
284
+ placement: environment
285
+ }) : undefined,
286
+ tabBarControllerMode,
287
+ tabBarMinimizeBehavior,
288
+ tabBarTintColor: activeTintColor
139
289
  },
140
290
  children: state.routes.map((route, index) => {
141
291
  const {
@@ -148,7 +298,9 @@ export function BottomTabViewNative({
148
298
  const {
149
299
  title,
150
300
  lazy = true,
301
+ inactiveBehavior = 'pause',
151
302
  tabBarLabel,
303
+ tabBarSelectionEnabled,
152
304
  tabBarBadgeStyle,
153
305
  tabBarIcon,
154
306
  tabBarBadge,
@@ -158,7 +310,7 @@ export function BottomTabViewNative({
158
310
  tabBarAccessibilityLabel,
159
311
  tabBarButtonTestID,
160
312
  sceneStyle,
161
- scrollEdgeEffects
313
+ overrideScrollViewContentInsetAdjustmentBehavior
162
314
  } = options;
163
315
  const {
164
316
  backgroundColor: tabBarBackgroundColor,
@@ -171,14 +323,25 @@ export function BottomTabViewNative({
171
323
  label: tabBarLabel,
172
324
  title
173
325
  }, route.name);
326
+ const badgeBackgroundColor = tabBarBadgeStyle?.backgroundColor ?? colors.notification;
327
+ const badgeTextColor = tabBarBadgeStyle?.color ?? Color.foreground(badgeBackgroundColor);
174
328
  const tabItemAppearance = {
175
329
  tabBarItemTitleFontFamily: fontFamily,
176
330
  tabBarItemTitleFontSize: fontSize,
177
331
  tabBarItemTitleFontWeight: fontWeight,
178
- tabBarItemTitleFontStyle: fontStyle
332
+ tabBarItemTitleFontStyle: fontStyle,
333
+ tabBarItemTitleFontColor: inactiveTintColor ?? fontColor,
334
+ tabBarItemIconColor: inactiveTintColor,
335
+ tabBarItemBadgeBackgroundColor: badgeBackgroundColor
336
+ };
337
+ const normalTabItemAppearance = {
338
+ tabBarItemTitleFontColor: inactiveTintColor ?? fontColor,
339
+ tabBarItemIconColor: inactiveTintColor
340
+ };
341
+ const selectedTabItemAppearance = {
342
+ tabBarItemTitleFontColor: activeTintColor,
343
+ tabBarItemIconColor: activeTintColor
179
344
  };
180
- const badgeBackgroundColor = tabBarBadgeStyle?.backgroundColor ?? colors.notification;
181
- const badgeTextColor = tabBarBadgeStyle?.color ?? (Color(badgeBackgroundColor)?.isLight() ? 'black' : 'white');
182
345
  const getIcon = selected => {
183
346
  if (typeof tabBarIcon === 'function') {
184
347
  const result = tabBarIcon({
@@ -198,8 +361,15 @@ export function BottomTabViewNative({
198
361
  }
199
362
  return undefined;
200
363
  };
201
- const icon = getIcon(false);
202
- const selectedIcon = getIcon(true);
364
+
365
+ // An error is thrown for React Elements in `getIcon`
366
+ // So we only call it when we actually render a native tab bar
367
+ const icon = hasCustomTabBar ? undefined : getIcon(false);
368
+ const selectedIcon = hasCustomTabBar ? undefined : getIcon(true);
369
+
370
+ // For preloaded screens and if lazy is false,
371
+ // Keep them active so that the effects can run
372
+ const isActive = inactiveBehavior === 'none' || isPreloaded || nativeState.lastTransition?.from === route.key || nativeState.lastTransition?.to === route.key || lazy === false && !loaded.includes(route.key);
203
373
  return /*#__PURE__*/_jsx(Tabs.Screen, {
204
374
  onWillAppear: () => onTransitionStart({
205
375
  route
@@ -207,51 +377,80 @@ export function BottomTabViewNative({
207
377
  onDidAppear: () => onTransitionEnd({
208
378
  route
209
379
  }),
210
- tabKey: route.key,
211
- icon: icon,
212
- selectedIcon: selectedIcon?.ios ?? selectedIcon?.shared,
213
- tabBarItemBadgeBackgroundColor: badgeBackgroundColor,
214
- tabBarItemBadgeTextColor: badgeTextColor,
380
+ screenKey: route.key,
215
381
  tabBarItemAccessibilityLabel: tabBarAccessibilityLabel,
216
382
  tabBarItemTestID: tabBarButtonTestID,
383
+ preventNativeSelection: tabBarSelectionEnabled === false,
217
384
  badgeValue: tabBarBadge?.toString(),
218
- systemItem: tabBarSystemItem,
219
- isFocused: isFocused,
220
385
  title: tabTitle,
221
- scrollEdgeEffects: {
222
- top: scrollEdgeEffects?.top === 'auto' ? 'automatic' : scrollEdgeEffects?.top,
223
- bottom: scrollEdgeEffects?.bottom === 'auto' ? 'automatic' : scrollEdgeEffects?.bottom,
224
- left: scrollEdgeEffects?.left === 'auto' ? 'automatic' : scrollEdgeEffects?.left,
225
- right: scrollEdgeEffects?.right === 'auto' ? 'automatic' : scrollEdgeEffects?.right
226
- }
227
- // FIXME: if this is not provided, ScrollView on lazy tabs glitches on iOS 18
228
- // For now we provide an empty object before adding proper support
229
- ,
230
- scrollEdgeAppearance: {},
231
- standardAppearance: {
232
- tabBarBackgroundColor,
233
- tabBarShadowColor,
234
- tabBarBlurEffect,
235
- stacked: {
236
- normal: tabItemAppearance
237
- },
238
- inline: {
239
- normal: tabItemAppearance
240
- },
241
- compactInline: {
242
- normal: tabItemAppearance
243
- }
244
- },
245
386
  specialEffects: {
246
387
  repeatedTabSelection: {
247
388
  popToRoot: true,
248
389
  scrollToTop: true
249
390
  }
250
391
  },
251
- experimental_userInterfaceStyle: dark ? 'dark' : 'light',
252
- children: /*#__PURE__*/_jsx(Lazy, {
253
- enabled: lazy,
254
- visible: isFocused || isPreloaded,
392
+ android: {
393
+ icon: icon?.android ?? icon?.shared,
394
+ selectedIcon: selectedIcon?.android ?? selectedIcon?.shared,
395
+ standardAppearance: {
396
+ tabBarBackgroundColor: tabBarBackgroundColor ?? backgroundColor,
397
+ tabBarItemRippleColor: currentOptions?.tabBarRippleColor,
398
+ tabBarItemLabelVisibilityMode: currentOptions?.tabBarLabelVisibilityMode,
399
+ normal: normalTabItemAppearance,
400
+ selected: selectedTabItemAppearance,
401
+ tabBarItemActiveIndicatorColor: activeIndicatorColor,
402
+ tabBarItemActiveIndicatorEnabled: currentOptions?.tabBarActiveIndicatorEnabled,
403
+ tabBarItemTitleFontFamily: fontFamily,
404
+ tabBarItemTitleFontWeight: fontWeight,
405
+ tabBarItemTitleSmallLabelFontSize: fontSize,
406
+ tabBarItemTitleLargeLabelFontSize: fontSize,
407
+ tabBarItemTitleFontStyle: fontStyle,
408
+ tabBarItemBadgeBackgroundColor: badgeBackgroundColor,
409
+ tabBarItemBadgeTextColor: badgeTextColor
410
+ }
411
+ },
412
+ ios: {
413
+ icon: icon?.ios ?? icon?.shared,
414
+ selectedIcon: selectedIcon?.ios ?? selectedIcon?.shared,
415
+ systemItem: tabBarSystemItem,
416
+ scrollEdgeAppearance: {
417
+ tabBarBackgroundColor,
418
+ tabBarShadowColor,
419
+ tabBarBlurEffect,
420
+ stacked: {
421
+ normal: tabItemAppearance
422
+ },
423
+ inline: {
424
+ normal: tabItemAppearance
425
+ },
426
+ compactInline: {
427
+ normal: tabItemAppearance
428
+ }
429
+ },
430
+ standardAppearance: {
431
+ tabBarBackgroundColor,
432
+ tabBarShadowColor,
433
+ tabBarBlurEffect,
434
+ stacked: {
435
+ normal: tabItemAppearance
436
+ },
437
+ inline: {
438
+ normal: tabItemAppearance
439
+ },
440
+ compactInline: {
441
+ normal: tabItemAppearance
442
+ }
443
+ },
444
+ overrideScrollViewContentInsetAdjustmentBehavior
445
+ },
446
+ children: lazy && !loaded.includes(route.key) && !isFocused && !isPreloaded ? null : /*#__PURE__*/_jsx(ActivityView, {
447
+ mode: isFocused ? 'normal' : isActive ? 'inert' : 'paused',
448
+ visible:
449
+ // We don't need to hide the content since it's handled natively
450
+ // Hiding may also cause flash due to lag after native tab switch
451
+ // So we leave it always visible
452
+ true,
453
+ style: StyleSheet.absoluteFill,
255
454
  children: /*#__PURE__*/_jsx(ScreenContent, {
256
455
  isFocused: isFocused,
257
456
  route: route,
@@ -269,7 +468,7 @@ export function BottomTabViewNative({
269
468
  })
270
469
  })
271
470
  })
272
- })
471
+ }, route.key)
273
472
  }, route.key);
274
473
  })
275
474
  }), tabBarPosition === 'bottom' || tabBarPosition === 'right' ? tabBarElement : null]
@@ -314,7 +513,10 @@ function getPlatformIcon(icon) {
314
513
  android: {
315
514
  type: 'imageSource',
316
515
  imageSource: MaterialSymbol.getImageSource({
317
- name: icon.name
516
+ name: icon.name,
517
+ variant: icon.variant,
518
+ weight: icon.weight,
519
+ size: ICON_SIZE
318
520
  })
319
521
  },
320
522
  shared: undefined
@@ -334,16 +536,6 @@ function getPlatformIcon(icon) {
334
536
  imageSource: icon.source
335
537
  }
336
538
  };
337
- case 'resource':
338
- return {
339
- // TODO: support xcasset once new version of react-native-screens is released
340
- ios: undefined,
341
- android: {
342
- type: 'drawableResource',
343
- name: icon.name
344
- },
345
- shared: undefined
346
- };
347
539
  default:
348
540
  {
349
541
  const _exhaustiveCheck = icon;
@@ -351,4 +543,11 @@ function getPlatformIcon(icon) {
351
543
  }
352
544
  }
353
545
  }
546
+ function getAndroidColorName(color) {
547
+ const value = color;
548
+ if (typeof value === 'object' && value != null && 'resource_paths' in value && Array.isArray(value.resource_paths) && typeof value.resource_paths[0] === 'string') {
549
+ return value.resource_paths[0].replace('@android:color/', '');
550
+ }
551
+ return null;
552
+ }
354
553
  //# sourceMappingURL=BottomTabViewNativeImpl.js.map