@react-navigation/bottom-tabs 7.0.0-alpha.4 → 7.0.0-alpha.6
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 +1 -1
- package/lib/commonjs/TransitionConfigs/SceneStyleInterpolators.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js +2 -4
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +2 -4
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +1 -1
- package/lib/commonjs/index.js +2 -2
- 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 +2 -2
- package/lib/commonjs/utils/useAnimatedHashMap.js.map +1 -1
- 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 +8 -11
- package/lib/commonjs/views/BottomTabBar.js.map +1 -1
- package/lib/commonjs/views/BottomTabItem.js +12 -28
- package/lib/commonjs/views/BottomTabItem.js.map +1 -1
- package/lib/commonjs/views/BottomTabView.js +8 -9
- package/lib/commonjs/views/BottomTabView.js.map +1 -1
- package/lib/commonjs/views/ScreenFallback.js +4 -6
- package/lib/commonjs/views/ScreenFallback.js.map +1 -1
- package/lib/commonjs/views/TabBarIcon.js.map +1 -1
- package/lib/module/TransitionConfigs/SceneStyleInterpolators.js +1 -1
- package/lib/module/TransitionConfigs/SceneStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
- 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.map +1 -1
- 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 +8 -11
- package/lib/module/views/BottomTabBar.js.map +1 -1
- package/lib/module/views/BottomTabItem.js +15 -31
- package/lib/module/views/BottomTabItem.js.map +1 -1
- package/lib/module/views/BottomTabView.js +6 -7
- package/lib/module/views/BottomTabView.js.map +1 -1
- package/lib/module/views/ScreenFallback.js +2 -4
- package/lib/module/views/ScreenFallback.js.map +1 -1
- package/lib/module/views/TabBarIcon.js.map +1 -1
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +4 -3
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +3 -3
- package/lib/typescript/src/types.d.ts.map +1 -1
- 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 +4 -3
- 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 +3 -3
- 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 +16 -17
- package/src/TransitionConfigs/SceneStyleInterpolators.tsx +1 -1
- package/src/navigators/createBottomTabNavigator.tsx +7 -5
- package/src/types.tsx +7 -5
- package/src/utils/useIsKeyboardShown.tsx +1 -1
- package/src/views/Badge.tsx +6 -1
- package/src/views/BottomTabBar.tsx +10 -7
- package/src/views/BottomTabItem.tsx +21 -45
- package/src/views/BottomTabView.tsx +1 -2
- package/src/views/ScreenFallback.tsx +7 -1
- package/src/views/TabBarIcon.tsx +3 -3
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
CommonActions,
|
|
8
8
|
NavigationContext,
|
|
9
9
|
NavigationRouteContext,
|
|
10
|
-
ParamListBase,
|
|
11
|
-
TabNavigationState,
|
|
10
|
+
type ParamListBase,
|
|
11
|
+
type TabNavigationState,
|
|
12
12
|
useLinkTools,
|
|
13
13
|
useTheme,
|
|
14
14
|
} from '@react-navigation/native';
|
|
@@ -16,13 +16,13 @@ import Color from 'color';
|
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import {
|
|
18
18
|
Animated,
|
|
19
|
-
LayoutChangeEvent,
|
|
19
|
+
type LayoutChangeEvent,
|
|
20
20
|
Platform,
|
|
21
|
-
StyleProp,
|
|
21
|
+
type StyleProp,
|
|
22
22
|
StyleSheet,
|
|
23
23
|
useWindowDimensions,
|
|
24
24
|
View,
|
|
25
|
-
ViewStyle,
|
|
25
|
+
type ViewStyle,
|
|
26
26
|
} from 'react-native';
|
|
27
27
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
28
28
|
|
|
@@ -104,8 +104,11 @@ export const getTabBarHeight = ({
|
|
|
104
104
|
insets: EdgeInsets;
|
|
105
105
|
style: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;
|
|
106
106
|
}) => {
|
|
107
|
-
|
|
108
|
-
const customHeight =
|
|
107
|
+
const flattenedStyle = StyleSheet.flatten(style);
|
|
108
|
+
const customHeight =
|
|
109
|
+
flattenedStyle && 'height' in flattenedStyle
|
|
110
|
+
? flattenedStyle.height
|
|
111
|
+
: undefined;
|
|
109
112
|
|
|
110
113
|
if (typeof customHeight === 'number') {
|
|
111
114
|
return customHeight;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { getLabel, Label } from '@react-navigation/elements';
|
|
2
|
-
import {
|
|
1
|
+
import { getLabel, Label, PlatformPressable } from '@react-navigation/elements';
|
|
2
|
+
import { type Route, useTheme } from '@react-navigation/native';
|
|
3
3
|
import Color from 'color';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import {
|
|
6
|
-
GestureResponderEvent,
|
|
6
|
+
type GestureResponderEvent,
|
|
7
7
|
Platform,
|
|
8
|
-
|
|
9
|
-
StyleProp,
|
|
8
|
+
type StyleProp,
|
|
10
9
|
StyleSheet,
|
|
11
|
-
TextStyle,
|
|
12
|
-
ViewStyle,
|
|
10
|
+
type TextStyle,
|
|
11
|
+
type ViewStyle,
|
|
13
12
|
} from 'react-native';
|
|
14
13
|
|
|
15
14
|
import type {
|
|
@@ -64,7 +63,7 @@ type Props = {
|
|
|
64
63
|
*/
|
|
65
64
|
badgeStyle?: StyleProp<TextStyle>;
|
|
66
65
|
/**
|
|
67
|
-
* The button for the tab. Uses a `
|
|
66
|
+
* The button for the tab. Uses a `Pressable` by default.
|
|
68
67
|
*/
|
|
69
68
|
button?: (props: BottomTabBarButtonProps) => React.ReactNode;
|
|
70
69
|
/**
|
|
@@ -145,40 +144,19 @@ export function BottomTabItem({
|
|
|
145
144
|
accessibilityRole,
|
|
146
145
|
...rest
|
|
147
146
|
}: BottomTabBarButtonProps) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
) {
|
|
162
|
-
e.preventDefault();
|
|
163
|
-
onPress?.(e);
|
|
164
|
-
}
|
|
165
|
-
}}
|
|
166
|
-
>
|
|
167
|
-
{children}
|
|
168
|
-
</Link>
|
|
169
|
-
);
|
|
170
|
-
} else {
|
|
171
|
-
return (
|
|
172
|
-
<Pressable
|
|
173
|
-
{...rest}
|
|
174
|
-
accessibilityRole={accessibilityRole}
|
|
175
|
-
onPress={onPress}
|
|
176
|
-
style={style}
|
|
177
|
-
>
|
|
178
|
-
{children}
|
|
179
|
-
</Pressable>
|
|
180
|
-
);
|
|
181
|
-
}
|
|
147
|
+
return (
|
|
148
|
+
<PlatformPressable
|
|
149
|
+
{...rest}
|
|
150
|
+
android_ripple={{ borderless: true }}
|
|
151
|
+
pressOpacity={1}
|
|
152
|
+
href={href}
|
|
153
|
+
accessibilityRole={accessibilityRole}
|
|
154
|
+
onPress={onPress}
|
|
155
|
+
style={style}
|
|
156
|
+
>
|
|
157
|
+
{children}
|
|
158
|
+
</PlatformPressable>
|
|
159
|
+
);
|
|
182
160
|
},
|
|
183
161
|
accessibilityLabel,
|
|
184
162
|
testID,
|
|
@@ -242,6 +220,7 @@ export function BottomTabItem({
|
|
|
242
220
|
labelStyle,
|
|
243
221
|
]}
|
|
244
222
|
allowFontScaling={allowFontScaling}
|
|
223
|
+
tintColor={color}
|
|
245
224
|
>
|
|
246
225
|
{label}
|
|
247
226
|
</Label>
|
|
@@ -323,7 +302,4 @@ const styles = StyleSheet.create({
|
|
|
323
302
|
fontSize: 13,
|
|
324
303
|
marginLeft: 20,
|
|
325
304
|
},
|
|
326
|
-
button: {
|
|
327
|
-
display: 'flex',
|
|
328
|
-
},
|
|
329
305
|
});
|
|
@@ -26,7 +26,6 @@ import { BottomTabBarHeightContext } from '../utils/BottomTabBarHeightContext';
|
|
|
26
26
|
import { useAnimatedHashMap } from '../utils/useAnimatedHashMap';
|
|
27
27
|
import { BottomTabBar, getTabBarHeight } from './BottomTabBar';
|
|
28
28
|
import { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';
|
|
29
|
-
import CompositeAnimation = Animated.CompositeAnimation;
|
|
30
29
|
|
|
31
30
|
type Props = BottomTabNavigationConfig & {
|
|
32
31
|
state: TabNavigationState<ParamListBase>;
|
|
@@ -102,7 +101,7 @@ export function BottomTabView(props: Props) {
|
|
|
102
101
|
useNativeDriver: true,
|
|
103
102
|
});
|
|
104
103
|
})
|
|
105
|
-
.filter(Boolean) as CompositeAnimation[]
|
|
104
|
+
.filter(Boolean) as Animated.CompositeAnimation[]
|
|
106
105
|
).start();
|
|
107
106
|
};
|
|
108
107
|
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
type StyleProp,
|
|
5
|
+
View,
|
|
6
|
+
type ViewProps,
|
|
7
|
+
type ViewStyle,
|
|
8
|
+
} from 'react-native';
|
|
3
9
|
|
|
4
10
|
type Props = {
|
|
5
11
|
enabled: boolean;
|
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';
|