@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.
Files changed (80) hide show
  1. package/lib/commonjs/index.js +12 -13
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/navigators/createBottomTabNavigator.js +5 -6
  4. package/lib/commonjs/navigators/createBottomTabNavigator.js.map +1 -1
  5. package/lib/commonjs/utils/BottomTabBarHeightCallbackContext.js +3 -3
  6. package/lib/commonjs/utils/BottomTabBarHeightCallbackContext.js.map +1 -1
  7. package/lib/commonjs/utils/BottomTabBarHeightContext.js +3 -3
  8. package/lib/commonjs/utils/BottomTabBarHeightContext.js.map +1 -1
  9. package/lib/commonjs/utils/useBottomTabBarHeight.js +3 -4
  10. package/lib/commonjs/utils/useBottomTabBarHeight.js.map +1 -1
  11. package/lib/commonjs/utils/useIsKeyboardShown.js +1 -1
  12. package/lib/commonjs/utils/useIsKeyboardShown.js.map +1 -1
  13. package/lib/commonjs/views/Badge.js +7 -4
  14. package/lib/commonjs/views/Badge.js.map +1 -1
  15. package/lib/commonjs/views/BottomTabBar.js +7 -7
  16. package/lib/commonjs/views/BottomTabBar.js.map +1 -1
  17. package/lib/commonjs/views/BottomTabItem.js +7 -6
  18. package/lib/commonjs/views/BottomTabItem.js.map +1 -1
  19. package/lib/commonjs/views/BottomTabView.js +7 -8
  20. package/lib/commonjs/views/BottomTabView.js.map +1 -1
  21. package/lib/commonjs/views/ScreenFallback.js.map +1 -1
  22. package/lib/commonjs/views/TabBarIcon.js +3 -3
  23. package/lib/commonjs/views/TabBarIcon.js.map +1 -1
  24. package/lib/module/index.js +6 -6
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/module/navigators/createBottomTabNavigator.js +2 -2
  27. package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
  28. package/lib/module/utils/BottomTabBarHeightCallbackContext.js +1 -1
  29. package/lib/module/utils/BottomTabBarHeightCallbackContext.js.map +1 -1
  30. package/lib/module/utils/BottomTabBarHeightContext.js +1 -1
  31. package/lib/module/utils/BottomTabBarHeightContext.js.map +1 -1
  32. package/lib/module/utils/useBottomTabBarHeight.js +2 -2
  33. package/lib/module/utils/useBottomTabBarHeight.js.map +1 -1
  34. package/lib/module/utils/useIsKeyboardShown.js +1 -1
  35. package/lib/module/utils/useIsKeyboardShown.js.map +1 -1
  36. package/lib/module/views/Badge.js +7 -4
  37. package/lib/module/views/Badge.js.map +1 -1
  38. package/lib/module/views/BottomTabBar.js +4 -4
  39. package/lib/module/views/BottomTabBar.js.map +1 -1
  40. package/lib/module/views/BottomTabItem.js +6 -5
  41. package/lib/module/views/BottomTabItem.js.map +1 -1
  42. package/lib/module/views/BottomTabView.js +4 -4
  43. package/lib/module/views/BottomTabView.js.map +1 -1
  44. package/lib/module/views/ScreenFallback.js.map +1 -1
  45. package/lib/module/views/TabBarIcon.js +2 -2
  46. package/lib/module/views/TabBarIcon.js.map +1 -1
  47. package/lib/typescript/src/index.d.ts +6 -6
  48. package/lib/typescript/src/index.d.ts.map +1 -1
  49. package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +2 -3
  50. package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
  51. package/lib/typescript/src/utils/BottomTabBarHeightCallbackContext.d.ts +1 -2
  52. package/lib/typescript/src/utils/BottomTabBarHeightCallbackContext.d.ts.map +1 -1
  53. package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts +1 -2
  54. package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts.map +1 -1
  55. package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts +1 -1
  56. package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts.map +1 -1
  57. package/lib/typescript/src/utils/useIsKeyboardShown.d.ts +1 -1
  58. package/lib/typescript/src/utils/useIsKeyboardShown.d.ts.map +1 -1
  59. package/lib/typescript/src/views/Badge.d.ts +1 -2
  60. package/lib/typescript/src/views/Badge.d.ts.map +1 -1
  61. package/lib/typescript/src/views/BottomTabBar.d.ts +1 -2
  62. package/lib/typescript/src/views/BottomTabBar.d.ts.map +1 -1
  63. package/lib/typescript/src/views/BottomTabItem.d.ts +1 -1
  64. package/lib/typescript/src/views/BottomTabItem.d.ts.map +1 -1
  65. package/lib/typescript/src/views/BottomTabView.d.ts +1 -2
  66. package/lib/typescript/src/views/BottomTabView.d.ts.map +1 -1
  67. package/lib/typescript/src/views/TabBarIcon.d.ts +1 -1
  68. package/lib/typescript/src/views/TabBarIcon.d.ts.map +1 -1
  69. package/package.json +10 -10
  70. package/src/index.tsx +6 -6
  71. package/src/navigators/createBottomTabNavigator.tsx +2 -2
  72. package/src/utils/BottomTabBarHeightCallbackContext.tsx +3 -3
  73. package/src/utils/BottomTabBarHeightContext.tsx +3 -1
  74. package/src/utils/useBottomTabBarHeight.tsx +2 -2
  75. package/src/utils/useIsKeyboardShown.tsx +1 -1
  76. package/src/views/Badge.tsx +4 -3
  77. package/src/views/BottomTabBar.tsx +4 -4
  78. package/src/views/BottomTabItem.tsx +5 -4
  79. package/src/views/BottomTabView.tsx +4 -4
  80. 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.0",
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.3.9-alpha.0",
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.0",
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.26",
46
+ "@types/react": "~18.0.27",
47
47
  "@types/react-native": "~0.70.8",
48
48
  "del-cli": "^5.0.0",
49
- "react": "18.1.0",
50
- "react-native": "0.70.5",
51
- "react-native-builder-bob": "^0.20.3",
52
- "react-native-safe-area-context": "4.4.1",
53
- "react-native-screens": "~3.18.0",
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": "ad722b882e0c40b1d1bc025d70112ddb126f265e"
77
+ "gitHead": "36c8f091556157dab74d3483651bbcbd340762ff"
78
78
  }
package/src/index.tsx CHANGED
@@ -1,20 +1,20 @@
1
1
  /**
2
2
  * Navigators
3
3
  */
4
- export { default as createBottomTabNavigator } from './navigators/createBottomTabNavigator';
4
+ export { createBottomTabNavigator } from './navigators/createBottomTabNavigator';
5
5
 
6
6
  /**
7
7
  * Views
8
8
  */
9
- export { default as BottomTabBar } from './views/BottomTabBar';
10
- export { default as BottomTabView } from './views/BottomTabView';
9
+ export { BottomTabBar } from './views/BottomTabBar';
10
+ export { BottomTabView } from './views/BottomTabView';
11
11
 
12
12
  /**
13
13
  * Utilities
14
14
  */
15
- export { default as BottomTabBarHeightCallbackContext } from './utils/BottomTabBarHeightCallbackContext';
16
- export { default as BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
17
- export { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight';
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 default createNavigatorFactory<
68
+ export const createBottomTabNavigator = createNavigatorFactory<
69
69
  TabNavigationState<ParamListBase>,
70
70
  BottomTabNavigationOptions,
71
71
  BottomTabNavigationEventMap,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
 
3
- export default React.createContext<((height: number) => void) | undefined>(
4
- undefined
5
- );
3
+ export const BottomTabBarHeightCallbackContext = React.createContext<
4
+ ((height: number) => void) | undefined
5
+ >(undefined);
@@ -1,3 +1,5 @@
1
1
  import * as React from 'react';
2
2
 
3
- export default React.createContext<number | undefined>(undefined);
3
+ export const BottomTabBarHeightContext = React.createContext<
4
+ number | undefined
5
+ >(undefined);
@@ -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 default function useBottomTabBarHeight() {
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 default function useIsKeyboardShown() {
4
+ export function useIsKeyboardShown() {
5
5
  const [isKeyboardShown, setIsKeyboardShown] = React.useState(false);
6
6
 
7
7
  React.useEffect(() => {
@@ -22,7 +22,7 @@ type Props = {
22
22
  style?: Animated.WithAnimatedValue<StyleProp<TextStyle>>;
23
23
  };
24
24
 
25
- export default function Badge({
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 theme = useTheme();
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 = theme.colors.notification, ...restStyle } =
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 default function BottomTabBar({
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 default function BottomTabItem({
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, { getTabBarHeight } from './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 default function BottomTabView(props: Props) {
34
+ export function BottomTabView(props: Props) {
35
35
  const {
36
36
  tabBar = (props: BottomTabBarProps) => <BottomTabBar {...props} />,
37
37
  state,
@@ -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 default function TabBarIcon({
30
+ export function TabBarIcon({
31
31
  route: _,
32
32
  horizontal,
33
33
  badge,