@react-navigation/bottom-tabs 7.0.0-alpha.2 → 7.0.0-alpha.4
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 +19 -0
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -0
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +24 -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/utils/useAnimatedHashMap.js +31 -0
- package/lib/commonjs/utils/useAnimatedHashMap.js.map +1 -0
- package/lib/commonjs/views/BottomTabBar.js +53 -13
- package/lib/commonjs/views/BottomTabBar.js.map +1 -1
- package/lib/commonjs/views/BottomTabItem.js +21 -27
- package/lib/commonjs/views/BottomTabItem.js.map +1 -1
- package/lib/commonjs/views/BottomTabView.js +89 -8
- package/lib/commonjs/views/BottomTabView.js.map +1 -1
- package/lib/commonjs/views/ScreenFallback.js +6 -8
- 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/utils/useAnimatedHashMap.js +23 -0
- package/lib/module/utils/useAnimatedHashMap.js.map +1 -0
- package/lib/module/views/BottomTabBar.js +55 -15
- package/lib/module/views/BottomTabBar.js.map +1 -1
- package/lib/module/views/BottomTabItem.js +22 -28
- package/lib/module/views/BottomTabItem.js.map +1 -1
- package/lib/module/views/BottomTabView.js +90 -9
- package/lib/module/views/BottomTabView.js.map +1 -1
- package/lib/module/views/ScreenFallback.js +6 -8
- 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 +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +54 -0
- 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/BottomTabBar.d.ts +1 -1
- package/lib/typescript/src/views/BottomTabBar.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabItem.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabView.d.ts.map +1 -1
- package/lib/typescript/src/views/ScreenFallback.d.ts +4 -4
- package/lib/typescript/src/views/ScreenFallback.d.ts.map +1 -1
- package/lib/typescript/src/views/TabBarIcon.d.ts.map +1 -1
- package/package.json +5 -5
- 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 +9 -0
- package/src/types.tsx +75 -0
- package/src/utils/useAnimatedHashMap.tsx +25 -0
- package/src/views/BottomTabBar.tsx +109 -34
- package/src/views/BottomTabItem.tsx +31 -37
- package/src/views/BottomTabView.tsx +115 -10
- package/src/views/ScreenFallback.tsx +6 -13
- package/src/views/TabBarIcon.tsx +13 -21
|
@@ -10,11 +10,27 @@ var _reactNative = require("react-native");
|
|
|
10
10
|
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
11
11
|
var _BottomTabBarHeightCallbackContext = require("../utils/BottomTabBarHeightCallbackContext");
|
|
12
12
|
var _BottomTabBarHeightContext = require("../utils/BottomTabBarHeightContext");
|
|
13
|
+
var _useAnimatedHashMap = require("../utils/useAnimatedHashMap");
|
|
13
14
|
var _BottomTabBar = require("./BottomTabBar");
|
|
14
15
|
var _ScreenFallback = require("./ScreenFallback");
|
|
15
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
18
|
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); }
|
|
19
|
+
var CompositeAnimation = _reactNative.Animated.CompositeAnimation;
|
|
20
|
+
const EPSILON = 1e-5;
|
|
21
|
+
const STATE_INACTIVE = 0;
|
|
22
|
+
const STATE_TRANSITIONING_OR_BELOW_TOP = 1;
|
|
23
|
+
const STATE_ON_TOP = 2;
|
|
24
|
+
const hasAnimation = options => {
|
|
25
|
+
const {
|
|
26
|
+
animationEnabled,
|
|
27
|
+
transitionSpec
|
|
28
|
+
} = options;
|
|
29
|
+
if (animationEnabled === false || !transitionSpec) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
18
34
|
function BottomTabView(props) {
|
|
19
35
|
const {
|
|
20
36
|
tabBar = props => /*#__PURE__*/React.createElement(_BottomTabBar.BottomTabBar, props),
|
|
@@ -26,10 +42,43 @@ function BottomTabView(props) {
|
|
|
26
42
|
sceneContainerStyle
|
|
27
43
|
} = props;
|
|
28
44
|
const focusedRouteKey = state.routes[state.index].key;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* List of loaded tabs, tabs will be loaded when navigated to.
|
|
48
|
+
*/
|
|
29
49
|
const [loaded, setLoaded] = React.useState([focusedRouteKey]);
|
|
30
50
|
if (!loaded.includes(focusedRouteKey)) {
|
|
51
|
+
// Set the current tab to be loaded if it was not loaded before
|
|
31
52
|
setLoaded([...loaded, focusedRouteKey]);
|
|
32
53
|
}
|
|
54
|
+
const tabAnims = (0, _useAnimatedHashMap.useAnimatedHashMap)(state);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
const animateToIndex = () => {
|
|
57
|
+
_reactNative.Animated.parallel(state.routes.map((route, index) => {
|
|
58
|
+
const {
|
|
59
|
+
options
|
|
60
|
+
} = descriptors[route.key];
|
|
61
|
+
const {
|
|
62
|
+
transitionSpec
|
|
63
|
+
} = options;
|
|
64
|
+
const animationEnabled = hasAnimation(options);
|
|
65
|
+
const toValue = index === state.index ? 0 : index >= state.index ? 1 : -1;
|
|
66
|
+
if (!animationEnabled || !transitionSpec) {
|
|
67
|
+
return _reactNative.Animated.timing(tabAnims[route.key], {
|
|
68
|
+
toValue,
|
|
69
|
+
duration: 0,
|
|
70
|
+
useNativeDriver: true
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return _reactNative.Animated[transitionSpec.animation](tabAnims[route.key], {
|
|
74
|
+
...transitionSpec.config,
|
|
75
|
+
toValue,
|
|
76
|
+
useNativeDriver: true
|
|
77
|
+
});
|
|
78
|
+
}).filter(Boolean)).start();
|
|
79
|
+
};
|
|
80
|
+
animateToIndex();
|
|
81
|
+
}, [descriptors, state.index, state.routes, tabAnims]);
|
|
33
82
|
const dimensions = _elements.SafeAreaProviderCompat.initialMetrics.frame;
|
|
34
83
|
const [tabBarHeight, setTabBarHeight] = React.useState(() => (0, _BottomTabBar.getTabBarHeight)({
|
|
35
84
|
state,
|
|
@@ -61,15 +110,24 @@ function BottomTabView(props) {
|
|
|
61
110
|
const {
|
|
62
111
|
routes
|
|
63
112
|
} = state;
|
|
64
|
-
|
|
113
|
+
|
|
114
|
+
// If there is no animation, we only have 2 states: visible and invisible
|
|
115
|
+
const hasTwoStates = !routes.some(route => hasAnimation(descriptors[route.key].options));
|
|
116
|
+
const {
|
|
117
|
+
tabBarPosition = 'bottom'
|
|
118
|
+
} = descriptors[focusedRouteKey].options;
|
|
119
|
+
return /*#__PURE__*/React.createElement(_elements.SafeAreaProviderCompat, {
|
|
120
|
+
style: tabBarPosition === 'left' ? styles.left : tabBarPosition === 'right' ? styles.right : null
|
|
121
|
+
}, /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreenContainer, {
|
|
65
122
|
enabled: detachInactiveScreens,
|
|
66
|
-
hasTwoStates:
|
|
67
|
-
style: styles.
|
|
123
|
+
hasTwoStates: hasTwoStates,
|
|
124
|
+
style: styles.screens
|
|
68
125
|
}, routes.map((route, index) => {
|
|
69
126
|
const descriptor = descriptors[route.key];
|
|
70
127
|
const {
|
|
71
128
|
lazy = true,
|
|
72
|
-
unmountOnBlur
|
|
129
|
+
unmountOnBlur,
|
|
130
|
+
sceneStyleInterpolator
|
|
73
131
|
} = descriptor.options;
|
|
74
132
|
const isFocused = state.index === index;
|
|
75
133
|
if (unmountOnBlur && !isFocused) {
|
|
@@ -95,16 +153,33 @@ function BottomTabView(props) {
|
|
|
95
153
|
headerStatusBarHeight,
|
|
96
154
|
headerTransparent
|
|
97
155
|
} = descriptor.options;
|
|
156
|
+
const {
|
|
157
|
+
sceneStyle
|
|
158
|
+
} = (sceneStyleInterpolator === null || sceneStyleInterpolator === void 0 ? void 0 : sceneStyleInterpolator({
|
|
159
|
+
current: tabAnims[route.key]
|
|
160
|
+
})) ?? {};
|
|
161
|
+
const animationEnabled = hasAnimation(descriptor.options);
|
|
162
|
+
const activityState = isFocused ? STATE_ON_TOP // the screen is on top after the transition
|
|
163
|
+
: animationEnabled // is animation is not enabled, immediately move to inactive state
|
|
164
|
+
? tabAnims[route.key].interpolate({
|
|
165
|
+
inputRange: [0, 1 - EPSILON, 1],
|
|
166
|
+
outputRange: [STATE_TRANSITIONING_OR_BELOW_TOP,
|
|
167
|
+
// screen visible during transition
|
|
168
|
+
STATE_TRANSITIONING_OR_BELOW_TOP, STATE_INACTIVE // the screen is detached after transition
|
|
169
|
+
],
|
|
170
|
+
|
|
171
|
+
extrapolate: 'extend'
|
|
172
|
+
}) : STATE_INACTIVE;
|
|
98
173
|
return /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreen, {
|
|
99
174
|
key: route.key,
|
|
100
175
|
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
101
176
|
zIndex: isFocused ? 0 : -1
|
|
102
177
|
}],
|
|
103
|
-
|
|
178
|
+
active: activityState,
|
|
104
179
|
enabled: detachInactiveScreens,
|
|
105
180
|
freezeOnBlur: freezeOnBlur
|
|
106
181
|
}, /*#__PURE__*/React.createElement(_BottomTabBarHeightContext.BottomTabBarHeightContext.Provider, {
|
|
107
|
-
value: tabBarHeight
|
|
182
|
+
value: tabBarPosition === 'bottom' ? tabBarHeight : 0
|
|
108
183
|
}, /*#__PURE__*/React.createElement(_elements.Screen, {
|
|
109
184
|
focused: isFocused,
|
|
110
185
|
route: descriptor.route,
|
|
@@ -118,14 +193,20 @@ function BottomTabView(props) {
|
|
|
118
193
|
navigation: descriptor.navigation,
|
|
119
194
|
options: descriptor.options
|
|
120
195
|
}),
|
|
121
|
-
style: sceneContainerStyle
|
|
196
|
+
style: [sceneContainerStyle, animationEnabled && sceneStyle]
|
|
122
197
|
}, descriptor.render())));
|
|
123
198
|
})), /*#__PURE__*/React.createElement(_BottomTabBarHeightCallbackContext.BottomTabBarHeightCallbackContext.Provider, {
|
|
124
199
|
value: setTabBarHeight
|
|
125
200
|
}, renderTabBar()));
|
|
126
201
|
}
|
|
127
202
|
const styles = _reactNative.StyleSheet.create({
|
|
128
|
-
|
|
203
|
+
left: {
|
|
204
|
+
flexDirection: 'row-reverse'
|
|
205
|
+
},
|
|
206
|
+
right: {
|
|
207
|
+
flexDirection: 'row'
|
|
208
|
+
},
|
|
209
|
+
screens: {
|
|
129
210
|
flex: 1,
|
|
130
211
|
overflow: 'hidden'
|
|
131
212
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","Platform","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","React","useState","includes","dimensions","SafeAreaProviderCompat","initialMetrics","frame","tabBarHeight","setTabBarHeight","getTabBarHeight","layout","width","height","insets","style","
|
|
1
|
+
{"version":3,"names":["CompositeAnimation","Animated","EPSILON","STATE_INACTIVE","STATE_TRANSITIONING_OR_BELOW_TOP","STATE_ON_TOP","hasAnimation","options","animationEnabled","transitionSpec","BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","Platform","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","React","useState","includes","tabAnims","useAnimatedHashMap","useEffect","animateToIndex","parallel","map","route","toValue","timing","duration","useNativeDriver","animation","config","filter","Boolean","start","dimensions","SafeAreaProviderCompat","initialMetrics","frame","tabBarHeight","setTabBarHeight","getTabBarHeight","layout","width","height","insets","style","tabBarStyle","renderTabBar","top","right","bottom","left","hasTwoStates","some","tabBarPosition","styles","screens","descriptor","lazy","unmountOnBlur","sceneStyleInterpolator","isFocused","freezeOnBlur","header","getHeaderTitle","name","headerShown","headerStatusBarHeight","headerTransparent","sceneStyle","current","activityState","interpolate","inputRange","outputRange","extrapolate","StyleSheet","absoluteFill","zIndex","render","create","flexDirection","flex","overflow"],"sourceRoot":"../../../src","sources":["views/BottomTabView.tsx"],"mappings":";;;;;;AAAA;AAUA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AAAqE;AAAA;AAAA;AAAA,IAC9DA,kBAAkB,GAAGC,qBAAQ,CAACD,kBAAkB;AAQvD,MAAME,OAAO,GAAG,IAAI;AACpB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,gCAAgC,GAAG,CAAC;AAC1C,MAAMC,YAAY,GAAG,CAAC;AAEtB,MAAMC,YAAY,GAAIC,OAAmC,IAAK;EAC5D,MAAM;IAAEC,gBAAgB;IAAEC;EAAe,CAAC,GAAGF,OAAO;EAEpD,IAAIC,gBAAgB,KAAK,KAAK,IAAI,CAACC,cAAc,EAAE;IACjD,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb,CAAC;AAEM,SAASC,aAAa,CAACC,KAAY,EAAE;EAC1C,MAAM;IACJC,MAAM,GAAID,KAAwB,iBAAK,oBAAC,0BAAY,EAAKA,KAAK,CAAI;IAClEE,KAAK;IACLC,UAAU;IACVC,WAAW;IACXC,cAAc;IACdC,qBAAqB,GAAGC,qBAAQ,CAACC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ACLgC,aAAa,EAAE;EACjB,CAAC;EACDzB,OAAO,EAAE;IACP0B,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.MaybeScreen = MaybeScreen;
|
|
7
7
|
exports.MaybeScreenContainer = void 0;
|
|
8
|
-
var _elements = require("@react-navigation/elements");
|
|
9
8
|
var React = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _reactNative = require("react-native");
|
|
11
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -34,17 +33,16 @@ exports.MaybeScreenContainer = MaybeScreenContainer;
|
|
|
34
33
|
function MaybeScreen(_ref2) {
|
|
35
34
|
var _Screens2, _Screens2$screensEnab;
|
|
36
35
|
let {
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
enabled,
|
|
37
|
+
active,
|
|
39
38
|
...rest
|
|
40
39
|
} = _ref2;
|
|
41
40
|
if ((_Screens2 = Screens) !== null && _Screens2 !== void 0 && (_Screens2$screensEnab = _Screens2.screensEnabled) !== null && _Screens2$screensEnab !== void 0 && _Screens2$screensEnab.call(_Screens2)) {
|
|
42
41
|
return /*#__PURE__*/React.createElement(Screens.Screen, _extends({
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
enabled: enabled,
|
|
43
|
+
activityState: active
|
|
44
|
+
}, rest));
|
|
45
45
|
}
|
|
46
|
-
return /*#__PURE__*/React.createElement(
|
|
47
|
-
visible: visible
|
|
48
|
-
}, rest), children);
|
|
46
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, rest);
|
|
49
47
|
}
|
|
50
48
|
//# sourceMappingURL=ScreenFallback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","
|
|
1
|
+
{"version":3,"names":["Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","active"],"sourceRoot":"../../../src","sources":["views/ScreenFallback.tsx"],"mappings":";;;;;;;AAAA;AACA;AAA+E;AAAA;AAAA;AAU/E,IAAIA,OAA0D;AAE9D,IAAI;EACFA,OAAO,GAAGC,OAAO,CAAC,sBAAsB,CAAC;AAC3C,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV;AAAA;AAGK,MAAMC,oBAAoB,GAAG,QAO9B;EAAA;EAAA,IAP+B;IACnCC,OAAO;IACP,GAAGC;EAKL,CAAC;EACC,gBAAIL,OAAO,8DAAP,SAASM,cAAc,kDAAvB,oCAA2B,EAAE;IAC/B,oBAAO,oBAAC,OAAO,CAAC,eAAe;MAAC,OAAO,EAAEF;IAAQ,GAAKC,IAAI,EAAI;EAChE;EAEA,oBAAO,oBAAC,iBAAI,EAAKA,IAAI,CAAI;AAC3B,CAAC;AAAC;AAEK,SAASE,WAAW,QAAkD;EAAA;EAAA,IAAjD;IAAEH,OAAO;IAAEI,MAAM;IAAE,GAAGH;EAAwB,CAAC;EACzE,iBAAIL,OAAO,+DAAP,UAASM,cAAc,kDAAvB,qCAA2B,EAAE;IAC/B,oBACE,oBAAC,OAAO,CAAC,MAAM;MAAC,OAAO,EAAEF,OAAQ;MAAC,aAAa,EAAEI;IAAO,GAAKH,IAAI,EAAI;EAEzE;EAEA,oBAAO,oBAAC,iBAAI,EAAKA,IAAI,CAAI;AAC3B"}
|
|
@@ -8,6 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _Badge = require("./Badge");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const ICON_SIZE = 25;
|
|
11
12
|
function TabBarIcon(_ref) {
|
|
12
13
|
let {
|
|
13
14
|
route: _,
|
|
@@ -21,8 +22,6 @@ function TabBarIcon(_ref) {
|
|
|
21
22
|
renderIcon,
|
|
22
23
|
style
|
|
23
24
|
} = _ref;
|
|
24
|
-
const size = 25;
|
|
25
|
-
|
|
26
25
|
// We render the icon twice at the same position on top of each other:
|
|
27
26
|
// active and inactive one, so we can fade between them.
|
|
28
27
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
@@ -33,7 +32,7 @@ function TabBarIcon(_ref) {
|
|
|
33
32
|
}]
|
|
34
33
|
}, renderIcon({
|
|
35
34
|
focused: true,
|
|
36
|
-
size,
|
|
35
|
+
size: ICON_SIZE,
|
|
37
36
|
color: activeTintColor
|
|
38
37
|
})), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
39
38
|
style: [styles.icon, {
|
|
@@ -41,12 +40,12 @@ function TabBarIcon(_ref) {
|
|
|
41
40
|
}]
|
|
42
41
|
}, renderIcon({
|
|
43
42
|
focused: false,
|
|
44
|
-
size,
|
|
43
|
+
size: ICON_SIZE,
|
|
45
44
|
color: inactiveTintColor
|
|
46
45
|
})), /*#__PURE__*/_react.default.createElement(_Badge.Badge, {
|
|
47
46
|
visible: badge != null,
|
|
48
|
-
style: [styles.badge,
|
|
49
|
-
size:
|
|
47
|
+
style: [styles.badge, badgeStyle],
|
|
48
|
+
size: ICON_SIZE * 0.75
|
|
50
49
|
}, badge));
|
|
51
50
|
}
|
|
52
51
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -61,24 +60,20 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
61
60
|
height: '100%',
|
|
62
61
|
width: '100%',
|
|
63
62
|
// Workaround for react-native >= 0.54 layout bug
|
|
64
|
-
minWidth:
|
|
63
|
+
minWidth: ICON_SIZE
|
|
65
64
|
},
|
|
66
65
|
iconVertical: {
|
|
67
|
-
|
|
66
|
+
width: ICON_SIZE,
|
|
67
|
+
height: ICON_SIZE
|
|
68
68
|
},
|
|
69
69
|
iconHorizontal: {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
width: ICON_SIZE,
|
|
71
|
+
height: ICON_SIZE
|
|
72
72
|
},
|
|
73
73
|
badge: {
|
|
74
74
|
position: 'absolute',
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
badgeVertical: {
|
|
78
|
-
top: 3
|
|
79
|
-
},
|
|
80
|
-
badgeHorizontal: {
|
|
81
|
-
top: 7
|
|
75
|
+
right: -5,
|
|
76
|
+
top: -5
|
|
82
77
|
}
|
|
83
78
|
});
|
|
84
79
|
//# sourceMappingURL=TabBarIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TabBarIcon","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","
|
|
1
|
+
{"version":3,"names":["ICON_SIZE","TabBarIcon","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","styles","iconHorizontal","iconVertical","icon","opacity","focused","size","color","StyleSheet","create","position","alignSelf","alignItems","justifyContent","height","width","minWidth","right","top"],"sourceRoot":"../../../src","sources":["views/TabBarIcon.tsx"],"mappings":";;;;;;AACA;AACA;AAQA;AAAgC;AAmBhC,MAAMA,SAAS,GAAG,EAAE;AAEb,SAASC,UAAU,OAWhB;EAAA,IAXiB;IACzBC,KAAK,EAAEC,CAAC;IACRC,UAAU;IACVC,KAAK;IACLC,UAAU;IACVC,aAAa;IACbC,eAAe;IACfC,eAAe;IACfC,iBAAiB;IACjBC,UAAU;IACVC;EACK,CAAC;EACN;EACA;EACA,oBACE,6BAAC,iBAAI;IACH,KAAK,EAAE,CAACR,UAAU,GAAGS,MAAM,CAACC,cAAc,GAAGD,MAAM,CAACE,YAAY,EAAEH,KAAK;EAAE,gBAEzE,6BAAC,iBAAI;IAAC,KAAK,EAAE,CAACC,MAAM,CAACG,IAAI,EAA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|
|
5
|
+
let {
|
|
6
|
+
current
|
|
7
|
+
} = _ref;
|
|
8
|
+
return {
|
|
9
|
+
sceneStyle: {
|
|
10
|
+
opacity: current.interpolate({
|
|
11
|
+
inputRange: [-1, 0, 1],
|
|
12
|
+
outputRange: [0, 1, 0]
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Animation where the screens slightly shift to left/right
|
|
20
|
+
*/
|
|
21
|
+
export function forShifting(_ref2) {
|
|
22
|
+
let {
|
|
23
|
+
current
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return {
|
|
26
|
+
sceneStyle: {
|
|
27
|
+
opacity: current.interpolate({
|
|
28
|
+
inputRange: [-1, 0, 1],
|
|
29
|
+
outputRange: [0, 1, 0]
|
|
30
|
+
}),
|
|
31
|
+
transform: [{
|
|
32
|
+
translateX: current.interpolate({
|
|
33
|
+
inputRange: [-1, 0, 1],
|
|
34
|
+
outputRange: [-50, 1, 50]
|
|
35
|
+
})
|
|
36
|
+
}]
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=SceneStyleInterpolators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forCrossFade","current","sceneStyle","opacity","interpolate","inputRange","outputRange","forShifting","transform","translateX"],"sourceRoot":"../../../src","sources":["TransitionConfigs/SceneStyleInterpolators.tsx"],"mappings":"AAKA;AACA;AACA;AACA,OAAO,SAASA,YAAY,OAE0C;EAAA,IAFzC;IAC3BC;EACgC,CAAC;EACjC,OAAO;IACLC,UAAU,EAAE;MACVC,OAAO,EAAEF,OAAO,CAACG,WAAW,CAAC;QAC3BC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACtBC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;MACvB,CAAC;IACH;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,OAAO,SAASC,WAAW,QAE2C;EAAA,IAF1C;IAC1BN;EACgC,CAAC;EACjC,OAAO;IACLC,UAAU,EAAE;MACVC,OAAO,EAAEF,OAAO,CAACG,WAAW,CAAC;QAC3BC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACtBC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;MACvB,CAAC,CAAC;MACFE,SAAS,EAAE,CACT;QACEC,UAAU,EAAER,OAAO,CAACG,WAAW,CAAC;UAC9BC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;UACtBC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QAC1B,CAAC;MACH,CAAC;IAEL;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { forCrossFade, forShifting } from './SceneStyleInterpolators';
|
|
2
|
+
import { CrossFadeSpec, ShiftingSpec } from './TransitionSpecs';
|
|
3
|
+
export const FadeTransition = {
|
|
4
|
+
transitionSpec: CrossFadeSpec,
|
|
5
|
+
sceneStyleInterpolator: forCrossFade
|
|
6
|
+
};
|
|
7
|
+
export const ShiftingTransition = {
|
|
8
|
+
transitionSpec: ShiftingSpec,
|
|
9
|
+
sceneStyleInterpolator: forShifting
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=TransitionPresets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forCrossFade","forShifting","CrossFadeSpec","ShiftingSpec","FadeTransition","transitionSpec","sceneStyleInterpolator","ShiftingTransition"],"sourceRoot":"../../../src","sources":["TransitionConfigs/TransitionPresets.tsx"],"mappings":"AACA,SAASA,YAAY,EAAEC,WAAW,QAAQ,2BAA2B;AACrE,SAASC,aAAa,EAAEC,YAAY,QAAQ,mBAAmB;AAE/D,OAAO,MAAMC,cAAyC,GAAG;EACvDC,cAAc,EAAEH,aAAa;EAC7BI,sBAAsB,EAAEN;AAC1B,CAAC;AAED,OAAO,MAAMO,kBAA6C,GAAG;EAC3DF,cAAc,EAAEF,YAAY;EAC5BG,sBAAsB,EAAEL;AAC1B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Easing } from 'react-native';
|
|
2
|
+
export const CrossFadeSpec = {
|
|
3
|
+
animation: 'timing',
|
|
4
|
+
config: {
|
|
5
|
+
duration: 150,
|
|
6
|
+
easing: Easing.in(Easing.linear)
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export const ShiftingSpec = {
|
|
10
|
+
animation: 'timing',
|
|
11
|
+
config: {
|
|
12
|
+
duration: 150,
|
|
13
|
+
easing: Easing.inOut(Easing.ease)
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=TransitionSpecs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Easing","CrossFadeSpec","animation","config","duration","easing","in","linear","ShiftingSpec","inOut","ease"],"sourceRoot":"../../../src","sources":["TransitionConfigs/TransitionSpecs.tsx"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AAIrC,OAAO,MAAMC,aAA6B,GAAG;EAC3CC,SAAS,EAAE,QAAQ;EACnBC,MAAM,EAAE;IACNC,QAAQ,EAAE,GAAG;IACbC,MAAM,EAAEL,MAAM,CAACM,EAAE,CAACN,MAAM,CAACO,MAAM;EACjC;AACF,CAAC;AAED,OAAO,MAAMC,YAA4B,GAAG;EAC1CN,SAAS,EAAE,QAAQ;EACnBC,MAAM,EAAE;IACNC,QAAQ,EAAE,GAAG;IACbC,MAAM,EAAEL,MAAM,CAACS,KAAK,CAACT,MAAM,CAACU,IAAI;EAClC;AACF,CAAC"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import * as SceneStyleInterpolator from './TransitionConfigs/SceneStyleInterpolators';
|
|
2
|
+
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
|
|
3
|
+
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Transition Presets
|
|
7
|
+
*/
|
|
8
|
+
export { SceneStyleInterpolator, TransitionPresets, TransitionSpecs };
|
|
9
|
+
|
|
1
10
|
/**
|
|
2
11
|
* Navigators
|
|
3
12
|
*/
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createBottomTabNavigator","BottomTabBar","BottomTabView","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","useBottomTabBarHeight"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"names":["SceneStyleInterpolator","TransitionPresets","TransitionSpecs","createBottomTabNavigator","BottomTabBar","BottomTabView","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","useBottomTabBarHeight"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAO,KAAKA,sBAAsB,MAAM,6CAA6C;AACrF,OAAO,KAAKC,iBAAiB,MAAM,uCAAuC;AAC1E,OAAO,KAAKC,eAAe,MAAM,qCAAqC;;AAEtE;AACA;AACA;AACA,SAASF,sBAAsB,EAAEC,iBAAiB,EAAEC,eAAe;;AAEnE;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,uCAAuC;;AAEhF;AACA;AACA;AACA,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,aAAa,QAAQ,uBAAuB;;AAErD;AACA;AACA;AACA,SAASC,iCAAiC,QAAQ,2CAA2C;AAC7F,SAASC,yBAAyB,QAAQ,mCAAmC;AAC7E,SAASC,qBAAqB,QAAQ,+BAA+B;;AAErE;AACA;AACA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
|
+
export function useAnimatedHashMap(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
routes,
|
|
6
|
+
index
|
|
7
|
+
} = _ref;
|
|
8
|
+
const refs = React.useRef({});
|
|
9
|
+
const previous = refs.current;
|
|
10
|
+
const routeKeys = Object.keys(previous);
|
|
11
|
+
if (routes.length === routeKeys.length && routes.every(route => routeKeys.includes(route.key))) {
|
|
12
|
+
return previous;
|
|
13
|
+
}
|
|
14
|
+
refs.current = {};
|
|
15
|
+
routes.forEach((_ref2, i) => {
|
|
16
|
+
let {
|
|
17
|
+
key
|
|
18
|
+
} = _ref2;
|
|
19
|
+
refs.current[key] = previous[key] ?? new Animated.Value(i === index ? 0 : i >= index ? 1 : -1);
|
|
20
|
+
});
|
|
21
|
+
return refs.current;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=useAnimatedHashMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Animated","useAnimatedHashMap","routes","index","refs","useRef","previous","current","routeKeys","Object","keys","length","every","route","includes","key","forEach","i","Value"],"sourceRoot":"../../../src","sources":["utils/useAnimatedHashMap.tsx"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,cAAc;AAEvC,OAAO,SAASC,kBAAkB,OAAqC;EAAA,IAApC;IAAEC,MAAM;IAAEC;EAAuB,CAAC;EACnE,MAAMC,IAAI,GAAGL,KAAK,CAACM,MAAM,CAAiC,CAAC,CAAC,CAAC;EAC7D,MAAMC,QAAQ,GAAGF,IAAI,CAACG,OAAO;EAC7B,MAAMC,SAAS,GAAGC,MAAM,CAACC,IAAI,CAACJ,QAAQ,CAAC;EAEvC,IACEJ,MAAM,CAACS,MAAM,KAAKH,SAAS,CAACG,MAAM,IAClCT,MAAM,CAACU,KAAK,CAAEC,KAAK,IAAKL,SAAS,CAACM,QAAQ,CAACD,KAAK,CAACE,GAAG,CAAC,CAAC,EACtD;IACA,OAAOT,QAAQ;EACjB;EACAF,IAAI,CAACG,OAAO,GAAG,CAAC,CAAC;EAEjBL,MAAM,CAACc,OAAO,CAAC,QAAUC,CAAC,KAAK;IAAA,IAAf;MAAEF;IAAI,CAAC;IACrBX,IAAI,CAACG,OAAO,CAACQ,GAAG,CAAC,GACfT,QAAQ,CAACS,GAAG,CAAC,IACb,IAAIf,QAAQ,CAACkB,KAAK,CAACD,CAAC,KAAKd,KAAK,GAAG,CAAC,GAAGc,CAAC,IAAId,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;EAC7D,CAAC,CAAC;EAEF,OAAOC,IAAI,CAACG,OAAO;AACrB"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { MissingIcon } from '@react-navigation/elements';
|
|
1
|
+
import { getDefaultSidebarWidth, getLabel, MissingIcon } from '@react-navigation/elements';
|
|
2
2
|
import { CommonActions, NavigationContext, NavigationRouteContext, useLinkTools, useTheme } from '@react-navigation/native';
|
|
3
|
+
import Color from 'color';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
import { Animated, Platform, StyleSheet, View } from 'react-native';
|
|
5
|
-
import { useSafeAreaFrame } from 'react-native-safe-area-context';
|
|
5
|
+
import { Animated, Platform, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
6
6
|
import { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';
|
|
7
7
|
import { useIsKeyboardShown } from '../utils/useIsKeyboardShown';
|
|
8
8
|
import { BottomTabItem } from './BottomTabItem';
|
|
9
9
|
const DEFAULT_TABBAR_HEIGHT = 49;
|
|
10
10
|
const COMPACT_TABBAR_HEIGHT = 32;
|
|
11
11
|
const DEFAULT_MAX_TAB_ITEM_WIDTH = 125;
|
|
12
|
+
const SPACING = 5;
|
|
12
13
|
const useNativeDriver = Platform.OS !== 'web';
|
|
13
14
|
const shouldUseHorizontalLabels = _ref => {
|
|
14
15
|
let {
|
|
@@ -99,6 +100,7 @@ export function BottomTabBar(_ref3) {
|
|
|
99
100
|
const focusedDescriptor = descriptors[focusedRoute.key];
|
|
100
101
|
const focusedOptions = focusedDescriptor.options;
|
|
101
102
|
const {
|
|
103
|
+
tabBarPosition = 'bottom',
|
|
102
104
|
tabBarShowLabel,
|
|
103
105
|
tabBarHideOnKeyboard = false,
|
|
104
106
|
tabBarVisibilityAnimationConfig,
|
|
@@ -106,10 +108,12 @@ export function BottomTabBar(_ref3) {
|
|
|
106
108
|
tabBarBackground,
|
|
107
109
|
tabBarActiveTintColor,
|
|
108
110
|
tabBarInactiveTintColor,
|
|
109
|
-
tabBarActiveBackgroundColor,
|
|
111
|
+
tabBarActiveBackgroundColor = tabBarPosition !== 'bottom' ? Color(tabBarActiveTintColor ?? colors.primary).alpha(0.12).rgb().string() : undefined,
|
|
110
112
|
tabBarInactiveBackgroundColor
|
|
111
113
|
} = focusedOptions;
|
|
112
|
-
|
|
114
|
+
|
|
115
|
+
// FIXME: useSafeAreaFrame doesn't update values when window is resized on Web
|
|
116
|
+
const dimensions = useWindowDimensions();
|
|
113
117
|
const isKeyboardShown = useIsKeyboardShown();
|
|
114
118
|
const onHeightChange = React.useContext(BottomTabBarHeightCallbackContext);
|
|
115
119
|
const shouldShowTabBar = !(tabBarHideOnKeyboard && isKeyboardShown);
|
|
@@ -191,10 +195,10 @@ export function BottomTabBar(_ref3) {
|
|
|
191
195
|
});
|
|
192
196
|
const tabBarBackgroundElement = tabBarBackground === null || tabBarBackground === void 0 ? void 0 : tabBarBackground();
|
|
193
197
|
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
194
|
-
style: [styles.
|
|
198
|
+
style: [tabBarPosition === 'left' ? styles.left : tabBarPosition === 'right' ? styles.right : styles.bottom, {
|
|
195
199
|
backgroundColor: tabBarBackgroundElement != null ? 'transparent' : colors.card,
|
|
196
|
-
|
|
197
|
-
}, {
|
|
200
|
+
borderColor: colors.border
|
|
201
|
+
}, tabBarPosition === 'bottom' ? [{
|
|
198
202
|
transform: [{
|
|
199
203
|
translateY: visible.interpolate({
|
|
200
204
|
inputRange: [0, 1],
|
|
@@ -203,20 +207,26 @@ export function BottomTabBar(_ref3) {
|
|
|
203
207
|
}],
|
|
204
208
|
// Absolutely position the tab bar so that the content is below it
|
|
205
209
|
// This is needed to avoid gap at bottom when the tab bar is hidden
|
|
206
|
-
position: isTabBarHidden ? 'absolute' :
|
|
210
|
+
position: isTabBarHidden ? 'absolute' : undefined
|
|
207
211
|
}, {
|
|
208
212
|
height: tabBarHeight,
|
|
209
213
|
paddingBottom,
|
|
210
214
|
paddingHorizontal: Math.max(insets.left, insets.right)
|
|
215
|
+
}] : {
|
|
216
|
+
paddingTop: insets.top,
|
|
217
|
+
paddingBottom: insets.bottom,
|
|
218
|
+
paddingLeft: tabBarPosition === 'left' ? insets.left : 0,
|
|
219
|
+
paddingRight: tabBarPosition === 'right' ? insets.right : 0,
|
|
220
|
+
minWidth: hasHorizontalLabels ? getDefaultSidebarWidth(dimensions) : 0
|
|
211
221
|
}, tabBarStyle],
|
|
212
222
|
pointerEvents: isTabBarHidden ? 'none' : 'auto',
|
|
213
|
-
onLayout: handleLayout
|
|
223
|
+
onLayout: tabBarPosition === 'bottom' ? handleLayout : undefined
|
|
214
224
|
}, /*#__PURE__*/React.createElement(View, {
|
|
215
225
|
pointerEvents: "none",
|
|
216
226
|
style: StyleSheet.absoluteFill
|
|
217
227
|
}, tabBarBackgroundElement), /*#__PURE__*/React.createElement(View, {
|
|
218
228
|
accessibilityRole: "tablist",
|
|
219
|
-
style: styles.
|
|
229
|
+
style: tabBarPosition === 'bottom' ? styles.bottomContent : styles.sideContent
|
|
220
230
|
}, routes.map((route, index) => {
|
|
221
231
|
const focused = index === state.index;
|
|
222
232
|
const {
|
|
@@ -241,7 +251,10 @@ export function BottomTabBar(_ref3) {
|
|
|
241
251
|
target: route.key
|
|
242
252
|
});
|
|
243
253
|
};
|
|
244
|
-
const label = options.tabBarLabel
|
|
254
|
+
const label = typeof options.tabBarLabel === 'function' ? options.tabBarLabel : getLabel({
|
|
255
|
+
label: options.tabBarLabel,
|
|
256
|
+
title: options.title
|
|
257
|
+
}, route.name);
|
|
245
258
|
const accessibilityLabel = options.tabBarAccessibilityLabel !== undefined ? options.tabBarAccessibilityLabel : typeof label === 'string' && Platform.OS === 'ios' ? `${label}, tab, ${index + 1} of ${routes.length}` : undefined;
|
|
246
259
|
return /*#__PURE__*/React.createElement(NavigationContext.Provider, {
|
|
247
260
|
key: route.key,
|
|
@@ -280,21 +293,48 @@ export function BottomTabBar(_ref3) {
|
|
|
280
293
|
showLabel: tabBarShowLabel,
|
|
281
294
|
labelStyle: options.tabBarLabelStyle,
|
|
282
295
|
iconStyle: options.tabBarIconStyle,
|
|
283
|
-
style:
|
|
296
|
+
style: [tabBarPosition === 'bottom' ? styles.bottomItem : [styles.sideItem, hasHorizontalLabels ? {
|
|
297
|
+
justifyContent: 'flex-start'
|
|
298
|
+
} : null], options.tabBarItemStyle]
|
|
284
299
|
})));
|
|
285
300
|
})));
|
|
286
301
|
}
|
|
287
302
|
const styles = StyleSheet.create({
|
|
288
|
-
|
|
303
|
+
left: {
|
|
304
|
+
top: 0,
|
|
305
|
+
bottom: 0,
|
|
306
|
+
left: 0,
|
|
307
|
+
borderRightWidth: StyleSheet.hairlineWidth
|
|
308
|
+
},
|
|
309
|
+
right: {
|
|
310
|
+
top: 0,
|
|
311
|
+
bottom: 0,
|
|
312
|
+
right: 0,
|
|
313
|
+
borderLeftWidth: StyleSheet.hairlineWidth
|
|
314
|
+
},
|
|
315
|
+
bottom: {
|
|
289
316
|
left: 0,
|
|
290
317
|
right: 0,
|
|
291
318
|
bottom: 0,
|
|
292
319
|
borderTopWidth: StyleSheet.hairlineWidth,
|
|
293
320
|
elevation: 8
|
|
294
321
|
},
|
|
295
|
-
|
|
322
|
+
bottomContent: {
|
|
296
323
|
flex: 1,
|
|
297
324
|
flexDirection: 'row'
|
|
325
|
+
},
|
|
326
|
+
sideContent: {
|
|
327
|
+
flex: 1,
|
|
328
|
+
flexDirection: 'column',
|
|
329
|
+
padding: SPACING
|
|
330
|
+
},
|
|
331
|
+
bottomItem: {
|
|
332
|
+
flex: 1
|
|
333
|
+
},
|
|
334
|
+
sideItem: {
|
|
335
|
+
margin: SPACING,
|
|
336
|
+
padding: SPACING * 2,
|
|
337
|
+
borderRadius: 4
|
|
298
338
|
}
|
|
299
339
|
});
|
|
300
340
|
//# sourceMappingURL=BottomTabBar.js.map
|