@react-navigation/bottom-tabs 8.0.0-alpha.3 → 8.0.0-alpha.30
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.
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createBottomTabNavigator.js +4 -25
- package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/module/utils/useBottomTabAnimation.js +1 -1
- package/lib/module/utils/useBottomTabAnimation.js.map +1 -1
- package/lib/module/utils/useBottomTabBarHeight.js +1 -1
- package/lib/module/utils/useBottomTabBarHeight.js.map +1 -1
- package/lib/module/views/BottomTabBar.js +14 -11
- package/lib/module/views/BottomTabBar.js.map +1 -1
- package/lib/module/views/BottomTabItem.js +1 -1
- package/lib/module/views/BottomTabItem.js.map +1 -1
- package/lib/module/views/{BottomTabViewCommon.js → BottomTabView.js} +1 -1
- package/lib/module/views/BottomTabView.js.map +1 -0
- package/lib/module/views/BottomTabViewCustom.js +64 -66
- package/lib/module/views/BottomTabViewCustom.js.map +1 -1
- package/lib/module/views/BottomTabViewNativeImpl.js +299 -100
- package/lib/module/views/BottomTabViewNativeImpl.js.map +1 -1
- package/lib/module/views/ScreenContent.js.map +1 -1
- package/lib/module/views/TabBarIcon.js +5 -14
- package/lib/module/views/TabBarIcon.js.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +8 -14
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +56 -108
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabBar.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabItem.d.ts +16 -16
- package/lib/typescript/src/views/BottomTabItem.d.ts.map +1 -1
- package/lib/typescript/src/views/{BottomTabViewCommon.d.ts → BottomTabView.d.ts} +1 -1
- package/lib/typescript/src/views/BottomTabView.d.ts.map +1 -0
- package/lib/typescript/src/views/BottomTabViewCustom.d.ts +1 -1
- package/lib/typescript/src/views/BottomTabViewCustom.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabViewNativeImpl.d.ts.map +1 -1
- package/lib/typescript/src/views/ScreenContent.d.ts +2 -2
- package/lib/typescript/src/views/ScreenContent.d.ts.map +1 -1
- package/lib/typescript/src/views/TabBarIcon.d.ts +6 -6
- package/lib/typescript/src/views/TabBarIcon.d.ts.map +1 -1
- package/package.json +18 -21
- package/src/index.tsx +2 -2
- package/src/navigators/createBottomTabNavigator.tsx +10 -75
- package/src/types.tsx +56 -116
- package/src/utils/useBottomTabAnimation.tsx +1 -1
- package/src/utils/useBottomTabBarHeight.tsx +1 -1
- package/src/views/BottomTabBar.tsx +24 -12
- package/src/views/BottomTabItem.tsx +17 -19
- package/src/views/BottomTabViewCustom.tsx +119 -117
- package/src/views/BottomTabViewNativeImpl.tsx +447 -151
- package/src/views/ScreenContent.tsx +1 -2
- package/src/views/TabBarIcon.tsx +17 -24
- package/lib/module/views/BottomTabViewCommon.js.map +0 -1
- package/lib/typescript/src/views/BottomTabViewCommon.d.ts.map +0 -1
- /package/src/views/{BottomTabViewCommon.tsx → BottomTabView.tsx} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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,SAA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6B,kBAAkB,GAAGtH,KAAK,CAACuH,OAAO,CAAC,MAAM;IAC7C,OAAO;MACLrE,OAAO,EAAE;QAAE6D;MAAS;IACtB,CAAC;EACH,CAAC,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 {
|
|
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
|
|
62
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
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
|
-
|
|
202
|
-
|
|
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
|
-
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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
|