@react-navigation/bottom-tabs 7.0.0-alpha.0 → 7.0.0-alpha.2
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/index.js +12 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createBottomTabNavigator.js +5 -6
- package/lib/commonjs/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/commonjs/utils/BottomTabBarHeightCallbackContext.js +3 -3
- package/lib/commonjs/utils/BottomTabBarHeightCallbackContext.js.map +1 -1
- package/lib/commonjs/utils/BottomTabBarHeightContext.js +3 -3
- package/lib/commonjs/utils/BottomTabBarHeightContext.js.map +1 -1
- package/lib/commonjs/utils/useBottomTabBarHeight.js +3 -4
- package/lib/commonjs/utils/useBottomTabBarHeight.js.map +1 -1
- package/lib/commonjs/utils/useIsKeyboardShown.js +1 -1
- package/lib/commonjs/utils/useIsKeyboardShown.js.map +1 -1
- package/lib/commonjs/views/Badge.js +7 -4
- package/lib/commonjs/views/Badge.js.map +1 -1
- package/lib/commonjs/views/BottomTabBar.js +7 -7
- package/lib/commonjs/views/BottomTabBar.js.map +1 -1
- package/lib/commonjs/views/BottomTabItem.js +7 -6
- package/lib/commonjs/views/BottomTabItem.js.map +1 -1
- package/lib/commonjs/views/BottomTabView.js +7 -8
- package/lib/commonjs/views/BottomTabView.js.map +1 -1
- package/lib/commonjs/views/ScreenFallback.js.map +1 -1
- package/lib/commonjs/views/TabBarIcon.js +3 -3
- package/lib/commonjs/views/TabBarIcon.js.map +1 -1
- package/lib/module/index.js +6 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createBottomTabNavigator.js +2 -2
- package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/module/utils/BottomTabBarHeightCallbackContext.js +1 -1
- package/lib/module/utils/BottomTabBarHeightCallbackContext.js.map +1 -1
- package/lib/module/utils/BottomTabBarHeightContext.js +1 -1
- package/lib/module/utils/BottomTabBarHeightContext.js.map +1 -1
- package/lib/module/utils/useBottomTabBarHeight.js +2 -2
- package/lib/module/utils/useBottomTabBarHeight.js.map +1 -1
- package/lib/module/utils/useIsKeyboardShown.js +1 -1
- package/lib/module/utils/useIsKeyboardShown.js.map +1 -1
- package/lib/module/views/Badge.js +7 -4
- package/lib/module/views/Badge.js.map +1 -1
- package/lib/module/views/BottomTabBar.js +4 -4
- package/lib/module/views/BottomTabBar.js.map +1 -1
- package/lib/module/views/BottomTabItem.js +6 -5
- package/lib/module/views/BottomTabItem.js.map +1 -1
- package/lib/module/views/BottomTabView.js +4 -4
- package/lib/module/views/BottomTabView.js.map +1 -1
- package/lib/module/views/ScreenFallback.js.map +1 -1
- package/lib/module/views/TabBarIcon.js +2 -2
- package/lib/module/views/TabBarIcon.js.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +2 -3
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/utils/BottomTabBarHeightCallbackContext.d.ts +1 -2
- package/lib/typescript/src/utils/BottomTabBarHeightCallbackContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts +1 -2
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts +1 -1
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts.map +1 -1
- package/lib/typescript/src/utils/useIsKeyboardShown.d.ts +1 -1
- package/lib/typescript/src/utils/useIsKeyboardShown.d.ts.map +1 -1
- package/lib/typescript/src/views/Badge.d.ts +1 -2
- package/lib/typescript/src/views/Badge.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabBar.d.ts +1 -2
- package/lib/typescript/src/views/BottomTabBar.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabItem.d.ts +1 -1
- package/lib/typescript/src/views/BottomTabItem.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabView.d.ts +1 -2
- package/lib/typescript/src/views/BottomTabView.d.ts.map +1 -1
- package/lib/typescript/src/views/TabBarIcon.d.ts +1 -1
- package/lib/typescript/src/views/TabBarIcon.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/index.tsx +6 -6
- package/src/navigators/createBottomTabNavigator.tsx +2 -2
- package/src/utils/BottomTabBarHeightCallbackContext.tsx +3 -3
- package/src/utils/BottomTabBarHeightContext.tsx +3 -1
- package/src/utils/useBottomTabBarHeight.tsx +2 -2
- package/src/utils/useIsKeyboardShown.tsx +1 -1
- package/src/views/Badge.tsx +4 -3
- package/src/views/BottomTabBar.tsx +4 -4
- package/src/views/BottomTabItem.tsx +5 -4
- package/src/views/BottomTabView.tsx +4 -4
- package/src/views/TabBarIcon.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/bottom-tabs",
|
|
3
3
|
"description": "Bottom tab navigator following iOS design guidelines",
|
|
4
|
-
"version": "7.0.0-alpha.
|
|
4
|
+
"version": "7.0.0-alpha.2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"clean": "del lib"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-navigation/elements": "^1.
|
|
39
|
+
"@react-navigation/elements": "^1.4.0-alpha.1",
|
|
40
40
|
"color": "^4.2.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@react-navigation/native": "^7.0.0-alpha.
|
|
43
|
+
"@react-navigation/native": "^7.0.0-alpha.2",
|
|
44
44
|
"@testing-library/react-native": "^11.5.0",
|
|
45
45
|
"@types/color": "^3.0.3",
|
|
46
|
-
"@types/react": "~18.0.
|
|
46
|
+
"@types/react": "~18.0.27",
|
|
47
47
|
"@types/react-native": "~0.70.8",
|
|
48
48
|
"del-cli": "^5.0.0",
|
|
49
|
-
"react": "18.
|
|
50
|
-
"react-native": "0.
|
|
51
|
-
"react-native-builder-bob": "^0.20.
|
|
52
|
-
"react-native-safe-area-context": "4.
|
|
53
|
-
"react-native-screens": "~3.
|
|
49
|
+
"react": "18.2.0",
|
|
50
|
+
"react-native": "0.71.8",
|
|
51
|
+
"react-native-builder-bob": "^0.20.4",
|
|
52
|
+
"react-native-safe-area-context": "4.5.0",
|
|
53
|
+
"react-native-screens": "~3.20.0",
|
|
54
54
|
"typescript": "^4.9.4"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
]
|
|
75
75
|
]
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "36c8f091556157dab74d3483651bbcbd340762ff"
|
|
78
78
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Navigators
|
|
3
3
|
*/
|
|
4
|
-
export {
|
|
4
|
+
export { createBottomTabNavigator } from './navigators/createBottomTabNavigator';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Views
|
|
8
8
|
*/
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
9
|
+
export { BottomTabBar } from './views/BottomTabBar';
|
|
10
|
+
export { BottomTabView } from './views/BottomTabView';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Utilities
|
|
14
14
|
*/
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
15
|
+
export { BottomTabBarHeightCallbackContext } from './utils/BottomTabBarHeightCallbackContext';
|
|
16
|
+
export { BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
|
|
17
|
+
export { useBottomTabBarHeight } from './utils/useBottomTabBarHeight';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Types
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
BottomTabNavigationEventMap,
|
|
16
16
|
BottomTabNavigationOptions,
|
|
17
17
|
} from '../types';
|
|
18
|
-
import BottomTabView from '../views/BottomTabView';
|
|
18
|
+
import { BottomTabView } from '../views/BottomTabView';
|
|
19
19
|
|
|
20
20
|
type Props = DefaultNavigatorOptions<
|
|
21
21
|
ParamListBase,
|
|
@@ -65,7 +65,7 @@ function BottomTabNavigator({
|
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export
|
|
68
|
+
export const createBottomTabNavigator = createNavigatorFactory<
|
|
69
69
|
TabNavigationState<ParamListBase>,
|
|
70
70
|
BottomTabNavigationOptions,
|
|
71
71
|
BottomTabNavigationEventMap,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import BottomTabBarHeightContext from './BottomTabBarHeightContext';
|
|
3
|
+
import { BottomTabBarHeightContext } from './BottomTabBarHeightContext';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function useBottomTabBarHeight() {
|
|
6
6
|
const height = React.useContext(BottomTabBarHeightContext);
|
|
7
7
|
|
|
8
8
|
if (height === undefined) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { EmitterSubscription, Keyboard, Platform } from 'react-native';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function useIsKeyboardShown() {
|
|
5
5
|
const [isKeyboardShown, setIsKeyboardShown] = React.useState(false);
|
|
6
6
|
|
|
7
7
|
React.useEffect(() => {
|
package/src/views/Badge.tsx
CHANGED
|
@@ -22,7 +22,7 @@ type Props = {
|
|
|
22
22
|
style?: Animated.WithAnimatedValue<StyleProp<TextStyle>>;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
export
|
|
25
|
+
export function Badge({
|
|
26
26
|
children,
|
|
27
27
|
style,
|
|
28
28
|
visible = true,
|
|
@@ -32,7 +32,7 @@ export default function Badge({
|
|
|
32
32
|
const [opacity] = React.useState(() => new Animated.Value(visible ? 1 : 0));
|
|
33
33
|
const [rendered, setRendered] = React.useState(visible);
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const { colors, fonts } = useTheme();
|
|
36
36
|
|
|
37
37
|
React.useEffect(() => {
|
|
38
38
|
if (!rendered) {
|
|
@@ -61,7 +61,7 @@ export default function Badge({
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// @ts-expect-error: backgroundColor definitely exists
|
|
64
|
-
const { backgroundColor =
|
|
64
|
+
const { backgroundColor = colors.notification, ...restStyle } =
|
|
65
65
|
StyleSheet.flatten(style) || {};
|
|
66
66
|
const textColor = color(backgroundColor).isLight() ? 'black' : 'white';
|
|
67
67
|
|
|
@@ -90,6 +90,7 @@ export default function Badge({
|
|
|
90
90
|
fontSize,
|
|
91
91
|
borderRadius,
|
|
92
92
|
},
|
|
93
|
+
fonts.regular,
|
|
93
94
|
styles.container,
|
|
94
95
|
restStyle,
|
|
95
96
|
]}
|
|
@@ -21,9 +21,9 @@ import {
|
|
|
21
21
|
import { EdgeInsets, useSafeAreaFrame } from 'react-native-safe-area-context';
|
|
22
22
|
|
|
23
23
|
import type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';
|
|
24
|
-
import BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';
|
|
25
|
-
import useIsKeyboardShown from '../utils/useIsKeyboardShown';
|
|
26
|
-
import BottomTabItem from './BottomTabItem';
|
|
24
|
+
import { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';
|
|
25
|
+
import { useIsKeyboardShown } from '../utils/useIsKeyboardShown';
|
|
26
|
+
import { BottomTabItem } from './BottomTabItem';
|
|
27
27
|
|
|
28
28
|
type Props = BottomTabBarProps & {
|
|
29
29
|
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
@@ -125,7 +125,7 @@ export const getTabBarHeight = ({
|
|
|
125
125
|
return DEFAULT_TABBAR_HEIGHT + paddingBottom;
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
export
|
|
128
|
+
export function BottomTabBar({
|
|
129
129
|
state,
|
|
130
130
|
navigation,
|
|
131
131
|
descriptors,
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
BottomTabDescriptor,
|
|
18
18
|
LabelPosition,
|
|
19
19
|
} from '../types';
|
|
20
|
-
import TabBarIcon from './TabBarIcon';
|
|
20
|
+
import { TabBarIcon } from './TabBarIcon';
|
|
21
21
|
|
|
22
22
|
type Props = {
|
|
23
23
|
/**
|
|
@@ -128,7 +128,7 @@ type Props = {
|
|
|
128
128
|
style?: StyleProp<ViewStyle>;
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
export
|
|
131
|
+
export function BottomTabItem({
|
|
132
132
|
route,
|
|
133
133
|
href,
|
|
134
134
|
focused,
|
|
@@ -195,7 +195,7 @@ export default function BottomTabItem({
|
|
|
195
195
|
iconStyle,
|
|
196
196
|
style,
|
|
197
197
|
}: Props) {
|
|
198
|
-
const { colors } = useTheme();
|
|
198
|
+
const { colors, fonts } = useTheme();
|
|
199
199
|
|
|
200
200
|
const activeTintColor =
|
|
201
201
|
customActiveTintColor === undefined
|
|
@@ -219,8 +219,9 @@ export default function BottomTabItem({
|
|
|
219
219
|
<Text
|
|
220
220
|
numberOfLines={1}
|
|
221
221
|
style={[
|
|
222
|
-
styles.label,
|
|
223
222
|
{ color },
|
|
223
|
+
fonts.regular,
|
|
224
|
+
styles.label,
|
|
224
225
|
horizontal ? styles.labelBeside : styles.labelBeneath,
|
|
225
226
|
labelStyle,
|
|
226
227
|
]}
|
|
@@ -20,9 +20,9 @@ import type {
|
|
|
20
20
|
BottomTabNavigationHelpers,
|
|
21
21
|
BottomTabNavigationProp,
|
|
22
22
|
} from '../types';
|
|
23
|
-
import BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';
|
|
24
|
-
import BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';
|
|
25
|
-
import BottomTabBar,
|
|
23
|
+
import { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';
|
|
24
|
+
import { BottomTabBarHeightContext } from '../utils/BottomTabBarHeightContext';
|
|
25
|
+
import { BottomTabBar, getTabBarHeight } from './BottomTabBar';
|
|
26
26
|
import { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';
|
|
27
27
|
|
|
28
28
|
type Props = BottomTabNavigationConfig & {
|
|
@@ -31,7 +31,7 @@ type Props = BottomTabNavigationConfig & {
|
|
|
31
31
|
descriptors: BottomTabDescriptorMap;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
export
|
|
34
|
+
export function BottomTabView(props: Props) {
|
|
35
35
|
const {
|
|
36
36
|
tabBar = (props: BottomTabBarProps) => <BottomTabBar {...props} />,
|
|
37
37
|
state,
|
package/src/views/TabBarIcon.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
ViewStyle,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
|
|
11
|
-
import Badge from './Badge';
|
|
11
|
+
import { Badge } from './Badge';
|
|
12
12
|
|
|
13
13
|
type Props = {
|
|
14
14
|
route: Route<string>;
|
|
@@ -27,7 +27,7 @@ type Props = {
|
|
|
27
27
|
style: StyleProp<ViewStyle>;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export
|
|
30
|
+
export function TabBarIcon({
|
|
31
31
|
route: _,
|
|
32
32
|
horizontal,
|
|
33
33
|
badge,
|