@react-navigation/bottom-tabs 8.0.0-alpha.5 → 8.0.0-alpha.51
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/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createBottomTabNavigator.js +11 -34
- package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/module/utils/useBottomTabAnimation.js +1 -1
- package/lib/module/utils/useBottomTabAnimation.js.map +1 -1
- package/lib/module/utils/useBottomTabBarHeight.js +1 -1
- package/lib/module/utils/useBottomTabBarHeight.js.map +1 -1
- package/lib/module/utils/useIsKeyboardShown.js.map +1 -1
- package/lib/module/views/BottomTabBar.js +40 -29
- package/lib/module/views/BottomTabBar.js.map +1 -1
- package/lib/module/views/BottomTabItem.js +3 -5
- package/lib/module/views/BottomTabItem.js.map +1 -1
- package/lib/module/views/{BottomTabViewCommon.js → BottomTabView.js} +1 -1
- package/lib/module/views/BottomTabView.js.map +1 -0
- package/lib/module/views/BottomTabViewCustom.js +97 -81
- package/lib/module/views/BottomTabViewCustom.js.map +1 -1
- package/lib/module/views/BottomTabViewNativeImpl.js +339 -121
- package/lib/module/views/BottomTabViewNativeImpl.js.map +1 -1
- package/lib/module/views/Deferred.js +41 -0
- package/lib/module/views/Deferred.js.map +1 -0
- package/lib/module/views/ScreenContent.js.map +1 -1
- package/lib/module/views/TabBarIcon.js +11 -48
- package/lib/module/views/TabBarIcon.js.map +1 -1
- package/lib/typescript/src/TransitionConfigs/SceneStyleInterpolators.d.ts +1 -1
- package/lib/typescript/src/TransitionConfigs/SceneStyleInterpolators.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +11 -11
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +9 -15
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +66 -104
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/BottomTabAnimationContext.d.ts +1 -1
- package/lib/typescript/src/utils/BottomTabAnimationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/useAnimatedHashMap.d.ts +1 -1
- package/lib/typescript/src/utils/useAnimatedHashMap.d.ts.map +1 -1
- package/lib/typescript/src/utils/useBottomTabAnimation.d.ts +1 -1
- package/lib/typescript/src/utils/useBottomTabAnimation.d.ts.map +1 -1
- package/lib/typescript/src/utils/useTabBarPosition.d.ts +1 -1
- package/lib/typescript/src/utils/useTabBarPosition.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabBar.d.ts +3 -2
- package/lib/typescript/src/views/BottomTabBar.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabItem.d.ts +20 -20
- package/lib/typescript/src/views/BottomTabItem.d.ts.map +1 -1
- package/lib/typescript/src/views/{BottomTabViewCommon.d.ts → BottomTabView.d.ts} +3 -3
- package/lib/typescript/src/views/BottomTabView.d.ts.map +1 -0
- package/lib/typescript/src/views/BottomTabViewCustom.d.ts +3 -2
- package/lib/typescript/src/views/BottomTabViewCustom.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabViewNative.android.d.ts +1 -1
- package/lib/typescript/src/views/BottomTabViewNative.android.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabViewNative.d.ts +1 -1
- package/lib/typescript/src/views/BottomTabViewNative.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabViewNative.ios.d.ts +1 -1
- package/lib/typescript/src/views/BottomTabViewNative.ios.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabViewNativeImpl.d.ts +3 -2
- package/lib/typescript/src/views/BottomTabViewNativeImpl.d.ts.map +1 -1
- package/lib/typescript/src/views/Deferred.d.ts +31 -0
- package/lib/typescript/src/views/Deferred.d.ts.map +1 -0
- package/lib/typescript/src/views/ScreenContent.d.ts +4 -4
- package/lib/typescript/src/views/ScreenContent.d.ts.map +1 -1
- package/lib/typescript/src/views/TabBarIcon.d.ts +8 -8
- package/lib/typescript/src/views/TabBarIcon.d.ts.map +1 -1
- package/package.json +22 -22
- package/src/index.tsx +2 -2
- package/src/navigators/createBottomTabNavigator.tsx +34 -102
- package/src/types.tsx +66 -112
- package/src/utils/useAnimatedHashMap.tsx +1 -1
- package/src/utils/useBottomTabAnimation.tsx +1 -1
- package/src/utils/useBottomTabBarHeight.tsx +1 -1
- package/src/utils/useIsKeyboardShown.tsx +2 -2
- package/src/views/BottomTabBar.tsx +68 -25
- package/src/views/BottomTabItem.tsx +19 -21
- package/src/views/BottomTabViewCustom.tsx +172 -143
- package/src/views/BottomTabViewNativeImpl.tsx +480 -161
- package/src/views/Deferred.tsx +57 -0
- package/src/views/ScreenContent.tsx +1 -2
- package/src/views/TabBarIcon.tsx +13 -56
- package/lib/module/views/BottomTabViewCommon.js.map +0 -1
- package/lib/typescript/src/views/BottomTabViewCommon.d.ts.map +0 -1
- /package/src/views/{BottomTabViewCommon.tsx → BottomTabView.tsx} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether lazy rendering is enabled.
|
|
5
|
+
*/
|
|
6
|
+
lazy: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the component is visible.
|
|
9
|
+
*/
|
|
10
|
+
visible: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Content to render.
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactElement;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Render content lazily based on visibility.
|
|
18
|
+
*
|
|
19
|
+
* When lazy is enabled:
|
|
20
|
+
* - If content is visible, it will render immediately
|
|
21
|
+
* - If content is not visible, it won't render until it becomes visible
|
|
22
|
+
*
|
|
23
|
+
* Otherwise:
|
|
24
|
+
* - If content is visible, it will render immediately
|
|
25
|
+
* - If content is not visible, it will defer rendering
|
|
26
|
+
*
|
|
27
|
+
* Once rendered, the content remains rendered.
|
|
28
|
+
*/
|
|
29
|
+
export declare function Deferred({ lazy, visible, children }: Props): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=Deferred.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Deferred.d.ts","sourceRoot":"","sources":["../../../../src/views/Deferred.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,KAAK,KAAK,GAAG;IACX;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,KAAK,iFA0B1D"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { Screen } from '@react-navigation/elements/internal';
|
|
1
2
|
import type { ParamListBase, Route } from '@react-navigation/native';
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import type { BottomTabNavigationOptions, BottomTabNavigationProp } from '../types';
|
|
4
|
+
import type { BottomTabNavigationOptions, BottomTabNavigationProp } from '../types.js';
|
|
5
5
|
export declare function ScreenContent({ isFocused, route, navigation, options, style, children, }: {
|
|
6
6
|
isFocused: boolean;
|
|
7
7
|
route: Route<string>;
|
|
8
8
|
navigation: BottomTabNavigationProp<ParamListBase>;
|
|
9
9
|
options: BottomTabNavigationOptions;
|
|
10
|
-
style?:
|
|
10
|
+
style?: React.ComponentProps<typeof Screen>['style'];
|
|
11
11
|
children: React.ReactNode;
|
|
12
|
-
}):
|
|
12
|
+
}): React.JSX.Element;
|
|
13
13
|
//# sourceMappingURL=ScreenContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenContent.d.ts","sourceRoot":"","sources":["../../../../src/views/ScreenContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScreenContent.d.ts","sourceRoot":"","sources":["../../../../src/views/ScreenContent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,aAAU,CAAC;AAElB,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,KAAK,EACL,UAAU,EACV,OAAO,EACP,KAAK,EACL,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACnD,OAAO,EAAE,0BAA0B,CAAC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;IACrD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAgCA"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
+
import { type Icon } from '@react-navigation/elements';
|
|
1
2
|
import { type Route } from '@react-navigation/native';
|
|
2
|
-
import React from 'react';
|
|
3
|
+
import * as React from 'react';
|
|
3
4
|
import { type ColorValue, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
4
|
-
import type { BottomTabIcon } from '../types';
|
|
5
5
|
export type TabBarIconProps = {
|
|
6
6
|
route: Route<string>;
|
|
7
7
|
variant: 'uikit' | 'material';
|
|
8
8
|
size: 'compact' | 'regular';
|
|
9
|
-
badge?: string | number;
|
|
10
|
-
badgeStyle?: StyleProp<TextStyle
|
|
9
|
+
badge?: string | number | undefined;
|
|
10
|
+
badgeStyle?: StyleProp<TextStyle> | undefined;
|
|
11
11
|
activeOpacity: number;
|
|
12
12
|
inactiveOpacity: number;
|
|
13
13
|
activeTintColor: ColorValue;
|
|
14
14
|
inactiveTintColor: ColorValue;
|
|
15
|
-
icon:
|
|
15
|
+
icon: Icon | ((props: {
|
|
16
16
|
focused: boolean;
|
|
17
17
|
color: ColorValue;
|
|
18
18
|
size: number;
|
|
19
|
-
}) =>
|
|
20
|
-
allowFontScaling?: boolean;
|
|
19
|
+
}) => Icon | React.ReactNode);
|
|
20
|
+
allowFontScaling?: boolean | undefined;
|
|
21
21
|
style: StyleProp<ViewStyle>;
|
|
22
22
|
};
|
|
23
|
-
export declare function TabBarIcon({ route: _, variant, size, badge, badgeStyle, activeOpacity, inactiveOpacity, activeTintColor, inactiveTintColor, icon, allowFontScaling, style, }: TabBarIconProps):
|
|
23
|
+
export declare function TabBarIcon({ route: _, variant, size, badge, badgeStyle, activeOpacity, inactiveOpacity, activeTintColor, inactiveTintColor, icon, allowFontScaling, style, }: TabBarIconProps): React.JSX.Element;
|
|
24
24
|
//# sourceMappingURL=TabBarIcon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBarIcon.d.ts","sourceRoot":"","sources":["../../../../src/views/TabBarIcon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TabBarIcon.d.ts","sourceRoot":"","sources":["../../../../src/views/TabBarIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAgB,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EAEd,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,OAAO,EAAE,OAAO,GAAG,UAAU,CAAC;IAC9B,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACpC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,UAAU,CAAC;IAC5B,iBAAiB,EAAE,UAAU,CAAC;IAC9B,IAAI,EACA,IAAI,GACJ,CAAC,CAAC,KAAK,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,UAAU,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC7B,CAAC;AAcF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EAAE,CAAC,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,UAAU,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,IAAI,EACJ,gBAAgB,EAChB,KAAK,GACN,EAAE,eAAe,qBAwDjB"}
|
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": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.51",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"types": "./lib/typescript/src/index.d.ts",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"source": "./src/index.tsx",
|
|
24
|
+
"@react-navigation/source": "./src/index.tsx",
|
|
25
25
|
"types": "./lib/typescript/src/index.d.ts",
|
|
26
26
|
"default": "./lib/module/index.js"
|
|
27
27
|
},
|
|
@@ -41,31 +41,31 @@
|
|
|
41
41
|
"clean": "del lib"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@react-navigation/elements": "^3.0.0-alpha.
|
|
45
|
-
"color": "^4.2.3",
|
|
46
|
-
"sf-symbols-typescript": "^2.2.0"
|
|
44
|
+
"@react-navigation/elements": "^3.0.0-alpha.49"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
|
-
"@jest/globals": "^30.
|
|
50
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
51
|
-
"@testing-library/
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"react
|
|
57
|
-
"react-native
|
|
58
|
-
"react-native-
|
|
59
|
-
"react-native-
|
|
60
|
-
"react-
|
|
61
|
-
"
|
|
47
|
+
"@jest/globals": "^30.4.1",
|
|
48
|
+
"@react-navigation/native": "^8.0.0-alpha.45",
|
|
49
|
+
"@testing-library/jest-dom": "^7.0.0",
|
|
50
|
+
"@testing-library/react": "^16.3.2",
|
|
51
|
+
"@testing-library/react-native": "^14.0.0",
|
|
52
|
+
"@types/react": "~19.2.17",
|
|
53
|
+
"del-cli": "^7.0.0",
|
|
54
|
+
"react": "19.2.3",
|
|
55
|
+
"react-native": "0.85.3",
|
|
56
|
+
"react-native-builder-bob": "^0.43.0",
|
|
57
|
+
"react-native-safe-area-context": "~5.7.0",
|
|
58
|
+
"react-native-screens": "^4.26.2",
|
|
59
|
+
"react-native-web": "~0.21.2",
|
|
60
|
+
"test-renderer": "1.2.0",
|
|
61
|
+
"typescript": "^6.0.3"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
65
|
-
"react": ">= 19.
|
|
64
|
+
"@react-navigation/native": "^8.0.0-alpha.45",
|
|
65
|
+
"react": ">= 19.2.0",
|
|
66
66
|
"react-native": "*",
|
|
67
67
|
"react-native-safe-area-context": ">= 5.5.0",
|
|
68
|
-
"react-native-screens": ">= 4.
|
|
68
|
+
"react-native-screens": ">= 4.25.0"
|
|
69
69
|
},
|
|
70
70
|
"react-native-builder-bob": {
|
|
71
71
|
"source": "src",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
]
|
|
86
86
|
]
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "400f7128965fc92c335a3f6c27e3fa26113915e4"
|
|
89
89
|
}
|
package/src/index.tsx
CHANGED
|
@@ -11,6 +11,7 @@ export { SceneStyleInterpolators, TransitionPresets, TransitionSpecs };
|
|
|
11
11
|
* Navigators
|
|
12
12
|
*/
|
|
13
13
|
export {
|
|
14
|
+
type BottomTabTypeBag,
|
|
14
15
|
createBottomTabNavigator,
|
|
15
16
|
createBottomTabScreen,
|
|
16
17
|
} from './navigators/createBottomTabNavigator';
|
|
@@ -19,7 +20,7 @@ export {
|
|
|
19
20
|
* Views
|
|
20
21
|
*/
|
|
21
22
|
export { BottomTabBar } from './views/BottomTabBar';
|
|
22
|
-
export { BottomTabView } from './views/
|
|
23
|
+
export { BottomTabView } from './views/BottomTabView';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Utilities
|
|
@@ -36,7 +37,6 @@ export type {
|
|
|
36
37
|
BottomTabBarButtonProps,
|
|
37
38
|
BottomTabBarProps,
|
|
38
39
|
BottomTabHeaderProps,
|
|
39
|
-
BottomTabIcon,
|
|
40
40
|
BottomTabNavigationEventMap,
|
|
41
41
|
BottomTabNavigationOptions,
|
|
42
42
|
BottomTabNavigationProp,
|
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createNavigatorFactory,
|
|
3
|
+
createScreenFactory,
|
|
4
|
+
type NavigatorTypeBagBase,
|
|
3
5
|
type ParamListBase,
|
|
4
|
-
StackActions,
|
|
5
|
-
type StaticConfig,
|
|
6
|
-
type StaticParamList,
|
|
7
|
-
type StaticScreenConfig,
|
|
8
|
-
type StaticScreenConfigLinking,
|
|
9
|
-
type StaticScreenConfigScreen,
|
|
10
6
|
type TabActionHelpers,
|
|
11
7
|
type TabNavigationState,
|
|
12
8
|
TabRouter,
|
|
13
9
|
type TabRouterOptions,
|
|
14
|
-
type TypedNavigator,
|
|
15
10
|
useNavigationBuilder,
|
|
16
11
|
} from '@react-navigation/native';
|
|
17
|
-
import * as React from 'react';
|
|
18
12
|
|
|
19
13
|
import type {
|
|
20
14
|
BottomTabNavigationEventMap,
|
|
21
15
|
BottomTabNavigationOptions,
|
|
22
|
-
BottomTabNavigationProp,
|
|
23
16
|
BottomTabNavigatorProps,
|
|
24
17
|
} from '../types';
|
|
25
|
-
import { BottomTabView } from '../views/
|
|
18
|
+
import { BottomTabView } from '../views/BottomTabView';
|
|
26
19
|
|
|
27
20
|
function BottomTabNavigator({
|
|
28
21
|
initialRouteName,
|
|
@@ -36,104 +29,43 @@ function BottomTabNavigator({
|
|
|
36
29
|
router,
|
|
37
30
|
...rest
|
|
38
31
|
}: BottomTabNavigatorProps) {
|
|
39
|
-
const { state, navigation, descriptors,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const focusedRouteKey = state.routes[state.index].key;
|
|
59
|
-
const previousRouteKeyRef = React.useRef(focusedRouteKey);
|
|
60
|
-
|
|
61
|
-
React.useEffect(() => {
|
|
62
|
-
const previousRouteKey = previousRouteKeyRef.current;
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
previousRouteKey !== focusedRouteKey &&
|
|
66
|
-
descriptors[previousRouteKey]?.options.popToTopOnBlur
|
|
67
|
-
) {
|
|
68
|
-
const prevRoute = state.routes.find(
|
|
69
|
-
(route) => route.key === previousRouteKey
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
if (prevRoute?.state?.type === 'stack' && prevRoute.state.key) {
|
|
73
|
-
const popToTopAction = {
|
|
74
|
-
...StackActions.popToTop(),
|
|
75
|
-
target: prevRoute.state.key,
|
|
76
|
-
};
|
|
77
|
-
navigation.dispatch(popToTopAction);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
previousRouteKeyRef.current = focusedRouteKey;
|
|
82
|
-
}, [descriptors, focusedRouteKey, navigation, state.index, state.routes]);
|
|
32
|
+
const { state, navigation, descriptors, render } = useNavigationBuilder<
|
|
33
|
+
TabNavigationState<ParamListBase>,
|
|
34
|
+
TabRouterOptions,
|
|
35
|
+
TabActionHelpers<ParamListBase>,
|
|
36
|
+
BottomTabNavigationOptions,
|
|
37
|
+
BottomTabNavigationEventMap
|
|
38
|
+
>(TabRouter, {
|
|
39
|
+
initialRouteName,
|
|
40
|
+
backBehavior,
|
|
41
|
+
routeNamesChangeBehavior,
|
|
42
|
+
children,
|
|
43
|
+
layout,
|
|
44
|
+
screenListeners,
|
|
45
|
+
screenOptions,
|
|
46
|
+
screenLayout,
|
|
47
|
+
router,
|
|
48
|
+
});
|
|
83
49
|
|
|
84
|
-
return (
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/>
|
|
92
|
-
</NavigationContent>
|
|
50
|
+
return render(
|
|
51
|
+
<BottomTabView
|
|
52
|
+
{...rest}
|
|
53
|
+
state={state}
|
|
54
|
+
navigation={navigation}
|
|
55
|
+
descriptors={descriptors}
|
|
56
|
+
/>
|
|
93
57
|
);
|
|
94
58
|
}
|
|
95
59
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
State: TabNavigationState<ParamList>;
|
|
60
|
+
export interface BottomTabTypeBag extends NavigatorTypeBagBase {
|
|
61
|
+
State: TabNavigationState<this['ParamList']>;
|
|
99
62
|
ScreenOptions: BottomTabNavigationOptions;
|
|
100
63
|
EventMap: BottomTabNavigationEventMap;
|
|
101
|
-
|
|
102
|
-
[RouteName in keyof ParamList]: BottomTabNavigationProp<
|
|
103
|
-
ParamList,
|
|
104
|
-
RouteName
|
|
105
|
-
>;
|
|
106
|
-
};
|
|
64
|
+
ActionHelpers: TabActionHelpers<this['ParamList']>;
|
|
107
65
|
Navigator: typeof BottomTabNavigator;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export function createBottomTabNavigator<
|
|
111
|
-
const ParamList extends ParamListBase,
|
|
112
|
-
>(): TypedNavigator<BottomTabTypeBag<ParamList>, undefined>;
|
|
113
|
-
export function createBottomTabNavigator<
|
|
114
|
-
const Config extends StaticConfig<BottomTabTypeBag<ParamListBase>>,
|
|
115
|
-
>(
|
|
116
|
-
config: Config
|
|
117
|
-
): TypedNavigator<
|
|
118
|
-
BottomTabTypeBag<StaticParamList<{ config: Config }>>,
|
|
119
|
-
Config
|
|
120
|
-
>;
|
|
121
|
-
export function createBottomTabNavigator(config?: unknown) {
|
|
122
|
-
return createNavigatorFactory(BottomTabNavigator)(config);
|
|
123
66
|
}
|
|
124
67
|
|
|
125
|
-
export
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
>(
|
|
129
|
-
config: StaticScreenConfig<
|
|
130
|
-
Linking,
|
|
131
|
-
Screen,
|
|
132
|
-
TabNavigationState<ParamListBase>,
|
|
133
|
-
BottomTabNavigationOptions,
|
|
134
|
-
BottomTabNavigationEventMap,
|
|
135
|
-
BottomTabNavigationProp<ParamListBase>
|
|
136
|
-
>
|
|
137
|
-
) {
|
|
138
|
-
return config;
|
|
139
|
-
}
|
|
68
|
+
export const createBottomTabNavigator =
|
|
69
|
+
createNavigatorFactory<BottomTabTypeBag>(BottomTabNavigator);
|
|
70
|
+
|
|
71
|
+
export const createBottomTabScreen = createScreenFactory<BottomTabTypeBag>();
|