@react-navigation/material-top-tabs 8.0.0-alpha.31 → 8.0.0-alpha.33
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/views/MaterialTopTabBar.js +7 -5
- package/lib/module/views/MaterialTopTabBar.js.map +1 -1
- package/lib/module/views/MaterialTopTabView.js +27 -10
- package/lib/module/views/MaterialTopTabView.js.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -5
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createMaterialTopTabNavigator.d.ts +2 -2
- package/lib/typescript/src/navigators/createMaterialTopTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/utils/TabAnimationContext.d.ts +1 -1
- package/lib/typescript/src/utils/TabAnimationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/useTabAnimation.d.ts +1 -1
- package/lib/typescript/src/utils/useTabAnimation.d.ts.map +1 -1
- package/lib/typescript/src/views/MaterialTopTabBar.d.ts +3 -2
- package/lib/typescript/src/views/MaterialTopTabBar.d.ts.map +1 -1
- package/lib/typescript/src/views/MaterialTopTabView.d.ts +2 -2
- package/lib/typescript/src/views/MaterialTopTabView.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/views/MaterialTopTabBar.tsx +9 -3
- package/src/views/MaterialTopTabView.tsx +41 -13
|
@@ -43,15 +43,17 @@ export function MaterialTopTabBar({
|
|
|
43
43
|
const {
|
|
44
44
|
buildHref
|
|
45
45
|
} = useLinkBuilder();
|
|
46
|
-
const
|
|
46
|
+
const focusedRoute = state.routes[state.index];
|
|
47
|
+
if (focusedRoute == null) {
|
|
48
|
+
throw new Error(`Couldn't find a route at index ${state.index}.`);
|
|
49
|
+
}
|
|
50
|
+
const focusedOptions = descriptors[focusedRoute.key]?.options ?? {};
|
|
47
51
|
const tabBarVariant = focusedOptions.tabBarVariant ?? 'primary';
|
|
48
52
|
const activeColor = focusedOptions.tabBarActiveTintColor ?? (tabBarVariant === 'primary' ? colors.primary : colors.text);
|
|
49
53
|
const inactiveColor = focusedOptions.tabBarInactiveTintColor ?? Color(colors.text)?.alpha(0.68).string() ?? (dark ? 'rgba(255, 255, 255, 0.68)' : 'rgba(0, 0, 0, 0.68)');
|
|
50
54
|
const pressColor = focusedOptions.tabBarPressColor ?? Color(tabBarVariant === 'primary' ? colors.primary : colors.text)?.alpha(0.12).string() ?? (dark ? 'rgba(255, 255, 255, 0.12)' : 'rgba(0, 0, 0, 0.12)');
|
|
51
55
|
const tabBarOptions = Object.fromEntries(state.routes.map(route => {
|
|
52
|
-
const {
|
|
53
|
-
options
|
|
54
|
-
} = descriptors[route.key];
|
|
56
|
+
const options = descriptors[route.key]?.options ?? {};
|
|
55
57
|
const {
|
|
56
58
|
title,
|
|
57
59
|
tabBarLabel,
|
|
@@ -126,7 +128,7 @@ export function MaterialTopTabBar({
|
|
|
126
128
|
labelText,
|
|
127
129
|
color
|
|
128
130
|
}) => tabBarLabel({
|
|
129
|
-
focused:
|
|
131
|
+
focused: focusedRoute.key === route.key,
|
|
130
132
|
color,
|
|
131
133
|
children: labelText ?? route.name
|
|
132
134
|
}) : renderLabelDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Text","Color","MaterialSymbol","SFSymbol","useLinkBuilder","useLocale","useTheme","React","Image","StyleSheet","TabBar","jsx","_jsx","MaterialLabel","color","labelText","style","allowFontScaling","fonts","medium","styles","label","children","renderLabelDefault","props","MaterialTopTabBar","state","navigation","descriptors","rest","colors","dark","direction","buildHref","
|
|
1
|
+
{"version":3,"names":["Text","Color","MaterialSymbol","SFSymbol","useLinkBuilder","useLocale","useTheme","React","Image","StyleSheet","TabBar","jsx","_jsx","MaterialLabel","color","labelText","style","allowFontScaling","fonts","medium","styles","label","children","renderLabelDefault","props","MaterialTopTabBar","state","navigation","descriptors","rest","colors","dark","direction","buildHref","focusedRoute","routes","index","Error","focusedOptions","key","options","tabBarVariant","activeColor","tabBarActiveTintColor","primary","text","inactiveColor","tabBarInactiveTintColor","alpha","string","pressColor","tabBarPressColor","tabBarOptions","Object","fromEntries","map","route","title","tabBarLabel","tabBarButtonTestID","tabBarAccessibilityLabel","tabBarBadge","tabBarShowIcon","tabBarShowLabel","tabBarIcon","tabBarAllowFontScaling","tabBarLabelStyle","icon","undefined","focused","size","iconValue","isValidElement","type","source","width","height","tintColor","tinted","name","variant","weight","_exhaustiveCheck","href","params","testID","accessibilityLabel","badge","labelAllowFontScaling","labelStyle","tabBarIndicator","navigationState","scrollEnabled","tabBarScrollEnabled","bounces","tabBarBounces","pressOpacity","tabBarPressOpacity","tabStyle","tabBarItemStyle","indicatorStyle","backgroundColor","tabBarIndicatorStyle","gap","tabBarGap","android_ripple","tabBarAndroidRipple","indicatorContainerStyle","tabBarIndicatorContainerStyle","contentContainerStyle","tabBarContentContainerStyle","card","borderBottomColor","border","tabBarStyle","onTabPress","preventDefault","event","emit","target","canPreventDefault","defaultPrevented","onTabLongPress","renderIndicator","_","create","textAlign","fontSize"],"sourceRoot":"../../../src","sources":["views/MaterialTopTabBar.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,4BAA4B;AACjD,SAASC,KAAK,QAAQ,qCAAqC;AAC3D,SACEC,cAAc,EACdC,QAAQ,EACRC,cAAc,EACdC,SAAS,EACTC,QAAQ,QACH,0BAA0B;AACjC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAA0BC,KAAK,EAAEC,UAAU,QAAQ,cAAc;AACjE,SAAqBC,MAAM,QAA4B,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQ/E,MAAMC,aAAa,GAAGA,CAAC;EACrBC,KAAK;EACLC,SAAS;EACTC,KAAK;EACLC;AACkB,CAAC,KAAK;EACxB,MAAM;IAAEC;EAAM,CAAC,GAAGZ,QAAQ,CAAC,CAAC;EAE5B,oBACEM,IAAA,CAACZ,IAAI;IACHgB,KAAK,EAAE,CAAC;MAAEF;IAAM,CAAC,EAAEI,KAAK,CAACC,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Ae,CAAC,KAAK;MACzC,MAAMC,KAAK,GAAG1F,UAAU,CAAC2F,IAAI,CAAC;QAC5B7C,IAAI,EAAE,UAAU;QAChB8C,MAAM,EAAE/D,KAAK,CAACjB,GAAG;QACjBiF,iBAAiB,EAAE;MACrB,CAAC,CAAC;MAEF,IAAIH,KAAK,CAACI,gBAAgB,EAAE;QAC1BL,cAAc,CAAC,CAAC;MAClB;IACF,CAAE;IACFM,cAAc,EAAEA,CAAC;MAAElE;IAAM,CAAC,KACxB7B,UAAU,CAAC2F,IAAI,CAAC;MACd7C,IAAI,EAAE,cAAc;MACpB8C,MAAM,EAAE/D,KAAK,CAACjB;IAChB,CAAC,CACF;IACDoF,eAAe,EACbjC,eAAe,GACX,CAAC;MAAEC,eAAe,EAAEiC,CAAC;MAAE,GAAG/F;IAAK,CAAC,KAC9B6D,eAAe,CAAC;MAAE,GAAG7D,IAAI;MAAEH;IAAM,CAAC,CAAC,GACrC0C;EACL,CACF,CAAC;AAEN;AAEA,MAAMhD,MAAM,GAAGX,UAAU,CAACoH,MAAM,CAAC;EAC/BxG,KAAK,EAAE;IACLyG,SAAS,EAAE,QAAQ;IACnBC,QAAQ,EAAE,EAAE;IACZ1B,eAAe,EAAE;EACnB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -38,11 +38,22 @@ export function MaterialTopTabView({
|
|
|
38
38
|
descriptors: descriptors
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
const
|
|
41
|
+
const focusedRoute = state.routes[state.index];
|
|
42
|
+
if (focusedRoute == null) {
|
|
43
|
+
throw new Error(`Couldn't find a route at index ${state.index}.`);
|
|
44
|
+
}
|
|
45
|
+
const focusedDescriptor = descriptors[focusedRoute.key];
|
|
46
|
+
if (focusedDescriptor == null) {
|
|
47
|
+
throw new Error(`Couldn't find a descriptor for route '${focusedRoute.key}'.`);
|
|
48
|
+
}
|
|
49
|
+
const focusedOptions = focusedDescriptor.options;
|
|
42
50
|
return /*#__PURE__*/_jsx(TabView, {
|
|
43
51
|
...rest,
|
|
44
52
|
onIndexChange: index => {
|
|
45
53
|
const route = state.routes[index];
|
|
54
|
+
if (route == null) {
|
|
55
|
+
throw new Error(`Couldn't find a route at index ${index}.`);
|
|
56
|
+
}
|
|
46
57
|
navigation.dispatch({
|
|
47
58
|
...CommonActions.navigate(route),
|
|
48
59
|
target: state.key
|
|
@@ -51,21 +62,27 @@ export function MaterialTopTabView({
|
|
|
51
62
|
renderScene: ({
|
|
52
63
|
route,
|
|
53
64
|
position
|
|
54
|
-
}) =>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
}) => {
|
|
66
|
+
const descriptor = descriptors[route.key];
|
|
67
|
+
if (descriptor == null) {
|
|
68
|
+
throw new Error(`Couldn't find a descriptor for route '${route.key}'.`);
|
|
69
|
+
}
|
|
70
|
+
return /*#__PURE__*/_jsx(SceneContent, {
|
|
71
|
+
focused: route.key === focusedRoute.key,
|
|
72
|
+
preloaded: state.preloadedRouteKeys.includes(route.key),
|
|
73
|
+
position: position,
|
|
74
|
+
options: descriptor.options,
|
|
75
|
+
children: descriptor.render()
|
|
76
|
+
});
|
|
77
|
+
},
|
|
61
78
|
navigationState: state,
|
|
62
79
|
renderTabBar: renderTabBar,
|
|
63
80
|
renderLazyPlaceholder: ({
|
|
64
81
|
route
|
|
65
|
-
}) => descriptors[route.key]
|
|
82
|
+
}) => descriptors[route.key]?.options.lazyPlaceholder?.() ?? null,
|
|
66
83
|
lazy: ({
|
|
67
84
|
route
|
|
68
|
-
}) => descriptors[route.key]
|
|
85
|
+
}) => descriptors[route.key]?.options.lazy === true && !state.preloadedRouteKeys.includes(route.key),
|
|
69
86
|
lazyPreloadDistance: focusedOptions.lazyPreloadDistance,
|
|
70
87
|
swipeEnabled: focusedOptions.swipeEnabled,
|
|
71
88
|
animationEnabled: focusedOptions.animationEnabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ActivityView","CommonActions","useLocale","useTheme","useMemo","useState","StyleSheet","TabView","TabAnimationContext","MaterialTopTabBar","jsx","_jsx","renderTabBarDefault","props","MaterialTopTabView","tabBar","state","navigation","descriptors","rest","colors","direction","renderTabBar","navigationState","options","
|
|
1
|
+
{"version":3,"names":["ActivityView","CommonActions","useLocale","useTheme","useMemo","useState","StyleSheet","TabView","TabAnimationContext","MaterialTopTabBar","jsx","_jsx","renderTabBarDefault","props","MaterialTopTabView","tabBar","state","navigation","descriptors","rest","colors","direction","renderTabBar","navigationState","options","focusedRoute","routes","index","Error","focusedDescriptor","key","focusedOptions","onIndexChange","route","dispatch","navigate","target","renderScene","position","descriptor","SceneContent","focused","preloaded","preloadedRouteKeys","includes","children","render","renderLazyPlaceholder","lazyPlaceholder","lazy","lazyPreloadDistance","swipeEnabled","animationEnabled","onSwipeStart","emit","type","onSwipeEnd","Object","fromEntries","map","sceneStyle","backgroundColor","background","inactiveBehavior","loaded","setLoaded","animationContext","isActive","Provider","value","mode","visible","style","styles","scene","create","flex"],"sourceRoot":"../../../src","sources":["views/MaterialTopTabView.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,qCAAqC;AAClE,SACEC,aAAa,EAIbC,SAAS,EACTC,QAAQ,QACH,0BAA0B;AACjC,SAASC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACzC,SAAwBC,UAAU,QAAQ,cAAc;AACxD,SAASC,OAAO,QAAQ,uBAAuB;AAS/C,SAASC,mBAAmB,QAAQ,iCAA8B;AAClE,SAASC,iBAAiB,QAAQ,wBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQxD,MAAMC,mBAAmB,GAAIC,KAA6B,iBACxDF,IAAA,CAACF,iBAAiB;EAAA,GAAKI;AAAK,CAAG,CAChC;AAED,OAAO,SAASC,kBAAkBA,CAAC;EACjCC,MAAM,GAAGH,mBAAmB;EAC5BI,KAAK;EACLC,UAAU;EACVC,WAAW;EACX,GAAGC;AACE,CAAC,E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MAAM,CAACC,KAAM;MAAA7B,QAAA,EAEnBA;IAAQ,CACG;EAAC,CACa,CAAC;AAEnC;AAEA,MAAM4B,MAAM,GAAGnE,UAAU,CAACqE,MAAM,CAAC;EAC/BD,KAAK,EAAE;IACLE,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Navigators
|
|
3
3
|
*/
|
|
4
|
-
export { createMaterialTopTabNavigator, createMaterialTopTabScreen, type MaterialTopTabTypeBag, } from './navigators/createMaterialTopTabNavigator';
|
|
4
|
+
export { createMaterialTopTabNavigator, createMaterialTopTabScreen, type MaterialTopTabTypeBag, } from './navigators/createMaterialTopTabNavigator.js';
|
|
5
5
|
/**
|
|
6
6
|
* Views
|
|
7
7
|
*/
|
|
8
|
-
export { MaterialTopTabBar } from './views/MaterialTopTabBar';
|
|
9
|
-
export { MaterialTopTabView } from './views/MaterialTopTabView';
|
|
8
|
+
export { MaterialTopTabBar } from './views/MaterialTopTabBar.js';
|
|
9
|
+
export { MaterialTopTabView } from './views/MaterialTopTabView.js';
|
|
10
10
|
/**
|
|
11
11
|
* Utilities
|
|
12
12
|
*/
|
|
13
|
-
export { useTabAnimation } from './utils/useTabAnimation';
|
|
13
|
+
export { useTabAnimation } from './utils/useTabAnimation.js';
|
|
14
14
|
/**
|
|
15
15
|
* Types
|
|
16
16
|
*/
|
|
17
|
-
export type { MaterialTopTabBarProps, MaterialTopTabNavigationEventMap, MaterialTopTabNavigationOptions, MaterialTopTabNavigationProp, MaterialTopTabNavigatorProps, MaterialTopTabOptionsArgs, MaterialTopTabScreenProps, } from './types';
|
|
17
|
+
export type { MaterialTopTabBarProps, MaterialTopTabNavigationEventMap, MaterialTopTabNavigationOptions, MaterialTopTabNavigationProp, MaterialTopTabNavigatorProps, MaterialTopTabOptionsArgs, MaterialTopTabScreenProps, } from './types.js';
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,+CAA4C,CAAC;AAEpD;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA2B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA4B,CAAC;AAEhE;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,4BAAyB,CAAC;AAE1D;;GAEG;AACH,YAAY,EACV,sBAAsB,EACtB,gCAAgC,EAChC,+BAA+B,EAC/B,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,YAAS,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NavigatorTypeBagBase, type ParamListBase, type TabActionHelpers, type TabNavigationState } from '@react-navigation/native';
|
|
2
|
-
import type { MaterialTopTabNavigationEventMap, MaterialTopTabNavigationOptions, MaterialTopTabNavigatorProps } from '../types';
|
|
3
|
-
declare function MaterialTopTabNavigator({ initialRouteName, backBehavior, routeNamesChangeBehavior, children, layout, screenListeners, screenOptions, screenLayout, router, ...rest }: MaterialTopTabNavigatorProps): import("react
|
|
2
|
+
import type { MaterialTopTabNavigationEventMap, MaterialTopTabNavigationOptions, MaterialTopTabNavigatorProps } from '../types.js';
|
|
3
|
+
declare function MaterialTopTabNavigator({ initialRouteName, backBehavior, routeNamesChangeBehavior, children, layout, screenListeners, screenOptions, screenLayout, router, ...rest }: MaterialTopTabNavigatorProps): import("react").JSX.Element;
|
|
4
4
|
export interface MaterialTopTabTypeBag extends NavigatorTypeBagBase {
|
|
5
5
|
State: TabNavigationState<this['ParamList']>;
|
|
6
6
|
ScreenOptions: MaterialTopTabNavigationOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMaterialTopTabNavigator.d.ts","sourceRoot":"","sources":["../../../../src/navigators/createMaterialTopTabNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,gCAAgC,EAChC,+BAA+B,EAC/B,4BAA4B,EAC7B,MAAM,
|
|
1
|
+
{"version":3,"file":"createMaterialTopTabNavigator.d.ts","sourceRoot":"","sources":["../../../../src/navigators/createMaterialTopTabNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,gCAAgC,EAChC,+BAA+B,EAC/B,4BAA4B,EAC7B,MAAM,aAAU,CAAC;AAGlB,iBAAS,uBAAuB,CAAC,EAC/B,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,MAAM,EACN,GAAG,IAAI,EACR,EAAE,4BAA4B,+BA8B9B;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,KAAK,EAAE,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC7C,aAAa,EAAE,+BAA+B,CAAC;IAC/C,QAAQ,EAAE,gCAAgC,CAAC;IAC3C,aAAa,EAAE,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACnD,SAAS,EAAE,OAAO,uBAAuB,CAAC;CAC3C;AAED,eAAO,MAAM,6BAA6B,+EAC8B,CAAC;AAEzE,eAAO,MAAM,0BAA0B,kJACO,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { MaterialTopTabAnimationContext } from '../types';
|
|
2
|
+
import type { MaterialTopTabAnimationContext } from '../types.js';
|
|
3
3
|
export declare const TabAnimationContext: React.Context<MaterialTopTabAnimationContext | undefined>;
|
|
4
4
|
//# sourceMappingURL=TabAnimationContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabAnimationContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/TabAnimationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TabAnimationContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/TabAnimationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAU,CAAC;AAE/D,eAAO,MAAM,mBAAmB,2DAEpB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function useTabAnimation(): import("../types").MaterialTopTabAnimationContext;
|
|
1
|
+
export declare function useTabAnimation(): import("../types.js").MaterialTopTabAnimationContext;
|
|
2
2
|
//# sourceMappingURL=useTabAnimation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTabAnimation.d.ts","sourceRoot":"","sources":["../../../../src/utils/useTabAnimation.tsx"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"useTabAnimation.d.ts","sourceRoot":"","sources":["../../../../src/utils/useTabAnimation.tsx"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,yDAU9B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MaterialTopTabBarProps } from '../types.js';
|
|
3
|
+
export declare function MaterialTopTabBar({ state, navigation, descriptors, ...rest }: MaterialTopTabBarProps): React.JSX.Element;
|
|
3
4
|
//# sourceMappingURL=MaterialTopTabBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialTopTabBar.d.ts","sourceRoot":"","sources":["../../../../src/views/MaterialTopTabBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MaterialTopTabBar.d.ts","sourceRoot":"","sources":["../../../../src/views/MaterialTopTabBar.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAU,CAAC;AA4BvD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,UAAU,EACV,WAAW,EACX,GAAG,IAAI,EACR,EAAE,sBAAsB,qBAwMxB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type ParamListBase, type TabNavigationState } from '@react-navigation/native';
|
|
2
|
-
import type { MaterialTopTabDescriptorMap, MaterialTopTabNavigationConfig, MaterialTopTabNavigationHelpers } from '../types';
|
|
2
|
+
import type { MaterialTopTabDescriptorMap, MaterialTopTabNavigationConfig, MaterialTopTabNavigationHelpers } from '../types.js';
|
|
3
3
|
type Props = MaterialTopTabNavigationConfig & {
|
|
4
4
|
state: TabNavigationState<ParamListBase>;
|
|
5
5
|
navigation: MaterialTopTabNavigationHelpers;
|
|
6
6
|
descriptors: MaterialTopTabDescriptorMap;
|
|
7
7
|
};
|
|
8
|
-
export declare function MaterialTopTabView({ tabBar, state, navigation, descriptors, ...rest }: Props): import("react
|
|
8
|
+
export declare function MaterialTopTabView({ tabBar, state, navigation, descriptors, ...rest }: Props): import("react").JSX.Element;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=MaterialTopTabView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialTopTabView.d.ts","sourceRoot":"","sources":["../../../../src/views/MaterialTopTabView.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EAGxB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EAEV,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,EAEhC,MAAM,
|
|
1
|
+
{"version":3,"file":"MaterialTopTabView.d.ts","sourceRoot":"","sources":["../../../../src/views/MaterialTopTabView.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EAGxB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EAEV,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,EAEhC,MAAM,aAAU,CAAC;AAIlB,KAAK,KAAK,GAAG,8BAA8B,GAAG;IAC5C,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,+BAA+B,CAAC;IAC5C,WAAW,EAAE,2BAA2B,CAAC;CAC1C,CAAC;AAMF,wBAAgB,kBAAkB,CAAC,EACjC,MAA4B,EAC5B,KAAK,EACL,UAAU,EACV,WAAW,EACX,GAAG,IAAI,EACR,EAAE,KAAK,+BAwGP"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/material-top-tabs",
|
|
3
3
|
"description": "Integration for the animated tab view component from react-native-tab-view",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.33",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -46,25 +46,25 @@
|
|
|
46
46
|
"clean": "del lib"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@react-navigation/elements": "^3.0.0-alpha.
|
|
50
|
-
"react-native-tab-view": "^5.0.0-alpha.
|
|
49
|
+
"@react-navigation/elements": "^3.0.0-alpha.32",
|
|
50
|
+
"react-native-tab-view": "^5.0.0-alpha.10"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@jest/globals": "^
|
|
54
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
55
|
-
"@testing-library/react-native": "^
|
|
56
|
-
"@types/react": "~19.2.
|
|
53
|
+
"@jest/globals": "^29.7.0",
|
|
54
|
+
"@react-navigation/native": "^8.0.0-alpha.29",
|
|
55
|
+
"@testing-library/react-native": "^14.0.0",
|
|
56
|
+
"@types/react": "~19.2.17",
|
|
57
57
|
"del-cli": "^7.0.0",
|
|
58
58
|
"react": "19.2.0",
|
|
59
|
-
"react-native": "0.83.
|
|
60
|
-
"react-native-builder-bob": "^0.
|
|
59
|
+
"react-native": "0.83.6",
|
|
60
|
+
"react-native-builder-bob": "^0.42.1",
|
|
61
61
|
"react-native-pager-view": "^8.0.0",
|
|
62
62
|
"react-native-safe-area-context": "~5.6.2",
|
|
63
|
-
"
|
|
64
|
-
"typescript": "^6.0.
|
|
63
|
+
"test-renderer": "1.2.0",
|
|
64
|
+
"typescript": "^6.0.3"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
67
|
+
"@react-navigation/native": "^8.0.0-alpha.29",
|
|
68
68
|
"react": ">= 19.2.0",
|
|
69
69
|
"react-native": "*",
|
|
70
70
|
"react-native-pager-view": ">= 7.0.0",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
]
|
|
89
89
|
]
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "9c6b764c575fdf7e3c27df37f820899dda9d4259"
|
|
92
92
|
}
|
|
@@ -49,7 +49,13 @@ export function MaterialTopTabBar({
|
|
|
49
49
|
const { direction } = useLocale();
|
|
50
50
|
const { buildHref } = useLinkBuilder();
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const focusedRoute = state.routes[state.index];
|
|
53
|
+
|
|
54
|
+
if (focusedRoute == null) {
|
|
55
|
+
throw new Error(`Couldn't find a route at index ${state.index}.`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const focusedOptions = descriptors[focusedRoute.key]?.options ?? {};
|
|
53
59
|
const tabBarVariant = focusedOptions.tabBarVariant ?? 'primary';
|
|
54
60
|
|
|
55
61
|
const activeColor: ColorValue =
|
|
@@ -70,7 +76,7 @@ export function MaterialTopTabBar({
|
|
|
70
76
|
|
|
71
77
|
const tabBarOptions = Object.fromEntries(
|
|
72
78
|
state.routes.map((route) => {
|
|
73
|
-
const
|
|
79
|
+
const options = descriptors[route.key]?.options ?? {};
|
|
74
80
|
|
|
75
81
|
const {
|
|
76
82
|
title,
|
|
@@ -165,7 +171,7 @@ export function MaterialTopTabBar({
|
|
|
165
171
|
: typeof tabBarLabel === 'function'
|
|
166
172
|
? ({ labelText, color }: MaterialLabelProps) =>
|
|
167
173
|
tabBarLabel({
|
|
168
|
-
focused:
|
|
174
|
+
focused: focusedRoute.key === route.key,
|
|
169
175
|
color,
|
|
170
176
|
children: labelText ?? route.name,
|
|
171
177
|
})
|
|
@@ -58,7 +58,21 @@ export function MaterialTopTabView({
|
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
const
|
|
61
|
+
const focusedRoute = state.routes[state.index];
|
|
62
|
+
|
|
63
|
+
if (focusedRoute == null) {
|
|
64
|
+
throw new Error(`Couldn't find a route at index ${state.index}.`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const focusedDescriptor = descriptors[focusedRoute.key];
|
|
68
|
+
|
|
69
|
+
if (focusedDescriptor == null) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`Couldn't find a descriptor for route '${focusedRoute.key}'.`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const focusedOptions = focusedDescriptor.options;
|
|
62
76
|
|
|
63
77
|
return (
|
|
64
78
|
<TabView
|
|
@@ -66,28 +80,42 @@ export function MaterialTopTabView({
|
|
|
66
80
|
onIndexChange={(index) => {
|
|
67
81
|
const route = state.routes[index];
|
|
68
82
|
|
|
83
|
+
if (route == null) {
|
|
84
|
+
throw new Error(`Couldn't find a route at index ${index}.`);
|
|
85
|
+
}
|
|
86
|
+
|
|
69
87
|
navigation.dispatch({
|
|
70
88
|
...CommonActions.navigate(route),
|
|
71
89
|
target: state.key,
|
|
72
90
|
});
|
|
73
91
|
}}
|
|
74
|
-
renderScene={({ route, position }) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
renderScene={({ route, position }) => {
|
|
93
|
+
const descriptor = descriptors[route.key];
|
|
94
|
+
|
|
95
|
+
if (descriptor == null) {
|
|
96
|
+
throw new Error(
|
|
97
|
+
`Couldn't find a descriptor for route '${route.key}'.`
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<SceneContent
|
|
103
|
+
focused={route.key === focusedRoute.key}
|
|
104
|
+
preloaded={state.preloadedRouteKeys.includes(route.key)}
|
|
105
|
+
position={position}
|
|
106
|
+
options={descriptor.options}
|
|
107
|
+
>
|
|
108
|
+
{descriptor.render()}
|
|
109
|
+
</SceneContent>
|
|
110
|
+
);
|
|
111
|
+
}}
|
|
84
112
|
navigationState={state}
|
|
85
113
|
renderTabBar={renderTabBar}
|
|
86
114
|
renderLazyPlaceholder={({ route }) =>
|
|
87
|
-
descriptors[route.key]
|
|
115
|
+
descriptors[route.key]?.options.lazyPlaceholder?.() ?? null
|
|
88
116
|
}
|
|
89
117
|
lazy={({ route }) =>
|
|
90
|
-
descriptors[route.key]
|
|
118
|
+
descriptors[route.key]?.options.lazy === true &&
|
|
91
119
|
!state.preloadedRouteKeys.includes(route.key)
|
|
92
120
|
}
|
|
93
121
|
lazyPreloadDistance={focusedOptions.lazyPreloadDistance}
|