@react-navigation/bottom-tabs 7.0.0-alpha.1 → 7.0.0-alpha.11
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 +5 -4
- 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 +63 -25
- 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 +100 -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 +2 -0
- 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 +66 -28
- 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 +99 -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 +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +4 -4
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +57 -3
- 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 -3
- package/lib/typescript/src/views/Badge.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabBar.d.ts +5 -5
- 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 -2
- 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 +18 -19
- 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/navigators/createBottomTabNavigator.tsx +7 -5
- package/src/types.tsx +82 -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 +123 -45
- package/src/views/BottomTabItem.tsx +51 -81
- package/src/views/BottomTabView.tsx +131 -14
- package/src/views/ScreenFallback.tsx +12 -13
- package/src/views/TabBarIcon.tsx +16 -24
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { ResourceSavingView } from '@react-navigation/elements';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
type StyleProp,
|
|
5
|
+
View,
|
|
6
|
+
type ViewProps,
|
|
7
|
+
type ViewStyle,
|
|
8
|
+
} from 'react-native';
|
|
4
9
|
|
|
5
10
|
type Props = {
|
|
6
|
-
visible: boolean;
|
|
7
|
-
children: React.ReactNode;
|
|
8
11
|
enabled: boolean;
|
|
12
|
+
active: 0 | 1 | 2 | Animated.AnimatedInterpolation<0 | 1>;
|
|
13
|
+
children: React.ReactNode;
|
|
9
14
|
freezeOnBlur?: boolean;
|
|
10
15
|
style?: StyleProp<ViewStyle>;
|
|
11
16
|
};
|
|
@@ -33,18 +38,12 @@ export const MaybeScreenContainer = ({
|
|
|
33
38
|
return <View {...rest} />;
|
|
34
39
|
};
|
|
35
40
|
|
|
36
|
-
export function MaybeScreen({
|
|
41
|
+
export function MaybeScreen({ enabled, active, ...rest }: ViewProps & Props) {
|
|
37
42
|
if (Screens?.screensEnabled?.()) {
|
|
38
43
|
return (
|
|
39
|
-
<Screens.Screen activityState={
|
|
40
|
-
{children}
|
|
41
|
-
</Screens.Screen>
|
|
44
|
+
<Screens.Screen enabled={enabled} activityState={active} {...rest} />
|
|
42
45
|
);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
return
|
|
46
|
-
<ResourceSavingView visible={visible} {...rest}>
|
|
47
|
-
{children}
|
|
48
|
-
</ResourceSavingView>
|
|
49
|
-
);
|
|
48
|
+
return <View {...rest} />;
|
|
50
49
|
}
|
package/src/views/TabBarIcon.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Route } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import {
|
|
4
|
-
StyleProp,
|
|
4
|
+
type StyleProp,
|
|
5
5
|
StyleSheet,
|
|
6
|
-
TextStyle,
|
|
6
|
+
type TextStyle,
|
|
7
7
|
View,
|
|
8
|
-
ViewStyle,
|
|
8
|
+
type ViewStyle,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
|
|
11
11
|
import { Badge } from './Badge';
|
|
@@ -27,6 +27,8 @@ type Props = {
|
|
|
27
27
|
style: StyleProp<ViewStyle>;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const ICON_SIZE = 25;
|
|
31
|
+
|
|
30
32
|
export function TabBarIcon({
|
|
31
33
|
route: _,
|
|
32
34
|
horizontal,
|
|
@@ -39,8 +41,6 @@ export function TabBarIcon({
|
|
|
39
41
|
renderIcon,
|
|
40
42
|
style,
|
|
41
43
|
}: Props) {
|
|
42
|
-
const size = 25;
|
|
43
|
-
|
|
44
44
|
// We render the icon twice at the same position on top of each other:
|
|
45
45
|
// active and inactive one, so we can fade between them.
|
|
46
46
|
return (
|
|
@@ -50,25 +50,21 @@ export function TabBarIcon({
|
|
|
50
50
|
<View style={[styles.icon, { opacity: activeOpacity }]}>
|
|
51
51
|
{renderIcon({
|
|
52
52
|
focused: true,
|
|
53
|
-
size,
|
|
53
|
+
size: ICON_SIZE,
|
|
54
54
|
color: activeTintColor,
|
|
55
55
|
})}
|
|
56
56
|
</View>
|
|
57
57
|
<View style={[styles.icon, { opacity: inactiveOpacity }]}>
|
|
58
58
|
{renderIcon({
|
|
59
59
|
focused: false,
|
|
60
|
-
size,
|
|
60
|
+
size: ICON_SIZE,
|
|
61
61
|
color: inactiveTintColor,
|
|
62
62
|
})}
|
|
63
63
|
</View>
|
|
64
64
|
<Badge
|
|
65
65
|
visible={badge != null}
|
|
66
|
-
style={[
|
|
67
|
-
|
|
68
|
-
horizontal ? styles.badgeHorizontal : styles.badgeVertical,
|
|
69
|
-
badgeStyle,
|
|
70
|
-
]}
|
|
71
|
-
size={(size * 3) / 4}
|
|
66
|
+
style={[styles.badge, badgeStyle]}
|
|
67
|
+
size={ICON_SIZE * 0.75}
|
|
72
68
|
>
|
|
73
69
|
{badge}
|
|
74
70
|
</Badge>
|
|
@@ -88,23 +84,19 @@ const styles = StyleSheet.create({
|
|
|
88
84
|
height: '100%',
|
|
89
85
|
width: '100%',
|
|
90
86
|
// Workaround for react-native >= 0.54 layout bug
|
|
91
|
-
minWidth:
|
|
87
|
+
minWidth: ICON_SIZE,
|
|
92
88
|
},
|
|
93
89
|
iconVertical: {
|
|
94
|
-
|
|
90
|
+
width: ICON_SIZE,
|
|
91
|
+
height: ICON_SIZE,
|
|
95
92
|
},
|
|
96
93
|
iconHorizontal: {
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
width: ICON_SIZE,
|
|
95
|
+
height: ICON_SIZE,
|
|
99
96
|
},
|
|
100
97
|
badge: {
|
|
101
98
|
position: 'absolute',
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
badgeVertical: {
|
|
105
|
-
top: 3,
|
|
106
|
-
},
|
|
107
|
-
badgeHorizontal: {
|
|
108
|
-
top: 7,
|
|
99
|
+
right: -5,
|
|
100
|
+
top: -5,
|
|
109
101
|
},
|
|
110
102
|
});
|