@react-navigation/bottom-tabs 7.0.0-alpha.2 → 7.0.0-alpha.21
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/commonjs/TransitionConfigs/SceneStyleInterpolators.js +47 -0
- package/lib/commonjs/TransitionConfigs/SceneStyleInterpolators.js.map +1 -0
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js +17 -0
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -0
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +22 -0
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +1 -0
- package/lib/commonjs/index.js +9 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createBottomTabNavigator.js +11 -6
- package/lib/commonjs/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/BottomTabBarHeightCallbackContext.js +3 -4
- package/lib/commonjs/utils/BottomTabBarHeightCallbackContext.js.map +1 -1
- package/lib/commonjs/utils/BottomTabBarHeightContext.js +3 -4
- package/lib/commonjs/utils/BottomTabBarHeightContext.js.map +1 -1
- package/lib/commonjs/utils/useAnimatedHashMap.js +31 -0
- package/lib/commonjs/utils/useAnimatedHashMap.js.map +1 -0
- package/lib/commonjs/utils/useBottomTabBarHeight.js +2 -2
- package/lib/commonjs/utils/useBottomTabBarHeight.js.map +1 -1
- package/lib/commonjs/utils/useIsKeyboardShown.js +2 -2
- package/lib/commonjs/utils/useIsKeyboardShown.js.map +1 -1
- package/lib/commonjs/views/Badge.js +2 -2
- package/lib/commonjs/views/Badge.js.map +1 -1
- package/lib/commonjs/views/BottomTabBar.js +65 -27
- package/lib/commonjs/views/BottomTabBar.js.map +1 -1
- package/lib/commonjs/views/BottomTabItem.js +32 -54
- package/lib/commonjs/views/BottomTabItem.js.map +1 -1
- package/lib/commonjs/views/BottomTabView.js +120 -18
- package/lib/commonjs/views/BottomTabView.js.map +1 -1
- package/lib/commonjs/views/ScreenFallback.js +10 -14
- package/lib/commonjs/views/ScreenFallback.js.map +1 -1
- package/lib/commonjs/views/TabBarIcon.js +12 -17
- package/lib/commonjs/views/TabBarIcon.js.map +1 -1
- package/lib/module/TransitionConfigs/SceneStyleInterpolators.js +40 -0
- package/lib/module/TransitionConfigs/SceneStyleInterpolators.js.map +1 -0
- package/lib/module/TransitionConfigs/TransitionPresets.js +11 -0
- package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -0
- package/lib/module/TransitionConfigs/TransitionSpecs.js +16 -0
- package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createBottomTabNavigator.js +8 -2
- package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/BottomTabBarHeightCallbackContext.js.map +1 -1
- package/lib/module/utils/BottomTabBarHeightContext.js.map +1 -1
- package/lib/module/utils/useAnimatedHashMap.js +23 -0
- package/lib/module/utils/useAnimatedHashMap.js.map +1 -0
- package/lib/module/utils/useBottomTabBarHeight.js.map +1 -1
- package/lib/module/utils/useIsKeyboardShown.js.map +1 -1
- package/lib/module/views/Badge.js.map +1 -1
- package/lib/module/views/BottomTabBar.js +68 -30
- package/lib/module/views/BottomTabBar.js.map +1 -1
- package/lib/module/views/BottomTabItem.js +34 -56
- package/lib/module/views/BottomTabItem.js.map +1 -1
- package/lib/module/views/BottomTabView.js +119 -17
- package/lib/module/views/BottomTabView.js.map +1 -1
- package/lib/module/views/ScreenFallback.js +8 -12
- package/lib/module/views/ScreenFallback.js.map +1 -1
- package/lib/module/views/TabBarIcon.js +12 -17
- package/lib/module/views/TabBarIcon.js.map +1 -1
- package/lib/typescript/src/TransitionConfigs/SceneStyleInterpolators.d.ts +10 -0
- package/lib/typescript/src/TransitionConfigs/SceneStyleInterpolators.d.ts.map +1 -0
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts +4 -0
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -0
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts +4 -0
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +8 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +15 -9
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +71 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/useAnimatedHashMap.d.ts +4 -0
- package/lib/typescript/src/utils/useAnimatedHashMap.d.ts.map +1 -0
- package/lib/typescript/src/views/Badge.d.ts +3 -2
- package/lib/typescript/src/views/Badge.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabBar.d.ts +5 -4
- package/lib/typescript/src/views/BottomTabBar.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabItem.d.ts +3 -3
- package/lib/typescript/src/views/BottomTabItem.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabView.d.ts +2 -1
- package/lib/typescript/src/views/BottomTabView.d.ts.map +1 -1
- package/lib/typescript/src/views/ScreenFallback.d.ts +5 -5
- package/lib/typescript/src/views/ScreenFallback.d.ts.map +1 -1
- package/lib/typescript/src/views/TabBarIcon.d.ts +2 -2
- package/lib/typescript/src/views/TabBarIcon.d.ts.map +1 -1
- package/package.json +17 -18
- package/src/TransitionConfigs/SceneStyleInterpolators.tsx +44 -0
- package/src/TransitionConfigs/TransitionPresets.tsx +13 -0
- package/src/TransitionConfigs/TransitionSpecs.tsx +19 -0
- package/src/index.tsx +10 -0
- package/src/navigators/createBottomTabNavigator.tsx +40 -12
- package/src/types.tsx +102 -5
- package/src/utils/useAnimatedHashMap.tsx +25 -0
- package/src/utils/useIsKeyboardShown.tsx +1 -1
- package/src/views/Badge.tsx +6 -1
- package/src/views/BottomTabBar.tsx +125 -47
- package/src/views/BottomTabItem.tsx +52 -82
- package/src/views/BottomTabView.tsx +163 -14
- package/src/views/ScreenFallback.tsx +12 -13
- package/src/views/TabBarIcon.tsx +16 -24
|
@@ -1,12 +1,41 @@
|
|
|
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
2
|
import { getHeaderTitle, Header, SafeAreaProviderCompat, Screen } from '@react-navigation/elements';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { Platform, StyleSheet } from 'react-native';
|
|
4
|
+
import { Animated, Platform, StyleSheet } from 'react-native';
|
|
5
5
|
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
|
6
|
+
import { FadeTransition, ShiftTransition } from '../TransitionConfigs/TransitionPresets';
|
|
6
7
|
import { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';
|
|
7
8
|
import { BottomTabBarHeightContext } from '../utils/BottomTabBarHeightContext';
|
|
9
|
+
import { useAnimatedHashMap } from '../utils/useAnimatedHashMap';
|
|
8
10
|
import { BottomTabBar, getTabBarHeight } from './BottomTabBar';
|
|
9
11
|
import { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';
|
|
12
|
+
const EPSILON = 1e-5;
|
|
13
|
+
const STATE_INACTIVE = 0;
|
|
14
|
+
const STATE_TRANSITIONING_OR_BELOW_TOP = 1;
|
|
15
|
+
const STATE_ON_TOP = 2;
|
|
16
|
+
const NAMED_TRANSITIONS_PRESETS = {
|
|
17
|
+
fade: FadeTransition,
|
|
18
|
+
shift: ShiftTransition,
|
|
19
|
+
none: {
|
|
20
|
+
sceneStyleInterpolator: undefined,
|
|
21
|
+
transitionSpec: {
|
|
22
|
+
animation: 'timing',
|
|
23
|
+
config: {
|
|
24
|
+
duration: 0
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const hasAnimation = options => {
|
|
30
|
+
const {
|
|
31
|
+
animation,
|
|
32
|
+
transitionSpec
|
|
33
|
+
} = options;
|
|
34
|
+
if (animation) {
|
|
35
|
+
return animation !== 'none';
|
|
36
|
+
}
|
|
37
|
+
return !transitionSpec;
|
|
38
|
+
};
|
|
10
39
|
export function BottomTabView(props) {
|
|
11
40
|
const {
|
|
12
41
|
tabBar = props => /*#__PURE__*/React.createElement(BottomTabBar, props),
|
|
@@ -18,10 +47,46 @@ export function BottomTabView(props) {
|
|
|
18
47
|
sceneContainerStyle
|
|
19
48
|
} = props;
|
|
20
49
|
const focusedRouteKey = state.routes[state.index].key;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* List of loaded tabs, tabs will be loaded when navigated to.
|
|
53
|
+
*/
|
|
21
54
|
const [loaded, setLoaded] = React.useState([focusedRouteKey]);
|
|
22
55
|
if (!loaded.includes(focusedRouteKey)) {
|
|
56
|
+
// Set the current tab to be loaded if it was not loaded before
|
|
23
57
|
setLoaded([...loaded, focusedRouteKey]);
|
|
24
58
|
}
|
|
59
|
+
const previousRouteKeyRef = React.useRef(focusedRouteKey);
|
|
60
|
+
const tabAnims = useAnimatedHashMap(state);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
const previousRouteKey = previousRouteKeyRef.current;
|
|
63
|
+
previousRouteKeyRef.current = focusedRouteKey;
|
|
64
|
+
const animateToIndex = () => {
|
|
65
|
+
Animated.parallel(state.routes.map((route, index) => {
|
|
66
|
+
const {
|
|
67
|
+
options
|
|
68
|
+
} = descriptors[route.key];
|
|
69
|
+
const {
|
|
70
|
+
animation = 'none',
|
|
71
|
+
transitionSpec = NAMED_TRANSITIONS_PRESETS[animation].transitionSpec
|
|
72
|
+
} = options;
|
|
73
|
+
let spec = transitionSpec;
|
|
74
|
+
if (route.key !== previousRouteKey && route.key !== focusedRouteKey) {
|
|
75
|
+
// Don't animate if the screen is not previous one or new one
|
|
76
|
+
// This will avoid flicker for screens not involved in the transition
|
|
77
|
+
spec = NAMED_TRANSITIONS_PRESETS.none.transitionSpec;
|
|
78
|
+
}
|
|
79
|
+
spec = spec ?? NAMED_TRANSITIONS_PRESETS.none.transitionSpec;
|
|
80
|
+
const toValue = index === state.index ? 0 : index >= state.index ? 1 : -1;
|
|
81
|
+
return Animated[spec.animation](tabAnims[route.key], {
|
|
82
|
+
...spec.config,
|
|
83
|
+
toValue,
|
|
84
|
+
useNativeDriver: true
|
|
85
|
+
});
|
|
86
|
+
}).filter(Boolean)).start();
|
|
87
|
+
};
|
|
88
|
+
animateToIndex();
|
|
89
|
+
}, [descriptors, focusedRouteKey, state.index, state.routes, tabAnims]);
|
|
25
90
|
const dimensions = SafeAreaProviderCompat.initialMetrics.frame;
|
|
26
91
|
const [tabBarHeight, setTabBarHeight] = React.useState(() => getTabBarHeight({
|
|
27
92
|
state,
|
|
@@ -43,32 +108,44 @@ export function BottomTabView(props) {
|
|
|
43
108
|
descriptors: descriptors,
|
|
44
109
|
navigation: navigation,
|
|
45
110
|
insets: {
|
|
46
|
-
top:
|
|
47
|
-
right:
|
|
48
|
-
bottom:
|
|
49
|
-
left:
|
|
111
|
+
top: safeAreaInsets?.top ?? insets?.top ?? 0,
|
|
112
|
+
right: safeAreaInsets?.right ?? insets?.right ?? 0,
|
|
113
|
+
bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,
|
|
114
|
+
left: safeAreaInsets?.left ?? insets?.left ?? 0
|
|
50
115
|
}
|
|
51
116
|
}));
|
|
52
117
|
};
|
|
53
118
|
const {
|
|
54
119
|
routes
|
|
55
120
|
} = state;
|
|
56
|
-
|
|
121
|
+
|
|
122
|
+
// If there is no animation, we only have 2 states: visible and invisible
|
|
123
|
+
const hasTwoStates = !routes.some(route => hasAnimation(descriptors[route.key].options));
|
|
124
|
+
const {
|
|
125
|
+
tabBarPosition = 'bottom'
|
|
126
|
+
} = descriptors[focusedRouteKey].options;
|
|
127
|
+
return /*#__PURE__*/React.createElement(SafeAreaProviderCompat, {
|
|
128
|
+
style: tabBarPosition === 'left' ? styles.start : tabBarPosition === 'right' ? styles.end : null
|
|
129
|
+
}, tabBarPosition === 'top' ? /*#__PURE__*/React.createElement(BottomTabBarHeightCallbackContext.Provider, {
|
|
130
|
+
value: setTabBarHeight
|
|
131
|
+
}, renderTabBar()) : null, /*#__PURE__*/React.createElement(MaybeScreenContainer, {
|
|
57
132
|
enabled: detachInactiveScreens,
|
|
58
|
-
hasTwoStates:
|
|
59
|
-
style: styles.
|
|
133
|
+
hasTwoStates: hasTwoStates,
|
|
134
|
+
style: styles.screens
|
|
60
135
|
}, routes.map((route, index) => {
|
|
61
136
|
const descriptor = descriptors[route.key];
|
|
62
137
|
const {
|
|
63
138
|
lazy = true,
|
|
64
|
-
unmountOnBlur
|
|
139
|
+
unmountOnBlur,
|
|
140
|
+
animation = 'none',
|
|
141
|
+
sceneStyleInterpolator = NAMED_TRANSITIONS_PRESETS[animation].sceneStyleInterpolator
|
|
65
142
|
} = descriptor.options;
|
|
66
143
|
const isFocused = state.index === index;
|
|
67
144
|
if (unmountOnBlur && !isFocused) {
|
|
68
145
|
return null;
|
|
69
146
|
}
|
|
70
|
-
if (lazy && !loaded.includes(route.key) && !isFocused) {
|
|
71
|
-
// Don't render a lazy screen if we've never navigated to it
|
|
147
|
+
if (lazy && !loaded.includes(route.key) && !isFocused && !state.preloadedRouteKeys.includes(route.key)) {
|
|
148
|
+
// Don't render a lazy screen if we've never navigated to it or it wasn't preloaded
|
|
72
149
|
return null;
|
|
73
150
|
}
|
|
74
151
|
const {
|
|
@@ -87,16 +164,35 @@ export function BottomTabView(props) {
|
|
|
87
164
|
headerStatusBarHeight,
|
|
88
165
|
headerTransparent
|
|
89
166
|
} = descriptor.options;
|
|
167
|
+
const {
|
|
168
|
+
sceneStyle
|
|
169
|
+
} = sceneStyleInterpolator?.({
|
|
170
|
+
current: {
|
|
171
|
+
progress: tabAnims[route.key]
|
|
172
|
+
}
|
|
173
|
+
}) ?? {};
|
|
174
|
+
const animationEnabled = hasAnimation(descriptor.options);
|
|
175
|
+
const activityState = isFocused ? STATE_ON_TOP // the screen is on top after the transition
|
|
176
|
+
: animationEnabled // is animation is not enabled, immediately move to inactive state
|
|
177
|
+
? tabAnims[route.key].interpolate({
|
|
178
|
+
inputRange: [0, 1 - EPSILON, 1],
|
|
179
|
+
outputRange: [STATE_TRANSITIONING_OR_BELOW_TOP,
|
|
180
|
+
// screen visible during transition
|
|
181
|
+
STATE_TRANSITIONING_OR_BELOW_TOP, STATE_INACTIVE // the screen is detached after transition
|
|
182
|
+
],
|
|
183
|
+
|
|
184
|
+
extrapolate: 'extend'
|
|
185
|
+
}) : STATE_INACTIVE;
|
|
90
186
|
return /*#__PURE__*/React.createElement(MaybeScreen, {
|
|
91
187
|
key: route.key,
|
|
92
188
|
style: [StyleSheet.absoluteFill, {
|
|
93
189
|
zIndex: isFocused ? 0 : -1
|
|
94
190
|
}],
|
|
95
|
-
|
|
191
|
+
active: activityState,
|
|
96
192
|
enabled: detachInactiveScreens,
|
|
97
193
|
freezeOnBlur: freezeOnBlur
|
|
98
194
|
}, /*#__PURE__*/React.createElement(BottomTabBarHeightContext.Provider, {
|
|
99
|
-
value: tabBarHeight
|
|
195
|
+
value: tabBarPosition === 'bottom' ? tabBarHeight : 0
|
|
100
196
|
}, /*#__PURE__*/React.createElement(Screen, {
|
|
101
197
|
focused: isFocused,
|
|
102
198
|
route: descriptor.route,
|
|
@@ -110,14 +206,20 @@ export function BottomTabView(props) {
|
|
|
110
206
|
navigation: descriptor.navigation,
|
|
111
207
|
options: descriptor.options
|
|
112
208
|
}),
|
|
113
|
-
style: sceneContainerStyle
|
|
209
|
+
style: [sceneContainerStyle, animationEnabled && sceneStyle]
|
|
114
210
|
}, descriptor.render())));
|
|
115
|
-
})), /*#__PURE__*/React.createElement(BottomTabBarHeightCallbackContext.Provider, {
|
|
211
|
+
})), tabBarPosition !== 'top' ? /*#__PURE__*/React.createElement(BottomTabBarHeightCallbackContext.Provider, {
|
|
116
212
|
value: setTabBarHeight
|
|
117
|
-
}, renderTabBar()));
|
|
213
|
+
}, renderTabBar()) : null);
|
|
118
214
|
}
|
|
119
215
|
const styles = StyleSheet.create({
|
|
120
|
-
|
|
216
|
+
start: {
|
|
217
|
+
flexDirection: 'row-reverse'
|
|
218
|
+
},
|
|
219
|
+
end: {
|
|
220
|
+
flexDirection: 'row'
|
|
221
|
+
},
|
|
222
|
+
screens: {
|
|
121
223
|
flex: 1,
|
|
122
224
|
overflow: 'hidden'
|
|
123
225
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","React","Platform","StyleSheet","SafeAreaInsetsContext","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","BottomTabBar","getTabBarHeight","MaybeScreen","MaybeScreenContainer","BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","useState","includes","dimensions","initialMetrics","frame","tabBarHeight","setTabBarHeight","layout","width","height","insets","style","
|
|
1
|
+
{"version":3,"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","React","Animated","Platform","StyleSheet","SafeAreaInsetsContext","FadeTransition","ShiftTransition","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","useAnimatedHashMap","BottomTabBar","getTabBarHeight","MaybeScreen","MaybeScreenContainer","EPSILON","STATE_INACTIVE","STATE_TRANSITIONING_OR_BELOW_TOP","STATE_ON_TOP","NAMED_TRANSITIONS_PRESETS","fade","shift","none","sceneStyleInterpolator","undefined","transitionSpec","animation","config","duration","hasAnimation","options","BottomTabView","props","tabBar","createElement","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","useState","includes","previousRouteKeyRef","useRef","tabAnims","useEffect","previousRouteKey","current","animateToIndex","parallel","map","route","spec","toValue","useNativeDriver","filter","Boolean","start","dimensions","initialMetrics","frame","tabBarHeight","setTabBarHeight","layout","width","height","insets","style","tabBarStyle","renderTabBar","Consumer","top","right","bottom","left","hasTwoStates","some","tabBarPosition","styles","end","Provider","value","enabled","screens","descriptor","lazy","unmountOnBlur","isFocused","preloadedRouteKeys","freezeOnBlur","header","_ref","_extends","title","name","headerShown","headerStatusBarHeight","headerTransparent","sceneStyle","progress","animationEnabled","activityState","interpolate","inputRange","outputRange","extrapolate","absoluteFill","zIndex","active","focused","render","create","flexDirection","flex","overflow"],"sourceRoot":"../../../src","sources":["views/BottomTabView.tsx"],"mappings":";AAAA,SACEA,cAAc,EACdC,MAAM,EACNC,sBAAsB,EACtBC,MAAM,QACD,4BAA4B;AAKnC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,SACEC,cAAc,EACdC,eAAe,QACV,wCAAwC;AAU/C,SAASC,iCAAiC,QAAQ,4CAA4C;AAC9F,SAASC,yBAAyB,QAAQ,oCAAoC;AAC9E,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,YAAY,EAAEC,eAAe,QAAQ,gBAAgB;AAC9D,SAASC,WAAW,EAAEC,oBAAoB,QAAQ,kBAAkB;AAQpE,MAAMC,OAAO,GAAG,IAAI;AACpB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,gCAAgC,GAAG,CAAC;AAC1C,MAAMC,YAAY,GAAG,CAAC;AAEtB,MAAMC,yBAAyB,GAAG;EAChCC,IAAI,EAAEd,cAAc;EACpBe,KAAK,EAAEd,eAAe;EACtBe,IAAI,EAAE;IACJC,sBAAsB,EAAEC,SAAS;IACjCC,cAAc,EAAE;MACdC,SAAS,EAAE,QAAQ;MACnB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;AACF,CAAC,CAAC"}
|
|
@@ -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
|
-
import { ResourceSavingView } from '@react-navigation/elements';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { View } from 'react-native';
|
|
5
4
|
let Screens;
|
|
@@ -9,12 +8,11 @@ try {
|
|
|
9
8
|
// Ignore
|
|
10
9
|
}
|
|
11
10
|
export const MaybeScreenContainer = _ref => {
|
|
12
|
-
var _Screens, _Screens$screensEnabl;
|
|
13
11
|
let {
|
|
14
12
|
enabled,
|
|
15
13
|
...rest
|
|
16
14
|
} = _ref;
|
|
17
|
-
if (
|
|
15
|
+
if (Screens?.screensEnabled?.()) {
|
|
18
16
|
return /*#__PURE__*/React.createElement(Screens.ScreenContainer, _extends({
|
|
19
17
|
enabled: enabled
|
|
20
18
|
}, rest));
|
|
@@ -22,19 +20,17 @@ export const MaybeScreenContainer = _ref => {
|
|
|
22
20
|
return /*#__PURE__*/React.createElement(View, rest);
|
|
23
21
|
};
|
|
24
22
|
export function MaybeScreen(_ref2) {
|
|
25
|
-
var _Screens2, _Screens2$screensEnab;
|
|
26
23
|
let {
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
enabled,
|
|
25
|
+
active,
|
|
29
26
|
...rest
|
|
30
27
|
} = _ref2;
|
|
31
|
-
if (
|
|
28
|
+
if (Screens?.screensEnabled?.()) {
|
|
32
29
|
return /*#__PURE__*/React.createElement(Screens.Screen, _extends({
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
enabled: enabled,
|
|
31
|
+
activityState: active
|
|
32
|
+
}, rest));
|
|
35
33
|
}
|
|
36
|
-
return /*#__PURE__*/React.createElement(
|
|
37
|
-
visible: visible
|
|
38
|
-
}, rest), children);
|
|
34
|
+
return /*#__PURE__*/React.createElement(View, rest);
|
|
39
35
|
}
|
|
40
36
|
//# sourceMappingURL=ScreenFallback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","View","Screens","require","e","MaybeScreenContainer","_ref","enabled","rest","screensEnabled","createElement","ScreenContainer","_extends","MaybeScreen","_ref2","active","Screen","activityState"],"sourceRoot":"../../../src","sources":["views/ScreenFallback.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAGEC,IAAI,QAGC,cAAc;AAUrB,IAAIC,OAA0D;AAE9D,IAAI;EACFA,OAAO,GAAGC,OAAO,CAAC,sBAAsB,CAAC;AAC3C,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV;AAAA;AAGF,OAAO,MAAMC,oBAAoB,GAAGC,IAAA,IAO9B;EAAA,IAP+B;IACnCC,OAAO;IACP,GAAGC;EAKL,CAAC,GAAAF,IAAA;EACC,IAAIJ,OAAO,EAAEO,cAAc,GAAG,CAAC,EAAE;IAC/B,oBAAOT,KAAA,CAAAU,aAAA,CAACR,OAAO,CAACS,eAAe,EAAAC,QAAA;MAACL,OAAO,EAAEA;IAAQ,GAAKC,IAAI,CAAG,CAAC;EAChE;EAEA,oBAAOR,KAAA,CAAAU,aAAA,CAACT,IAAI,EAAKO,IAAO,CAAC;AAC3B,CAAC;AAED,OAAO,SAASK,WAAWA,CAAAC,KAAA,EAAkD;EAAA,IAAjD;IAAEP,OAAO;IAAEQ,MAAM;IAAE,GAAGP;EAAwB,CAAC,GAAAM,KAAA;EACzE,IAAIZ,OAAO,EAAEO,cAAc,GAAG,CAAC,EAAE;IAC/B,oBACET,KAAA,CAAAU,aAAA,CAACR,OAAO,CAACc,MAAM,EAAAJ,QAAA;MAACL,OAAO,EAAEA,OAAQ;MAACU,aAAa,EAAEF;IAAO,GAAKP,IAAI,CAAG,CAAC;EAEzE;EAEA,oBAAOR,KAAA,CAAAU,aAAA,CAACT,IAAI,EAAKO,IAAO,CAAC;AAC3B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import { Badge } from './Badge';
|
|
4
|
+
const ICON_SIZE = 25;
|
|
4
5
|
export function TabBarIcon(_ref) {
|
|
5
6
|
let {
|
|
6
7
|
route: _,
|
|
@@ -14,8 +15,6 @@ export function TabBarIcon(_ref) {
|
|
|
14
15
|
renderIcon,
|
|
15
16
|
style
|
|
16
17
|
} = _ref;
|
|
17
|
-
const size = 25;
|
|
18
|
-
|
|
19
18
|
// We render the icon twice at the same position on top of each other:
|
|
20
19
|
// active and inactive one, so we can fade between them.
|
|
21
20
|
return /*#__PURE__*/React.createElement(View, {
|
|
@@ -26,7 +25,7 @@ export function TabBarIcon(_ref) {
|
|
|
26
25
|
}]
|
|
27
26
|
}, renderIcon({
|
|
28
27
|
focused: true,
|
|
29
|
-
size,
|
|
28
|
+
size: ICON_SIZE,
|
|
30
29
|
color: activeTintColor
|
|
31
30
|
})), /*#__PURE__*/React.createElement(View, {
|
|
32
31
|
style: [styles.icon, {
|
|
@@ -34,12 +33,12 @@ export function TabBarIcon(_ref) {
|
|
|
34
33
|
}]
|
|
35
34
|
}, renderIcon({
|
|
36
35
|
focused: false,
|
|
37
|
-
size,
|
|
36
|
+
size: ICON_SIZE,
|
|
38
37
|
color: inactiveTintColor
|
|
39
38
|
})), /*#__PURE__*/React.createElement(Badge, {
|
|
40
39
|
visible: badge != null,
|
|
41
|
-
style: [styles.badge,
|
|
42
|
-
size:
|
|
40
|
+
style: [styles.badge, badgeStyle],
|
|
41
|
+
size: ICON_SIZE * 0.75
|
|
43
42
|
}, badge));
|
|
44
43
|
}
|
|
45
44
|
const styles = StyleSheet.create({
|
|
@@ -54,24 +53,20 @@ const styles = StyleSheet.create({
|
|
|
54
53
|
height: '100%',
|
|
55
54
|
width: '100%',
|
|
56
55
|
// Workaround for react-native >= 0.54 layout bug
|
|
57
|
-
minWidth:
|
|
56
|
+
minWidth: ICON_SIZE
|
|
58
57
|
},
|
|
59
58
|
iconVertical: {
|
|
60
|
-
|
|
59
|
+
width: ICON_SIZE,
|
|
60
|
+
height: ICON_SIZE
|
|
61
61
|
},
|
|
62
62
|
iconHorizontal: {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
width: ICON_SIZE,
|
|
64
|
+
height: ICON_SIZE
|
|
65
65
|
},
|
|
66
66
|
badge: {
|
|
67
67
|
position: 'absolute',
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
badgeVertical: {
|
|
71
|
-
top: 3
|
|
72
|
-
},
|
|
73
|
-
badgeHorizontal: {
|
|
74
|
-
top: 7
|
|
68
|
+
end: -5,
|
|
69
|
+
top: -5
|
|
75
70
|
}
|
|
76
71
|
});
|
|
77
72
|
//# sourceMappingURL=TabBarIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","View","Badge","TabBarIcon","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","Badge","ICON_SIZE","TabBarIcon","_ref","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","createElement","styles","iconHorizontal","iconVertical","icon","opacity","focused","size","color","visible","create","position","alignSelf","alignItems","justifyContent","height","width","minWidth","end","top"],"sourceRoot":"../../../src","sources":["views/TabBarIcon.tsx"],"mappings":"AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,UAAU,EAEVC,IAAI,QAEC,cAAc;AAErB,SAASC,KAAK,QAAQ,SAAS;AAmB/B,MAAMC,SAAS,GAAG,EAAE;AAEpB,OAAO,SAASC,UAAUA,CAAAC,IAAA,EAWhB;EAAA,IAXiB;IACzBC,KAAK,EAAEC,CAAC;IACRC,UAAU;IACVC,KAA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,CAAC;EACDiB,YAAY,EAAE;IACZa,KAAK,EAAE9B,SAAS;IAChB6B,MAAM,EAAE7B;EACV,CAAC;EACDgB,cAAc,EAAE;IACdc,KAAK,EAAE9B,SAAS;IAChB6B,MAAM,EAAE7B;EACV,CAAC;EACDM,KAAK,EAAE;IACLmB,QAAQ,EAAE,UAAU;IACpBO,GAAG,EAAE,CAAC,CAAC;IACPC,GAAG,EAAE,CAAC;EACR;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BottomTabSceneInterpolatedStyle, BottomTabSceneInterpolationProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Simple cross fade animation
|
|
4
|
+
*/
|
|
5
|
+
export declare function forFade({ current, }: BottomTabSceneInterpolationProps): BottomTabSceneInterpolatedStyle;
|
|
6
|
+
/**
|
|
7
|
+
* Animation where the screens slightly shift to left/right
|
|
8
|
+
*/
|
|
9
|
+
export declare function forShift({ current, }: BottomTabSceneInterpolationProps): BottomTabSceneInterpolatedStyle;
|
|
10
|
+
//# sourceMappingURL=SceneStyleInterpolators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneStyleInterpolators.d.ts","sourceRoot":"","sources":["../../../../src/TransitionConfigs/SceneStyleInterpolators.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,gCAAgC,EACjC,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,GACR,EAAE,gCAAgC,GAAG,+BAA+B,CASpE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EACvB,OAAO,GACR,EAAE,gCAAgC,GAAG,+BAA+B,CAiBpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransitionPresets.d.ts","sourceRoot":"","sources":["../../../../src/TransitionConfigs/TransitionPresets.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAI1D,eAAO,MAAM,cAAc,EAAE,yBAG5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,yBAG7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransitionSpecs.d.ts","sourceRoot":"","sources":["../../../../src/TransitionConfigs/TransitionSpecs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,QAAQ,EAAE,cAMtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAMvB,CAAC"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import * as SceneStyleInterpolators from './TransitionConfigs/SceneStyleInterpolators';
|
|
2
|
+
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
|
|
3
|
+
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
|
|
4
|
+
/**
|
|
5
|
+
* Transition Presets
|
|
6
|
+
*/
|
|
7
|
+
export { SceneStyleInterpolators, TransitionPresets, TransitionSpecs };
|
|
1
8
|
/**
|
|
2
9
|
* Navigators
|
|
3
10
|
*/
|
|
@@ -16,5 +23,5 @@ export { useBottomTabBarHeight } from './utils/useBottomTabBarHeight';
|
|
|
16
23
|
/**
|
|
17
24
|
* Types
|
|
18
25
|
*/
|
|
19
|
-
export type { BottomTabBarButtonProps, BottomTabBarProps, BottomTabHeaderProps, BottomTabNavigationEventMap, BottomTabNavigationOptions, BottomTabNavigationProp, BottomTabScreenProps, } from './types';
|
|
26
|
+
export type { BottomTabBarButtonProps, BottomTabBarProps, BottomTabHeaderProps, BottomTabNavigationEventMap, BottomTabNavigationOptions, BottomTabNavigationProp, BottomTabOptionsArgs, BottomTabScreenProps, } from './types';
|
|
20
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.t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,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { DefaultNavigatorOptions, ParamListBase, TabNavigationState, TabRouterOptions } from '@react-navigation/native';
|
|
2
|
-
import
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { type DefaultNavigatorOptions, type NavigatorTypeBagBase, type ParamListBase, type StaticConfig, type TabNavigationState, type TabRouterOptions, type TypedNavigator } from '@react-navigation/native';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { BottomTabNavigationConfig, BottomTabNavigationEventMap, BottomTabNavigationOptions, BottomTabNavigationProp } from '../types';
|
|
4
|
+
type Props = DefaultNavigatorOptions<ParamListBase, string | undefined, TabNavigationState<ParamListBase>, BottomTabNavigationOptions, BottomTabNavigationEventMap, BottomTabNavigationProp<ParamListBase>> & TabRouterOptions & BottomTabNavigationConfig;
|
|
5
|
+
declare function BottomTabNavigator({ id, initialRouteName, backBehavior, children, layout, screenListeners, screenOptions, sceneContainerStyle, UNSTABLE_getStateForRouteNamesChange, ...rest }: Props): React.JSX.Element;
|
|
6
|
+
export declare function createBottomTabNavigator<ParamList extends ParamListBase, NavigatorID extends string | undefined = undefined, TypeBag extends NavigatorTypeBagBase = {
|
|
7
|
+
ParamList: ParamList;
|
|
8
|
+
NavigatorID: NavigatorID;
|
|
9
|
+
State: TabNavigationState<ParamList>;
|
|
10
|
+
ScreenOptions: BottomTabNavigationOptions;
|
|
11
|
+
EventMap: BottomTabNavigationEventMap;
|
|
12
|
+
NavigationList: {
|
|
13
|
+
[RouteName in keyof ParamList]: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
9
14
|
};
|
|
10
|
-
|
|
15
|
+
Navigator: typeof BottomTabNavigator;
|
|
16
|
+
}, Config extends StaticConfig<TypeBag> | undefined = StaticConfig<TypeBag> | undefined>(config?: Config): TypedNavigator<TypeBag, Config>;
|
|
11
17
|
export {};
|
|
12
18
|
//# sourceMappingURL=createBottomTabNavigator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBottomTabNavigator.d.ts","sourceRoot":"","sources":["../../../../src/navigators/createBottomTabNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,
|
|
1
|
+
{"version":3,"file":"createBottomTabNavigator.d.ts","sourceRoot":"","sources":["../../../../src/navigators/createBottomTabNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAGlB,KAAK,KAAK,GAAG,uBAAuB,CAClC,aAAa,EACb,MAAM,GAAG,SAAS,EAClB,kBAAkB,CAAC,aAAa,CAAC,EACjC,0BAA0B,EAC1B,2BAA2B,EAC3B,uBAAuB,CAAC,aAAa,CAAC,CACvC,GACC,gBAAgB,GAChB,yBAAyB,CAAC;AAE5B,iBAAS,kBAAkB,CAAC,EAC1B,EAAE,EACF,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,oCAAoC,EACpC,GAAG,IAAI,EACR,EAAE,KAAK,qBA8BP;AAED,wBAAgB,wBAAwB,CACtC,SAAS,SAAS,aAAa,EAC/B,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EAClD,OAAO,SAAS,oBAAoB,GAAG;IACrC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACrC,aAAa,EAAE,0BAA0B,CAAC;IAC1C,QAAQ,EAAE,2BAA2B,CAAC;IACtC,cAAc,EAAE;SACb,SAAS,IAAI,MAAM,SAAS,GAAG,uBAAuB,CACrD,SAAS,EACT,SAAS,EACT,WAAW,CACZ;KACF,CAAC;IACF,SAAS,EAAE,OAAO,kBAAkB,CAAC;CACtC,EACD,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,GAC5C,YAAY,CAAC,OAAO,CAAC,GACrB,SAAS,EACb,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { HeaderOptions } from '@react-navigation/elements';
|
|
2
|
-
import type { Descriptor, NavigationHelpers, NavigationProp, ParamListBase, RouteProp, TabActionHelpers, TabNavigationState } from '@react-navigation/native';
|
|
1
|
+
import type { HeaderOptions, PlatformPressable } from '@react-navigation/elements';
|
|
2
|
+
import type { Descriptor, NavigationHelpers, NavigationProp, ParamListBase, RouteProp, TabActionHelpers, TabNavigationState, Theme } from '@react-navigation/native';
|
|
3
3
|
import type * as React from 'react';
|
|
4
|
-
import type { Animated, GestureResponderEvent, StyleProp, TextStyle,
|
|
4
|
+
import type { Animated, GestureResponderEvent, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
5
5
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
6
6
|
export type Layout = {
|
|
7
7
|
width: number;
|
|
@@ -29,6 +29,9 @@ export type BottomTabScreenProps<ParamList extends ParamListBase, RouteName exte
|
|
|
29
29
|
navigation: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
30
30
|
route: RouteProp<ParamList, RouteName>;
|
|
31
31
|
};
|
|
32
|
+
export type BottomTabOptionsArgs<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = BottomTabScreenProps<ParamList, RouteName, NavigatorID> & {
|
|
33
|
+
theme: Theme;
|
|
34
|
+
};
|
|
32
35
|
export type TimingKeyboardAnimationConfig = {
|
|
33
36
|
animation: 'timing';
|
|
34
37
|
config?: Omit<Partial<Animated.TimingAnimationConfig>, 'toValue' | 'useNativeDriver'>;
|
|
@@ -38,6 +41,7 @@ export type SpringKeyboardAnimationConfig = {
|
|
|
38
41
|
config?: Omit<Partial<Animated.SpringAnimationConfig>, 'toValue' | 'useNativeDriver'>;
|
|
39
42
|
};
|
|
40
43
|
export type TabBarVisibilityAnimationConfig = TimingKeyboardAnimationConfig | SpringKeyboardAnimationConfig;
|
|
44
|
+
export type TabAnimationName = 'none' | 'fade' | 'shift';
|
|
41
45
|
export type BottomTabNavigationOptions = HeaderOptions & {
|
|
42
46
|
/**
|
|
43
47
|
* Title text for the screen.
|
|
@@ -154,6 +158,10 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
|
|
154
158
|
* You'd also need to use `useBottomTabBarHeight()` to add a bottom padding to your content.
|
|
155
159
|
*/
|
|
156
160
|
tabBarBackground?: () => React.ReactNode;
|
|
161
|
+
/**
|
|
162
|
+
* Position of the tab bar on the screen. Defaults to `bottom`.
|
|
163
|
+
*/
|
|
164
|
+
tabBarPosition?: 'bottom' | 'left' | 'right' | 'top';
|
|
157
165
|
/**
|
|
158
166
|
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
|
159
167
|
* Set it to `false` if you want to render the screen on initial render.
|
|
@@ -181,9 +189,68 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
|
|
181
189
|
* Only supported on iOS and Android.
|
|
182
190
|
*/
|
|
183
191
|
freezeOnBlur?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* How the screen should animate when switching tabs.
|
|
194
|
+
*
|
|
195
|
+
* Supported values:
|
|
196
|
+
* - 'none': don't animate the screen (default)
|
|
197
|
+
* - 'fade': cross-fade the screens.
|
|
198
|
+
* - 'shift': shift the screens slightly shift to left/right.
|
|
199
|
+
*/
|
|
200
|
+
animation?: TabAnimationName;
|
|
201
|
+
/**
|
|
202
|
+
* Function which specifies interpolated styles for bottom-tab scenes.
|
|
203
|
+
*/
|
|
204
|
+
sceneStyleInterpolator?: BottomTabSceneStyleInterpolator;
|
|
205
|
+
/**
|
|
206
|
+
* Object which specifies the animation type (timing or spring) and their options (such as duration for timing).
|
|
207
|
+
*/
|
|
208
|
+
transitionSpec?: TransitionSpec;
|
|
184
209
|
};
|
|
185
210
|
export type BottomTabDescriptor = Descriptor<BottomTabNavigationOptions, BottomTabNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
|
|
186
211
|
export type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;
|
|
212
|
+
export type BottomTabSceneInterpolationProps = {
|
|
213
|
+
/**
|
|
214
|
+
* Values for the current screen.
|
|
215
|
+
*/
|
|
216
|
+
current: {
|
|
217
|
+
/**
|
|
218
|
+
* Animated value for the current screen:
|
|
219
|
+
* - -1 if the index is lower than active tab,
|
|
220
|
+
* - 0 if they're active,
|
|
221
|
+
* - 1 if the index is higher than active tab
|
|
222
|
+
*/
|
|
223
|
+
progress: Animated.Value;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
export type BottomTabSceneInterpolatedStyle = {
|
|
227
|
+
/**
|
|
228
|
+
* Interpolated style for the view representing the scene containing screen content.
|
|
229
|
+
*/
|
|
230
|
+
sceneStyle: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
231
|
+
};
|
|
232
|
+
export type BottomTabSceneStyleInterpolator = (props: BottomTabSceneInterpolationProps) => BottomTabSceneInterpolatedStyle;
|
|
233
|
+
export type TransitionSpec = {
|
|
234
|
+
animation: 'timing';
|
|
235
|
+
config: Omit<Animated.TimingAnimationConfig, 'toValue' | keyof Animated.AnimationConfig>;
|
|
236
|
+
} | {
|
|
237
|
+
animation: 'spring';
|
|
238
|
+
config: Omit<Animated.SpringAnimationConfig, 'toValue' | keyof Animated.AnimationConfig>;
|
|
239
|
+
};
|
|
240
|
+
export type BottomTabTransitionPreset = {
|
|
241
|
+
/**
|
|
242
|
+
* Whether transition animations should be enabled when switching tabs.
|
|
243
|
+
*/
|
|
244
|
+
animationEnabled?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Function which specifies interpolated styles for bottom-tab scenes.
|
|
247
|
+
*/
|
|
248
|
+
sceneStyleInterpolator?: BottomTabSceneStyleInterpolator;
|
|
249
|
+
/**
|
|
250
|
+
* Object which specifies the animation type (timing or spring) and their options (such as duration for timing).
|
|
251
|
+
*/
|
|
252
|
+
transitionSpec?: TransitionSpec;
|
|
253
|
+
};
|
|
187
254
|
export type BottomTabNavigationConfig = {
|
|
188
255
|
/**
|
|
189
256
|
* Function that returns a React element to display as the tab bar.
|
|
@@ -234,7 +301,7 @@ export type BottomTabBarProps = {
|
|
|
234
301
|
navigation: NavigationHelpers<ParamListBase, BottomTabNavigationEventMap>;
|
|
235
302
|
insets: EdgeInsets;
|
|
236
303
|
};
|
|
237
|
-
export type BottomTabBarButtonProps = Omit<
|
|
304
|
+
export type BottomTabBarButtonProps = Omit<React.ComponentProps<typeof PlatformPressable>, 'onPress'> & {
|
|
238
305
|
href?: string;
|
|
239
306
|
children: React.ReactNode;
|
|
240
307
|
onPress?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent) => void;
|