@react-navigation/bottom-tabs 7.0.0-alpha.1 → 7.0.0-alpha.10
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,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { Animated, StyleProp, ViewStyle } from 'react-native';
|
|
4
|
-
import { EdgeInsets } from 'react-native-safe-area-context';
|
|
1
|
+
import { type ParamListBase, type TabNavigationState } from '@react-navigation/native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Animated, type StyleProp, type ViewStyle } from 'react-native';
|
|
4
|
+
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
5
5
|
import type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';
|
|
6
6
|
type Props = BottomTabBarProps & {
|
|
7
7
|
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
@@ -22,6 +22,6 @@ export declare const getTabBarHeight: ({ state, descriptors, dimensions, insets,
|
|
|
22
22
|
insets: EdgeInsets;
|
|
23
23
|
style: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;
|
|
24
24
|
}) => number;
|
|
25
|
-
export declare function BottomTabBar({ state, navigation, descriptors, insets, style, }: Props): JSX.Element;
|
|
25
|
+
export declare function BottomTabBar({ state, navigation, descriptors, insets, style, }: Props): React.JSX.Element;
|
|
26
26
|
export {};
|
|
27
27
|
//# sourceMappingURL=BottomTabBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomTabBar.d.ts","sourceRoot":"","sources":["../../../../src/views/BottomTabBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomTabBar.d.ts","sourceRoot":"","sources":["../../../../src/views/BottomTabBar.tsx"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EAGxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EAGR,KAAK,SAAS,EAId,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAK1E,KAAK,KAAK,GAAG,iBAAiB,GAAG;IAC/B,KAAK,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;CAC1D,CAAC;AASF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,WAAW,EAAE,sBAAsB,CAAC;IACpC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C,CAAC;AA8CF,eAAO,MAAM,eAAe;YAQlB,UAAU;WACX,SAAS,iBAAiB,CAAC,UAAU,SAAS,CAAC,CAAC,GAAG,SAAS;YA+BpE,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,UAAU,EACV,WAAW,EACX,MAAM,EACN,KAAK,GACN,EAAE,KAAK,qBA+RP"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Route } from '@react-navigation/native';
|
|
1
|
+
import { type Route } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { GestureResponderEvent, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
import { type GestureResponderEvent, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
4
4
|
import type { BottomTabBarButtonProps, BottomTabDescriptor, LabelPosition } from '../types';
|
|
5
5
|
type Props = {
|
|
6
6
|
/**
|
|
@@ -45,7 +45,7 @@ type Props = {
|
|
|
45
45
|
*/
|
|
46
46
|
badgeStyle?: StyleProp<TextStyle>;
|
|
47
47
|
/**
|
|
48
|
-
* The button for the tab. Uses a `
|
|
48
|
+
* The button for the tab. Uses a `Pressable` by default.
|
|
49
49
|
*/
|
|
50
50
|
button?: (props: BottomTabBarButtonProps) => React.ReactNode;
|
|
51
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomTabItem.d.ts","sourceRoot":"","sources":["../../../../src/views/BottomTabItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomTabItem.d.ts","sourceRoot":"","sources":["../../../../src/views/BottomTabItem.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { ParamListBase, TabNavigationState } from '@react-navigation/native';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import type { BottomTabDescriptorMap, BottomTabNavigationConfig, BottomTabNavigationHelpers } from '../types';
|
|
4
4
|
type Props = BottomTabNavigationConfig & {
|
|
5
5
|
state: TabNavigationState<ParamListBase>;
|
|
6
6
|
navigation: BottomTabNavigationHelpers;
|
|
7
7
|
descriptors: BottomTabDescriptorMap;
|
|
8
8
|
};
|
|
9
|
-
export declare function BottomTabView(props: Props): JSX.Element;
|
|
9
|
+
export declare function BottomTabView(props: Props): React.JSX.Element;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=BottomTabView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomTabView.d.ts","sourceRoot":"","sources":["../../../../src/views/BottomTabView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomTabView.d.ts","sourceRoot":"","sources":["../../../../src/views/BottomTabView.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAEV,sBAAsB,EAEtB,yBAAyB,EACzB,0BAA0B,EAG3B,MAAM,UAAU,CAAC;AAOlB,KAAK,KAAK,GAAG,yBAAyB,GAAG;IACvC,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,0BAA0B,CAAC;IACvC,WAAW,EAAE,sBAAsB,CAAC;CACrC,CAAC;AAiBF,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,qBA+NzC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
import { Animated, type StyleProp, type ViewProps, type ViewStyle } from 'react-native';
|
|
3
3
|
type Props = {
|
|
4
|
-
visible: boolean;
|
|
5
|
-
children: React.ReactNode;
|
|
6
4
|
enabled: boolean;
|
|
5
|
+
active: 0 | 1 | 2 | Animated.AnimatedInterpolation<0 | 1>;
|
|
6
|
+
children: React.ReactNode;
|
|
7
7
|
freezeOnBlur?: boolean;
|
|
8
8
|
style?: StyleProp<ViewStyle>;
|
|
9
9
|
};
|
|
@@ -11,7 +11,7 @@ export declare const MaybeScreenContainer: ({ enabled, ...rest }: ViewProps & {
|
|
|
11
11
|
enabled: boolean;
|
|
12
12
|
hasTwoStates: boolean;
|
|
13
13
|
children: React.ReactNode;
|
|
14
|
-
}) => JSX.Element;
|
|
15
|
-
export declare function MaybeScreen({
|
|
14
|
+
}) => React.JSX.Element;
|
|
15
|
+
export declare function MaybeScreen({ enabled, active, ...rest }: ViewProps & Props): React.JSX.Element;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=ScreenFallback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenFallback.d.ts","sourceRoot":"","sources":["../../../../src/views/ScreenFallback.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScreenFallback.d.ts","sourceRoot":"","sources":["../../../../src/views/ScreenFallback.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,KAAK,SAAS,EAEd,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAUF,eAAO,MAAM,oBAAoB;aAItB,OAAO;kBACF,OAAO;cACX,MAAM,SAAS;uBAO1B,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,GAAG,KAAK,qBAQ1E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Route } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
4
4
|
type Props = {
|
|
5
5
|
route: Route<string>;
|
|
6
6
|
horizontal: boolean;
|
|
@@ -17,6 +17,6 @@ type Props = {
|
|
|
17
17
|
}) => React.ReactNode;
|
|
18
18
|
style: StyleProp<ViewStyle>;
|
|
19
19
|
};
|
|
20
|
-
export declare function TabBarIcon({ route, horizontal, badge, badgeStyle, activeOpacity, inactiveOpacity, activeTintColor, inactiveTintColor, renderIcon, style, }: Props): JSX.Element;
|
|
20
|
+
export declare function TabBarIcon({ route, horizontal, badge, badgeStyle, activeOpacity, inactiveOpacity, activeTintColor, inactiveTintColor, renderIcon, style, }: Props): React.JSX.Element;
|
|
21
21
|
export {};
|
|
22
22
|
//# sourceMappingURL=TabBarIcon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBarIcon.d.ts","sourceRoot":"","sources":["../../../../src/views/TabBarIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,SAAS,
|
|
1
|
+
{"version":3,"file":"TabBarIcon.d.ts","sourceRoot":"","sources":["../../../../src/views/TabBarIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAItB,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,CAAC,KAAK,EAAE;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC7B,CAAC;AAIF,wBAAgB,UAAU,CAAC,EACzB,KAAQ,EACR,UAAU,EACV,KAAK,EACL,UAAU,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,KAAK,GACN,EAAE,KAAK,qBA8BP"}
|
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.10",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -36,29 +36,28 @@
|
|
|
36
36
|
"clean": "del lib"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-navigation/elements": "^
|
|
39
|
+
"@react-navigation/elements": "^2.0.0-alpha.7",
|
|
40
40
|
"color": "^4.2.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@react-navigation/native": "^7.0.0-alpha.
|
|
44
|
-
"@testing-library/react-native": "^
|
|
45
|
-
"@types/color": "^3.0.
|
|
46
|
-
"@types/react": "~18.
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"react": "
|
|
50
|
-
"react-native": "0.
|
|
51
|
-
"react-native-
|
|
52
|
-
"react-native-
|
|
53
|
-
"
|
|
54
|
-
"typescript": "^4.9.4"
|
|
43
|
+
"@react-navigation/native": "^7.0.0-alpha.9",
|
|
44
|
+
"@testing-library/react-native": "^12.4.3",
|
|
45
|
+
"@types/color": "^3.0.6",
|
|
46
|
+
"@types/react": "~18.2.45",
|
|
47
|
+
"del-cli": "^5.1.0",
|
|
48
|
+
"react": "18.2.0",
|
|
49
|
+
"react-native": "0.73.2",
|
|
50
|
+
"react-native-builder-bob": "^0.23.2",
|
|
51
|
+
"react-native-safe-area-context": "4.8.2",
|
|
52
|
+
"react-native-screens": "~3.29.0",
|
|
53
|
+
"typescript": "^5.3.3"
|
|
55
54
|
},
|
|
56
55
|
"peerDependencies": {
|
|
57
|
-
"@react-navigation/native": "^
|
|
56
|
+
"@react-navigation/native": "^7.0.0-alpha.9",
|
|
58
57
|
"react": "*",
|
|
59
|
-
"react-native": "
|
|
60
|
-
"react-native-safe-area-context": "
|
|
61
|
-
"react-native-screens": "
|
|
58
|
+
"react-native": "0.73.2",
|
|
59
|
+
"react-native-safe-area-context": "4.8.2",
|
|
60
|
+
"react-native-screens": "~3.29.0"
|
|
62
61
|
},
|
|
63
62
|
"react-native-builder-bob": {
|
|
64
63
|
"source": "src",
|
|
@@ -74,5 +73,5 @@
|
|
|
74
73
|
]
|
|
75
74
|
]
|
|
76
75
|
},
|
|
77
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "c7b047dec7c75bda359a618d39a2aac4c2aea9c1"
|
|
78
77
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BottomTabSceneInterpolatedStyle,
|
|
3
|
+
BottomTabSceneInterpolationProps,
|
|
4
|
+
} from '../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Simple cross fade animation
|
|
8
|
+
*/
|
|
9
|
+
export function forCrossFade({
|
|
10
|
+
current,
|
|
11
|
+
}: BottomTabSceneInterpolationProps): BottomTabSceneInterpolatedStyle {
|
|
12
|
+
return {
|
|
13
|
+
sceneStyle: {
|
|
14
|
+
opacity: current.interpolate({
|
|
15
|
+
inputRange: [-1, 0, 1],
|
|
16
|
+
outputRange: [0, 1, 0],
|
|
17
|
+
}),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Animation where the screens slightly shift to left/right
|
|
24
|
+
*/
|
|
25
|
+
export function forShifting({
|
|
26
|
+
current,
|
|
27
|
+
}: BottomTabSceneInterpolationProps): BottomTabSceneInterpolatedStyle {
|
|
28
|
+
return {
|
|
29
|
+
sceneStyle: {
|
|
30
|
+
opacity: current.interpolate({
|
|
31
|
+
inputRange: [-1, 0, 1],
|
|
32
|
+
outputRange: [0, 1, 0],
|
|
33
|
+
}),
|
|
34
|
+
transform: [
|
|
35
|
+
{
|
|
36
|
+
translateX: current.interpolate({
|
|
37
|
+
inputRange: [-1, 0, 1],
|
|
38
|
+
outputRange: [-50, 0, 50],
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BottomTabTransitionPreset } from '../types';
|
|
2
|
+
import { forCrossFade, forShifting } from './SceneStyleInterpolators';
|
|
3
|
+
import { CrossFadeSpec, ShiftingSpec } from './TransitionSpecs';
|
|
4
|
+
|
|
5
|
+
export const FadeTransition: BottomTabTransitionPreset = {
|
|
6
|
+
transitionSpec: CrossFadeSpec,
|
|
7
|
+
sceneStyleInterpolator: forCrossFade,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const ShiftingTransition: BottomTabTransitionPreset = {
|
|
11
|
+
transitionSpec: ShiftingSpec,
|
|
12
|
+
sceneStyleInterpolator: forShifting,
|
|
13
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Easing } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { TransitionSpec } from '../types';
|
|
4
|
+
|
|
5
|
+
export const CrossFadeSpec: TransitionSpec = {
|
|
6
|
+
animation: 'timing',
|
|
7
|
+
config: {
|
|
8
|
+
duration: 150,
|
|
9
|
+
easing: Easing.in(Easing.linear),
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ShiftingSpec: TransitionSpec = {
|
|
14
|
+
animation: 'timing',
|
|
15
|
+
config: {
|
|
16
|
+
duration: 150,
|
|
17
|
+
easing: Easing.inOut(Easing.ease),
|
|
18
|
+
},
|
|
19
|
+
};
|
package/src/index.tsx
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
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createNavigatorFactory,
|
|
3
|
-
DefaultNavigatorOptions,
|
|
4
|
-
ParamListBase,
|
|
5
|
-
TabActionHelpers,
|
|
6
|
-
TabNavigationState,
|
|
3
|
+
type DefaultNavigatorOptions,
|
|
4
|
+
type ParamListBase,
|
|
5
|
+
type TabActionHelpers,
|
|
6
|
+
type TabNavigationState,
|
|
7
7
|
TabRouter,
|
|
8
|
-
TabRouterOptions,
|
|
8
|
+
type TabRouterOptions,
|
|
9
9
|
useNavigationBuilder,
|
|
10
10
|
} from '@react-navigation/native';
|
|
11
11
|
import * as React from 'react';
|
|
@@ -31,6 +31,7 @@ function BottomTabNavigator({
|
|
|
31
31
|
initialRouteName,
|
|
32
32
|
backBehavior,
|
|
33
33
|
children,
|
|
34
|
+
layout,
|
|
34
35
|
screenListeners,
|
|
35
36
|
screenOptions,
|
|
36
37
|
sceneContainerStyle,
|
|
@@ -48,6 +49,7 @@ function BottomTabNavigator({
|
|
|
48
49
|
initialRouteName,
|
|
49
50
|
backBehavior,
|
|
50
51
|
children,
|
|
52
|
+
layout,
|
|
51
53
|
screenListeners,
|
|
52
54
|
screenOptions,
|
|
53
55
|
});
|
package/src/types.tsx
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
HeaderOptions,
|
|
3
|
+
PlatformPressable,
|
|
4
|
+
} from '@react-navigation/elements';
|
|
2
5
|
import type {
|
|
3
6
|
Descriptor,
|
|
4
7
|
NavigationHelpers,
|
|
@@ -14,7 +17,6 @@ import type {
|
|
|
14
17
|
GestureResponderEvent,
|
|
15
18
|
StyleProp,
|
|
16
19
|
TextStyle,
|
|
17
|
-
TouchableWithoutFeedbackProps,
|
|
18
20
|
ViewStyle,
|
|
19
21
|
} from 'react-native';
|
|
20
22
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
@@ -43,7 +45,7 @@ export type BottomTabNavigationHelpers = NavigationHelpers<
|
|
|
43
45
|
export type BottomTabNavigationProp<
|
|
44
46
|
ParamList extends ParamListBase,
|
|
45
47
|
RouteName extends keyof ParamList = keyof ParamList,
|
|
46
|
-
NavigatorID extends string | undefined = undefined
|
|
48
|
+
NavigatorID extends string | undefined = undefined,
|
|
47
49
|
> = NavigationProp<
|
|
48
50
|
ParamList,
|
|
49
51
|
RouteName,
|
|
@@ -57,7 +59,7 @@ export type BottomTabNavigationProp<
|
|
|
57
59
|
export type BottomTabScreenProps<
|
|
58
60
|
ParamList extends ParamListBase,
|
|
59
61
|
RouteName extends keyof ParamList = keyof ParamList,
|
|
60
|
-
NavigatorID extends string | undefined = undefined
|
|
62
|
+
NavigatorID extends string | undefined = undefined,
|
|
61
63
|
> = {
|
|
62
64
|
navigation: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
63
65
|
route: RouteProp<ParamList, RouteName>;
|
|
@@ -223,6 +225,11 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
|
|
223
225
|
*/
|
|
224
226
|
tabBarBackground?: () => React.ReactNode;
|
|
225
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Position of the tab bar on the screen. Defaults to `bottom`.
|
|
230
|
+
*/
|
|
231
|
+
tabBarPosition?: 'bottom' | 'left' | 'right' | 'top';
|
|
232
|
+
|
|
226
233
|
/**
|
|
227
234
|
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
|
228
235
|
* Set it to `false` if you want to render the screen on initial render.
|
|
@@ -254,6 +261,22 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
|
|
254
261
|
* Only supported on iOS and Android.
|
|
255
262
|
*/
|
|
256
263
|
freezeOnBlur?: boolean;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Whether transition animations should be enabled when switching tabs.
|
|
267
|
+
* Defaults to `false`.
|
|
268
|
+
*/
|
|
269
|
+
animationEnabled?: boolean;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Function which specifies interpolated styles for bottom-tab scenes.
|
|
273
|
+
*/
|
|
274
|
+
sceneStyleInterpolator?: BottomTabSceneStyleInterpolator;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Object which specifies the animation type (timing or spring) and their options (such as duration for timing).
|
|
278
|
+
*/
|
|
279
|
+
transitionSpec?: TransitionSpec;
|
|
257
280
|
};
|
|
258
281
|
|
|
259
282
|
export type BottomTabDescriptor = Descriptor<
|
|
@@ -264,6 +287,60 @@ export type BottomTabDescriptor = Descriptor<
|
|
|
264
287
|
|
|
265
288
|
export type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;
|
|
266
289
|
|
|
290
|
+
export type BottomTabSceneInterpolationProps = {
|
|
291
|
+
/**
|
|
292
|
+
* Animated value for the current screen:
|
|
293
|
+
* - -1 if the index is lower than active tab,
|
|
294
|
+
* - 0 if they're active,
|
|
295
|
+
* - 1 if the index is higher than active tab
|
|
296
|
+
*/
|
|
297
|
+
current: Animated.Value;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
export type BottomTabSceneInterpolatedStyle = {
|
|
301
|
+
/**
|
|
302
|
+
* Interpolated style for the view representing the scene containing screen content.
|
|
303
|
+
*/
|
|
304
|
+
sceneStyle: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
export type BottomTabSceneStyleInterpolator = (
|
|
308
|
+
props: BottomTabSceneInterpolationProps
|
|
309
|
+
) => BottomTabSceneInterpolatedStyle;
|
|
310
|
+
|
|
311
|
+
export type TransitionSpec =
|
|
312
|
+
| {
|
|
313
|
+
animation: 'timing';
|
|
314
|
+
config: Omit<
|
|
315
|
+
Animated.TimingAnimationConfig,
|
|
316
|
+
'toValue' | keyof Animated.AnimationConfig
|
|
317
|
+
>;
|
|
318
|
+
}
|
|
319
|
+
| {
|
|
320
|
+
animation: 'spring';
|
|
321
|
+
config: Omit<
|
|
322
|
+
Animated.SpringAnimationConfig,
|
|
323
|
+
'toValue' | keyof Animated.AnimationConfig
|
|
324
|
+
>;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export type BottomTabTransitionPreset = {
|
|
328
|
+
/**
|
|
329
|
+
* Whether transition animations should be enabled when switching tabs.
|
|
330
|
+
*/
|
|
331
|
+
animationEnabled?: boolean;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Function which specifies interpolated styles for bottom-tab scenes.
|
|
335
|
+
*/
|
|
336
|
+
sceneStyleInterpolator?: BottomTabSceneStyleInterpolator;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Object which specifies the animation type (timing or spring) and their options (such as duration for timing).
|
|
340
|
+
*/
|
|
341
|
+
transitionSpec?: TransitionSpec;
|
|
342
|
+
};
|
|
343
|
+
|
|
267
344
|
export type BottomTabNavigationConfig = {
|
|
268
345
|
/**
|
|
269
346
|
* Function that returns a React element to display as the tab bar.
|
|
@@ -318,7 +395,7 @@ export type BottomTabBarProps = {
|
|
|
318
395
|
};
|
|
319
396
|
|
|
320
397
|
export type BottomTabBarButtonProps = Omit<
|
|
321
|
-
|
|
398
|
+
React.ComponentProps<typeof PlatformPressable>,
|
|
322
399
|
'onPress'
|
|
323
400
|
> & {
|
|
324
401
|
href?: string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NavigationState } from '@react-navigation/routers';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Animated } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export function useAnimatedHashMap({ routes, index }: NavigationState) {
|
|
6
|
+
const refs = React.useRef<Record<string, Animated.Value>>({});
|
|
7
|
+
const previous = refs.current;
|
|
8
|
+
const routeKeys = Object.keys(previous);
|
|
9
|
+
|
|
10
|
+
if (
|
|
11
|
+
routes.length === routeKeys.length &&
|
|
12
|
+
routes.every((route) => routeKeys.includes(route.key))
|
|
13
|
+
) {
|
|
14
|
+
return previous;
|
|
15
|
+
}
|
|
16
|
+
refs.current = {};
|
|
17
|
+
|
|
18
|
+
routes.forEach(({ key }, i) => {
|
|
19
|
+
refs.current[key] =
|
|
20
|
+
previous[key] ??
|
|
21
|
+
new Animated.Value(i === index ? 0 : i >= index ? 1 : -1);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return refs.current;
|
|
25
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { EmitterSubscription, Keyboard, Platform } from 'react-native';
|
|
2
|
+
import { type EmitterSubscription, Keyboard, Platform } from 'react-native';
|
|
3
3
|
|
|
4
4
|
export function useIsKeyboardShown() {
|
|
5
5
|
const [isKeyboardShown, setIsKeyboardShown] = React.useState(false);
|
package/src/views/Badge.tsx
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { useTheme } from '@react-navigation/native';
|
|
2
2
|
import color from 'color';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Animated,
|
|
6
|
+
type StyleProp,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
type TextStyle,
|
|
9
|
+
} from 'react-native';
|
|
5
10
|
|
|
6
11
|
type Props = {
|
|
7
12
|
/**
|