@react-navigation/material-top-tabs 6.0.4 → 6.1.1
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 +6 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createMaterialTopTabNavigator.js +25 -19
- package/lib/commonjs/navigators/createMaterialTopTabNavigator.js.map +1 -1
- package/lib/commonjs/views/MaterialTopTabBar.js +54 -39
- package/lib/commonjs/views/MaterialTopTabBar.js.map +1 -1
- package/lib/commonjs/views/MaterialTopTabView.js +25 -17
- package/lib/commonjs/views/MaterialTopTabView.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createMaterialTopTabNavigator.js +25 -19
- package/lib/module/navigators/createMaterialTopTabNavigator.js.map +1 -1
- package/lib/module/views/MaterialTopTabBar.js +54 -39
- package/lib/module/views/MaterialTopTabBar.js.map +1 -1
- package/lib/module/views/MaterialTopTabView.js +25 -17
- package/lib/module/views/MaterialTopTabView.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/navigators/createMaterialTopTabNavigator.d.ts +1 -1
- package/package.json +6 -6
- package/src/index.tsx +1 -0
- package/src/navigators/createMaterialTopTabNavigator.tsx +15 -11
package/lib/commonjs/index.js
CHANGED
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "createMaterialTopTabNavigator", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _createMaterialTopTabNavigator.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
Object.defineProperty(exports, "MaterialTopTabBar", {
|
|
13
7
|
enumerable: true,
|
|
14
8
|
get: function () {
|
|
@@ -21,6 +15,12 @@ Object.defineProperty(exports, "MaterialTopTabView", {
|
|
|
21
15
|
return _MaterialTopTabView.default;
|
|
22
16
|
}
|
|
23
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "createMaterialTopTabNavigator", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _createMaterialTopTabNavigator.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
24
|
|
|
25
25
|
var _createMaterialTopTabNavigator = _interopRequireDefault(require("./navigators/createMaterialTopTabNavigator"));
|
|
26
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA","sourcesContent":["/**\n * Navigators\n */\nexport { default as createMaterialTopTabNavigator } from './navigators/createMaterialTopTabNavigator';\n\n/**\n * Views\n */\nexport { default as MaterialTopTabBar } from './views/MaterialTopTabBar';\nexport { default as MaterialTopTabView } from './views/MaterialTopTabView';\n\n/**\n * Types\n */\nexport type {\n MaterialTopTabBarProps,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationProp,\n MaterialTopTabScreenProps,\n} from './types';\n"]}
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA","sourcesContent":["/**\n * Navigators\n */\nexport { default as createMaterialTopTabNavigator } from './navigators/createMaterialTopTabNavigator';\n\n/**\n * Views\n */\nexport { default as MaterialTopTabBar } from './views/MaterialTopTabBar';\nexport { default as MaterialTopTabView } from './views/MaterialTopTabView';\n\n/**\n * Types\n */\nexport type {\n MaterialTopTabBarProps,\n MaterialTopTabNavigationEventMap,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationProp,\n MaterialTopTabScreenProps,\n} from './types';\n"]}
|
|
@@ -21,24 +21,28 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
21
|
|
|
22
22
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
23
|
|
|
24
|
-
function MaterialTopTabNavigator({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
function MaterialTopTabNavigator(_ref) {
|
|
25
|
+
let {
|
|
26
|
+
initialRouteName,
|
|
27
|
+
backBehavior,
|
|
28
|
+
children,
|
|
29
|
+
screenListeners,
|
|
30
|
+
screenOptions,
|
|
31
|
+
...restWithDeprecated
|
|
32
|
+
} = _ref;
|
|
33
|
+
const {
|
|
34
|
+
// @ts-expect-error: swipeEnabled is deprecated
|
|
35
|
+
swipeEnabled,
|
|
36
|
+
// @ts-expect-error: lazy is deprecated
|
|
37
|
+
lazy,
|
|
38
|
+
// @ts-expect-error: lazyPlaceholder is deprecated
|
|
39
|
+
lazyPlaceholder,
|
|
40
|
+
// @ts-expect-error: lazyPreloadDistance is deprecated
|
|
41
|
+
lazyPreloadDistance,
|
|
42
|
+
// @ts-expect-error: tabBarOptions is deprecated
|
|
43
|
+
tabBarOptions,
|
|
44
|
+
...rest
|
|
45
|
+
} = restWithDeprecated;
|
|
42
46
|
let defaultScreenOptions = {};
|
|
43
47
|
|
|
44
48
|
if (tabBarOptions) {
|
|
@@ -77,7 +81,9 @@ function MaterialTopTabNavigator({
|
|
|
77
81
|
lazyPlaceholder,
|
|
78
82
|
lazyPreloadDistance
|
|
79
83
|
};
|
|
80
|
-
Object.entries(deprecatedProps).forEach(
|
|
84
|
+
Object.entries(deprecatedProps).forEach(_ref2 => {
|
|
85
|
+
let [propName, propValue] = _ref2;
|
|
86
|
+
|
|
81
87
|
if (propValue !== undefined) {
|
|
82
88
|
// @ts-expect-error: Object.entries doesn't return strict types
|
|
83
89
|
defaultScreenOptions[propName] = propValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["createMaterialTopTabNavigator.tsx"],"names":["MaterialTopTabNavigator","initialRouteName","backBehavior","children","screenListeners","screenOptions","swipeEnabled","lazy","lazyPlaceholder","lazyPreloadDistance","tabBarOptions","rest","defaultScreenOptions","Object","assign","tabBarActiveTintColor","activeTintColor","tabBarInactiveTintColor","inactiveTintColor","tabBarPressColor","pressColor","tabBarPressOpacity","pressOpacity","tabBarShowLabel","showLabel","tabBarShowIcon","showIcon","tabBarAllowFontScaling","allowFontScaling","tabBarBounces","bounces","tabBarScrollEnabled","scrollEnabled","tabBarIconStyle","iconStyle","tabBarLabelStyle","labelStyle","tabBarItemStyle","tabStyle","tabBarBadge","renderBadge","tabBarIndicator","renderIndicator","tabBarIndicatorStyle","indicatorStyle","tabBarIndicatorContainerStyle","indicatorContainerStyle","tabBarContentContainerStyle","contentContainerStyle","tabBarStyle","style","keys","forEach","key","undefined","JSON","stringify","deprecatedProps","entries","propName","propValue","toLowerCase","state","descriptors","navigation","NavigationContent","TabRouter"],"mappings":";;;;;;;AAAA;;AAUA;;AACA;;AAOA;;;;;;;;;;AAWA,SAASA,uBAAT,
|
|
1
|
+
{"version":3,"sources":["createMaterialTopTabNavigator.tsx"],"names":["MaterialTopTabNavigator","initialRouteName","backBehavior","children","screenListeners","screenOptions","restWithDeprecated","swipeEnabled","lazy","lazyPlaceholder","lazyPreloadDistance","tabBarOptions","rest","defaultScreenOptions","Object","assign","tabBarActiveTintColor","activeTintColor","tabBarInactiveTintColor","inactiveTintColor","tabBarPressColor","pressColor","tabBarPressOpacity","pressOpacity","tabBarShowLabel","showLabel","tabBarShowIcon","showIcon","tabBarAllowFontScaling","allowFontScaling","tabBarBounces","bounces","tabBarScrollEnabled","scrollEnabled","tabBarIconStyle","iconStyle","tabBarLabelStyle","labelStyle","tabBarItemStyle","tabStyle","tabBarBadge","renderBadge","tabBarIndicator","renderIndicator","tabBarIndicatorStyle","indicatorStyle","tabBarIndicatorContainerStyle","indicatorContainerStyle","tabBarContentContainerStyle","contentContainerStyle","tabBarStyle","style","keys","forEach","key","undefined","JSON","stringify","deprecatedProps","entries","propName","propValue","toLowerCase","state","descriptors","navigation","NavigationContent","TabRouter"],"mappings":";;;;;;;AAAA;;AAUA;;AACA;;AAOA;;;;;;;;;;AAWA,SAASA,uBAAT,OAOU;AAAA,MAPuB;AAC/BC,IAAAA,gBAD+B;AAE/BC,IAAAA,YAF+B;AAG/BC,IAAAA,QAH+B;AAI/BC,IAAAA,eAJ+B;AAK/BC,IAAAA,aAL+B;AAM/B,OAAGC;AAN4B,GAOvB;AACR,QAAM;AACJ;AACAC,IAAAA,YAFI;AAGJ;AACAC,IAAAA,IAJI;AAKJ;AACAC,IAAAA,eANI;AAOJ;AACAC,IAAAA,mBARI;AASJ;AACAC,IAAAA,aAVI;AAWJ,OAAGC;AAXC,MAYFN,kBAZJ;AAcA,MAAIO,oBAAqD,GAAG,EAA5D;;AAEA,MAAIF,aAAJ,EAAmB;AACjBG,IAAAA,MAAM,CAACC,MAAP,CAAcF,oBAAd,EAAoC;AAClCG,MAAAA,qBAAqB,EAAEL,aAAa,CAACM,eADH;AAElCC,MAAAA,uBAAuB,EAAEP,aAAa,CAACQ,iBAFL;AAGlCC,MAAAA,gBAAgB,EAAET,aAAa,CAACU,UAHE;AAIlCC,MAAAA,kBAAkB,EAAEX,aAAa,CAACY,YAJA;AAKlCC,MAAAA,eAAe,EAAEb,aAAa,CAACc,SALG;AAMlCC,MAAAA,cAAc,EAAEf,aAAa,CAACgB,QANI;AAOlCC,MAAAA,sBAAsB,EAAEjB,aAAa,CAACkB,gBAPJ;AAQlCC,MAAAA,aAAa,EAAEnB,aAAa,CAACoB,OARK;AASlCC,MAAAA,mBAAmB,EAAErB,aAAa,CAACsB,aATD;AAUlCC,MAAAA,eAAe,EAAEvB,aAAa,C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AAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA,UAAtB;AAAkCC,IAAAA;AAAlC,MACJ,kCAMEC,iBANF,EAMa;AACXlE,IAAAA,gBADW;AAEXC,IAAAA,YAFW;AAGXC,IAAAA,QAHW;AAIXC,IAAAA,eAJW;AAKXC,IAAAA,aALW;AAMXQ,IAAAA;AANW,GANb,CADF;AAgBA,sBACE,oBAAC,iBAAD,qBACE,oBAAC,2BAAD,eACMD,IADN;AAEE,IAAA,KAAK,EAAEmD,KAFT;AAGE,IAAA,UAAU,EAAEE,UAHd;AAIE,IAAA,WAAW,EAAED;AAJf,KADF,CADF;AAUD;;eAEc,oCAKbhE,uBALa,C","sourcesContent":["import {\n createNavigatorFactory,\n DefaultNavigatorOptions,\n ParamListBase,\n TabActionHelpers,\n TabNavigationState,\n TabRouter,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport warnOnce from 'warn-once';\n\nimport type {\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationEventMap,\n MaterialTopTabNavigationOptions,\n} from '../types';\nimport MaterialTopTabView from '../views/MaterialTopTabView';\n\ntype Props = DefaultNavigatorOptions<\n ParamListBase,\n TabNavigationState<ParamListBase>,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationEventMap\n> &\n TabRouterOptions &\n MaterialTopTabNavigationConfig;\n\nfunction MaterialTopTabNavigator({\n initialRouteName,\n backBehavior,\n children,\n screenListeners,\n screenOptions,\n ...restWithDeprecated\n}: Props) {\n const {\n // @ts-expect-error: swipeEnabled is deprecated\n swipeEnabled,\n // @ts-expect-error: lazy is deprecated\n lazy,\n // @ts-expect-error: lazyPlaceholder is deprecated\n lazyPlaceholder,\n // @ts-expect-error: lazyPreloadDistance is deprecated\n lazyPreloadDistance,\n // @ts-expect-error: tabBarOptions is deprecated\n tabBarOptions,\n ...rest\n } = restWithDeprecated;\n\n let defaultScreenOptions: MaterialTopTabNavigationOptions = {};\n\n if (tabBarOptions) {\n Object.assign(defaultScreenOptions, {\n tabBarActiveTintColor: tabBarOptions.activeTintColor,\n tabBarInactiveTintColor: tabBarOptions.inactiveTintColor,\n tabBarPressColor: tabBarOptions.pressColor,\n tabBarPressOpacity: tabBarOptions.pressOpacity,\n tabBarShowLabel: tabBarOptions.showLabel,\n tabBarShowIcon: tabBarOptions.showIcon,\n tabBarAllowFontScaling: tabBarOptions.allowFontScaling,\n tabBarBounces: tabBarOptions.bounces,\n tabBarScrollEnabled: tabBarOptions.scrollEnabled,\n tabBarIconStyle: tabBarOptions.iconStyle,\n tabBarLabelStyle: tabBarOptions.labelStyle,\n tabBarItemStyle: tabBarOptions.tabStyle,\n tabBarBadge: tabBarOptions.renderBadge,\n tabBarIndicator: tabBarOptions.renderIndicator,\n tabBarIndicatorStyle: tabBarOptions.indicatorStyle,\n tabBarIndicatorContainerStyle: tabBarOptions.indicatorContainerStyle,\n tabBarContentContainerStyle: tabBarOptions.contentContainerStyle,\n tabBarStyle: tabBarOptions.style,\n });\n\n (\n Object.keys(\n defaultScreenOptions\n ) as (keyof MaterialTopTabNavigationOptions)[]\n ).forEach((key) => {\n if (defaultScreenOptions[key] === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete defaultScreenOptions[key];\n }\n });\n\n warnOnce(\n tabBarOptions,\n `Material Top Tab Navigator: 'tabBarOptions' is deprecated. Migrate the options to 'screenOptions' instead.\\n\\nPlace the following in 'screenOptions' in your code to keep current behavior:\\n\\n${JSON.stringify(\n defaultScreenOptions,\n null,\n 2\n )}\\n\\nSee https://reactnavigation.org/docs/material-top-tab-navigator#options for more details.`\n );\n }\n\n const deprecatedProps = {\n swipeEnabled,\n lazy,\n lazyPlaceholder,\n lazyPreloadDistance,\n } as const;\n\n Object.entries(deprecatedProps).forEach(([propName, propValue]) => {\n if (propValue !== undefined) {\n // @ts-expect-error: Object.entries doesn't return strict types\n defaultScreenOptions[propName] = propValue;\n\n warnOnce(\n true,\n `Material Top Tab Navigator: '${propName}' in props is deprecated. Move it to 'screenOptions' instead.\\n\\nSee https://reactnavigation.org/docs/material-top-tab-navigator#${propName.toLowerCase()} for more details.`\n );\n }\n });\n\n const { state, descriptors, navigation, NavigationContent } =\n useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n TabActionHelpers<ParamListBase>,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationEventMap\n >(TabRouter, {\n initialRouteName,\n backBehavior,\n children,\n screenListeners,\n screenOptions,\n defaultScreenOptions,\n });\n\n return (\n <NavigationContent>\n <MaterialTopTabView\n {...rest}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n />\n </NavigationContent>\n );\n}\n\nexport default createNavigatorFactory<\n TabNavigationState<ParamListBase>,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationEventMap,\n typeof MaterialTopTabNavigator\n>(MaterialTopTabNavigator);\n"]}
|
|
@@ -23,14 +23,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
23
|
|
|
24
24
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
25
|
|
|
26
|
-
function TabBarTop({
|
|
27
|
-
state,
|
|
28
|
-
navigation,
|
|
29
|
-
descriptors,
|
|
30
|
-
...rest
|
|
31
|
-
}) {
|
|
26
|
+
function TabBarTop(_ref) {
|
|
32
27
|
var _focusedOptions$tabBa, _focusedOptions$tabBa2;
|
|
33
28
|
|
|
29
|
+
let {
|
|
30
|
+
state,
|
|
31
|
+
navigation,
|
|
32
|
+
descriptors,
|
|
33
|
+
...rest
|
|
34
|
+
} = _ref;
|
|
34
35
|
const {
|
|
35
36
|
colors
|
|
36
37
|
} = (0, _native.useTheme)();
|
|
@@ -54,16 +55,23 @@ function TabBarTop({
|
|
|
54
55
|
style: [{
|
|
55
56
|
backgroundColor: colors.card
|
|
56
57
|
}, focusedOptions.tabBarStyle],
|
|
57
|
-
getAccessibilityLabel:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
route
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
getAccessibilityLabel: _ref2 => {
|
|
59
|
+
let {
|
|
60
|
+
route
|
|
61
|
+
} = _ref2;
|
|
62
|
+
return descriptors[route.key].options.tabBarAccessibilityLabel;
|
|
63
|
+
},
|
|
64
|
+
getTestID: _ref3 => {
|
|
65
|
+
let {
|
|
66
|
+
route
|
|
67
|
+
} = _ref3;
|
|
68
|
+
return descriptors[route.key].options.tabBarTestID;
|
|
69
|
+
},
|
|
70
|
+
onTabPress: _ref4 => {
|
|
71
|
+
let {
|
|
72
|
+
route,
|
|
73
|
+
preventDefault
|
|
74
|
+
} = _ref4;
|
|
67
75
|
const event = navigation.emit({
|
|
68
76
|
type: 'tabPress',
|
|
69
77
|
target: route.key,
|
|
@@ -74,17 +82,21 @@ function TabBarTop({
|
|
|
74
82
|
preventDefault();
|
|
75
83
|
}
|
|
76
84
|
},
|
|
77
|
-
onTabLongPress:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
onTabLongPress: _ref5 => {
|
|
86
|
+
let {
|
|
87
|
+
route
|
|
88
|
+
} = _ref5;
|
|
89
|
+
return navigation.emit({
|
|
90
|
+
type: 'tabLongPress',
|
|
91
|
+
target: route.key
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
renderIcon: _ref6 => {
|
|
95
|
+
let {
|
|
96
|
+
route,
|
|
97
|
+
focused,
|
|
98
|
+
color
|
|
99
|
+
} = _ref6;
|
|
88
100
|
const {
|
|
89
101
|
options
|
|
90
102
|
} = descriptors[route.key];
|
|
@@ -105,11 +117,12 @@ function TabBarTop({
|
|
|
105
117
|
|
|
106
118
|
return null;
|
|
107
119
|
},
|
|
108
|
-
renderLabel:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
renderLabel: _ref7 => {
|
|
121
|
+
let {
|
|
122
|
+
route,
|
|
123
|
+
focused,
|
|
124
|
+
color
|
|
125
|
+
} = _ref7;
|
|
113
126
|
const {
|
|
114
127
|
options
|
|
115
128
|
} = descriptors[route.key];
|
|
@@ -134,20 +147,22 @@ function TabBarTop({
|
|
|
134
147
|
color
|
|
135
148
|
});
|
|
136
149
|
},
|
|
137
|
-
renderBadge:
|
|
138
|
-
route
|
|
139
|
-
}) => {
|
|
150
|
+
renderBadge: _ref8 => {
|
|
140
151
|
var _tabBarBadge;
|
|
141
152
|
|
|
153
|
+
let {
|
|
154
|
+
route
|
|
155
|
+
} = _ref8;
|
|
142
156
|
const {
|
|
143
157
|
tabBarBadge
|
|
144
158
|
} = descriptors[route.key].options;
|
|
145
159
|
return (_tabBarBadge = tabBarBadge === null || tabBarBadge === void 0 ? void 0 : tabBarBadge()) !== null && _tabBarBadge !== void 0 ? _tabBarBadge : null;
|
|
146
160
|
},
|
|
147
|
-
renderIndicator:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
161
|
+
renderIndicator: _ref9 => {
|
|
162
|
+
let {
|
|
163
|
+
navigationState: state,
|
|
164
|
+
...rest
|
|
165
|
+
} = _ref9;
|
|
151
166
|
return focusedOptions.tabBarIndicator ? focusedOptions.tabBarIndicator({
|
|
152
167
|
state: state,
|
|
153
168
|
...rest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MaterialTopTabBar.tsx"],"names":["TabBarTop","state","navigation","descriptors","rest","colors","focusedOptions","routes","index","key","options","activeColor","tabBarActiveTintColor","text","inactiveColor","tabBarInactiveTintColor","alpha","rgb","string","tabBarScrollEnabled","tabBarBounces","tabBarPressColor","tabBarPressOpacity","tabBarItemStyle","backgroundColor","primary","tabBarIndicatorStyle","tabBarIndicatorContainerStyle","tabBarContentContainerStyle","card","tabBarStyle","route","tabBarAccessibilityLabel","tabBarTestID","preventDefault","event","emit","type","target","canPreventDefault","defaultPrevented","focused","color","tabBarShowIcon","tabBarIcon","undefined","icon","styles","tabBarIconStyle","tabBarShowLabel","label","tabBarLabel","title","name","tabBarLabelStyle","tabBarAllowFontScaling","tabBarBadge","navigationState","tabBarIndicator","StyleSheet","create","height","width","textAlign","textTransform","fontSize","margin"],"mappings":";;;;;;;AAAA;;AAMA;;AACA;;AACA;;AACA;;;;;;;;;;AAIe,SAASA,SAAT,
|
|
1
|
+
{"version":3,"sources":["MaterialTopTabBar.tsx"],"names":["TabBarTop","state","navigation","descriptors","rest","colors","focusedOptions","routes","index","key","options","activeColor","tabBarActiveTintColor","text","inactiveColor","tabBarInactiveTintColor","alpha","rgb","string","tabBarScrollEnabled","tabBarBounces","tabBarPressColor","tabBarPressOpacity","tabBarItemStyle","backgroundColor","primary","tabBarIndicatorStyle","tabBarIndicatorContainerStyle","tabBarContentContainerStyle","card","tabBarStyle","route","tabBarAccessibilityLabel","tabBarTestID","preventDefault","event","emit","type","target","canPreventDefault","defaultPrevented","focused","color","tabBarShowIcon","tabBarIcon","undefined","icon","styles","tabBarIconStyle","tabBarShowLabel","label","tabBarLabel","title","name","tabBarLabelStyle","tabBarAllowFontScaling","tabBarBadge","navigationState","tabBarIndicator","StyleSheet","create","height","width","textAlign","textTransform","fontSize","margin"],"mappings":";;;;;;;AAAA;;AAMA;;AACA;;AACA;;AACA;;;;;;;;;;AAIe,SAASA,SAAT,OAKY;AAAA;;AAAA,MALO;AAChCC,IAAAA,KADgC;AAEhCC,IAAAA,UAFgC;AAGhCC,IAAAA,WAHgC;AAIhC,OAAGC;AAJ6B,GAKP;AACzB,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;AAEA,QAAMC,cAAc,GAAGH,WAAW,CAACF,KAAK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,cAAc,CAACoD,eAAf,GACLpD,cAAc,CAACoD,eAAf,CAA+B;AAC7BzD,QAAAA,KAAK,EAAEA,KADsB;AAE7B,WAAGG;AAF0B,OAA/B,CADK,gBAML,oBAAC,mCAAD;AAAiB,QAAA,eAAe,EAAEH;AAAlC,SAA6CG,IAA7C,EANF;AAQD;AAhGH,KADF;AAoGD;;AAED,MAAM2C,MAAM,GAAGY,wBAAWC,MAAX,CAAkB;AAC/Bd,EAAAA,IAAI,EAAE;AACJe,IAAAA,MAAM,EAAE,EADJ;AAEJC,IAAAA,KAAK,EAAE;AAFH,GADyB;AAK/BZ,EAAAA,KAAK,EAAE;AACLa,IAAAA,SAAS,EAAE,QADN;AAELC,IAAAA,aAAa,EAAE,WAFV;AAGLC,IAAAA,QAAQ,EAAE,EAHL;AAILC,IAAAA,MAAM,EAAE,CAJH;AAKL1C,IAAAA,eAAe,EAAE;AALZ;AALwB,CAAlB,CAAf","sourcesContent":["import {\n ParamListBase,\n Route,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport Color from 'color';\nimport * as React from 'react';\nimport { StyleSheet, Text, View } from 'react-native';\nimport { TabBar, TabBarIndicator } from 'react-native-tab-view';\n\nimport type { MaterialTopTabBarProps } from '../types';\n\nexport default function TabBarTop({\n state,\n navigation,\n descriptors,\n ...rest\n}: MaterialTopTabBarProps) {\n const { colors } = useTheme();\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n const activeColor = focusedOptions.tabBarActiveTintColor ?? colors.text;\n const inactiveColor =\n focusedOptions.tabBarInactiveTintColor ??\n Color(activeColor).alpha(0.5).rgb().string();\n\n return (\n <TabBar\n {...rest}\n navigationState={state}\n scrollEnabled={focusedOptions.tabBarScrollEnabled}\n bounces={focusedOptions.tabBarBounces}\n activeColor={activeColor}\n inactiveColor={inactiveColor}\n pressColor={focusedOptions.tabBarPressColor}\n pressOpacity={focusedOptions.tabBarPressOpacity}\n tabStyle={focusedOptions.tabBarItemStyle}\n indicatorStyle={[\n { backgroundColor: colors.primary },\n focusedOptions.tabBarIndicatorStyle,\n ]}\n indicatorContainerStyle={focusedOptions.tabBarIndicatorContainerStyle}\n contentContainerStyle={focusedOptions.tabBarContentContainerStyle}\n style={[{ backgroundColor: colors.card }, focusedOptions.tabBarStyle]}\n getAccessibilityLabel={({ route }) =>\n descriptors[route.key].options.tabBarAccessibilityLabel\n }\n getTestID={({ route }) => descriptors[route.key].options.tabBarTestID}\n onTabPress={({ route, preventDefault }) => {\n const event = navigation.emit({\n type: 'tabPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (event.defaultPrevented) {\n preventDefault();\n }\n }}\n onTabLongPress={({ route }) =>\n navigation.emit({\n type: 'tabLongPress',\n target: route.key,\n })\n }\n renderIcon={({ route, focused, color }) => {\n const { options } = descriptors[route.key];\n\n if (options.tabBarShowIcon === false) {\n return null;\n }\n\n if (options.tabBarIcon !== undefined) {\n const icon = options.tabBarIcon({ focused, color });\n\n return (\n <View style={[styles.icon, options.tabBarIconStyle]}>{icon}</View>\n );\n }\n\n return null;\n }}\n renderLabel={({ route, focused, color }) => {\n const { options } = descriptors[route.key];\n\n if (options.tabBarShowLabel === false) {\n return null;\n }\n\n const label =\n options.tabBarLabel !== undefined\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : (route as Route<string>).name;\n\n if (typeof label === 'string') {\n return (\n <Text\n style={[styles.label, { color }, options.tabBarLabelStyle]}\n allowFontScaling={options.tabBarAllowFontScaling}\n >\n {label}\n </Text>\n );\n }\n\n return label({ focused, color });\n }}\n renderBadge={({ route }) => {\n const { tabBarBadge } = descriptors[route.key].options;\n\n return tabBarBadge?.() ?? null;\n }}\n renderIndicator={({ navigationState: state, ...rest }) => {\n return focusedOptions.tabBarIndicator ? (\n focusedOptions.tabBarIndicator({\n state: state as TabNavigationState<ParamListBase>,\n ...rest,\n })\n ) : (\n <TabBarIndicator navigationState={state} {...rest} />\n );\n }}\n />\n );\n}\n\nconst styles = StyleSheet.create({\n icon: {\n height: 24,\n width: 24,\n },\n label: {\n textAlign: 'center',\n textTransform: 'uppercase',\n fontSize: 13,\n margin: 4,\n backgroundColor: 'transparent',\n },\n});\n"]}
|
|
@@ -21,14 +21,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
21
|
|
|
22
22
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
23
|
|
|
24
|
-
function MaterialTopTabView({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
function MaterialTopTabView(_ref) {
|
|
25
|
+
let {
|
|
26
|
+
tabBar = props => /*#__PURE__*/React.createElement(_MaterialTopTabBar.default, props),
|
|
27
|
+
state,
|
|
28
|
+
navigation,
|
|
29
|
+
descriptors,
|
|
30
|
+
sceneContainerStyle,
|
|
31
|
+
...rest
|
|
32
|
+
} = _ref;
|
|
32
33
|
const {
|
|
33
34
|
colors
|
|
34
35
|
} = (0, _native.useTheme)();
|
|
@@ -49,21 +50,28 @@ function MaterialTopTabView({
|
|
|
49
50
|
}),
|
|
50
51
|
target: state.key
|
|
51
52
|
}),
|
|
52
|
-
renderScene:
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
renderScene: _ref2 => {
|
|
54
|
+
let {
|
|
55
|
+
route
|
|
56
|
+
} = _ref2;
|
|
57
|
+
return descriptors[route.key].render();
|
|
58
|
+
},
|
|
55
59
|
navigationState: state,
|
|
56
60
|
renderTabBar: renderTabBar,
|
|
57
|
-
renderLazyPlaceholder:
|
|
58
|
-
route
|
|
59
|
-
}) => {
|
|
61
|
+
renderLazyPlaceholder: _ref3 => {
|
|
60
62
|
var _descriptors$route$ke, _descriptors$route$ke2, _descriptors$route$ke3;
|
|
61
63
|
|
|
64
|
+
let {
|
|
65
|
+
route
|
|
66
|
+
} = _ref3;
|
|
62
67
|
return (_descriptors$route$ke = (_descriptors$route$ke2 = (_descriptors$route$ke3 = descriptors[route.key].options).lazyPlaceholder) === null || _descriptors$route$ke2 === void 0 ? void 0 : _descriptors$route$ke2.call(_descriptors$route$ke3)) !== null && _descriptors$route$ke !== void 0 ? _descriptors$route$ke : null;
|
|
63
68
|
},
|
|
64
|
-
lazy:
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
lazy: _ref4 => {
|
|
70
|
+
let {
|
|
71
|
+
route
|
|
72
|
+
} = _ref4;
|
|
73
|
+
return descriptors[route.key].options.lazy === true;
|
|
74
|
+
},
|
|
67
75
|
lazyPreloadDistance: focusedOptions.lazyPreloadDistance,
|
|
68
76
|
swipeEnabled: focusedOptions.swipeEnabled,
|
|
69
77
|
onSwipeStart: () => navigation.emit({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MaterialTopTabView.tsx"],"names":["MaterialTopTabView","tabBar","props","state","navigation","descriptors","sceneContainerStyle","rest","colors","renderTabBar","focusedOptions","routes","index","key","options","dispatch","CommonActions","navigate","name","merge","target","route","render","lazyPlaceholder","lazy","lazyPreloadDistance","swipeEnabled","emit","type","backgroundColor","background"],"mappings":";;;;;;;AAAA;;AAOA;;AACA;;AAQA;;;;;;;;;;AAQe,SAASA,kBAAT,
|
|
1
|
+
{"version":3,"sources":["MaterialTopTabView.tsx"],"names":["MaterialTopTabView","tabBar","props","state","navigation","descriptors","sceneContainerStyle","rest","colors","renderTabBar","focusedOptions","routes","index","key","options","dispatch","CommonActions","navigate","name","merge","target","route","render","lazyPlaceholder","lazy","lazyPreloadDistance","swipeEnabled","emit","type","backgroundColor","background"],"mappings":";;;;;;;AAAA;;AAOA;;AACA;;AAQA;;;;;;;;;;AAQe,SAASA,kBAAT,OAOL;AAAA,MAPiC;AACzCC,IAAAA,MAAM,GAAIC,KAAD,iBAAmC,oBAAC,0BAAD,EA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AAA,KAdzB;AAiBE,IAAA,IAAI,EAAE;AAAA,UAAC;AAAEF,QAAAA;AAAF,OAAD;AAAA,aAAehB,WAAW,CAACgB,KAAK,CAACR,GAAP,CAAX,CAAuBC,OAAvB,CAA+BU,IAA/B,KAAwC,IAAvD;AAAA,KAjBR;AAkBE,IAAA,mBAAmB,EAAEd,cAAc,CAACe,mBAlBtC;AAmBE,IAAA,YAAY,EAAEf,cAAc,CAACgB,YAnB/B;AAoBE,IAAA,YAAY,EAAE,MAAMtB,UAAU,CAACuB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CApBtB;AAqBE,IAAA,UAAU,EAAE,MAAMxB,UAAU,CAACuB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CArBpB;AAsBE,IAAA,mBAAmB,EAAE,CACnB;AAAEC,MAAAA,eAAe,EAAErB,MAAM,CAACsB;AAA1B,KADmB,EAEnBxB,mBAFmB;AAtBvB,KADF;AA6BD","sourcesContent":["import {\n CommonActions,\n ParamListBase,\n Route,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { SceneRendererProps, TabView } from 'react-native-tab-view';\n\nimport type {\n MaterialTopTabBarProps,\n MaterialTopTabDescriptorMap,\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationHelpers,\n} from '../types';\nimport MaterialTopTabBar from './MaterialTopTabBar';\n\ntype Props = MaterialTopTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: MaterialTopTabNavigationHelpers;\n descriptors: MaterialTopTabDescriptorMap;\n};\n\nexport default function MaterialTopTabView({\n tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,\n state,\n navigation,\n descriptors,\n sceneContainerStyle,\n ...rest\n}: Props) {\n const { colors } = useTheme();\n\n const renderTabBar = (props: SceneRendererProps) => {\n return tabBar({\n ...props,\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n });\n };\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n return (\n <TabView<Route<string>>\n {...rest}\n onIndexChange={(index) =>\n navigation.dispatch({\n ...CommonActions.navigate({\n name: state.routes[index].name,\n merge: true,\n }),\n target: state.key,\n })\n }\n renderScene={({ route }) => descriptors[route.key].render()}\n navigationState={state}\n renderTabBar={renderTabBar}\n renderLazyPlaceholder={({ route }) =>\n descriptors[route.key].options.lazyPlaceholder?.() ?? null\n }\n lazy={({ route }) => descriptors[route.key].options.lazy === true}\n lazyPreloadDistance={focusedOptions.lazyPreloadDistance}\n swipeEnabled={focusedOptions.swipeEnabled}\n onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}\n onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}\n sceneContainerStyle={[\n { backgroundColor: colors.background },\n sceneContainerStyle,\n ]}\n />\n );\n}\n"]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["default","createMaterialTopTabNavigator","MaterialTopTabBar","MaterialTopTabView"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,6BAApB,QAAyD,4CAAzD;AAEA;AACA;AACA;;AACA,SAASD,OAAO,IAAIE,iBAApB,QAA6C,2BAA7C;AACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,4BAA9C;AAEA;AACA;AACA","sourcesContent":["/**\n * Navigators\n */\nexport { default as createMaterialTopTabNavigator } from './navigators/createMaterialTopTabNavigator';\n\n/**\n * Views\n */\nexport { default as MaterialTopTabBar } from './views/MaterialTopTabBar';\nexport { default as MaterialTopTabView } from './views/MaterialTopTabView';\n\n/**\n * Types\n */\nexport type {\n MaterialTopTabBarProps,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationProp,\n MaterialTopTabScreenProps,\n} from './types';\n"]}
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["default","createMaterialTopTabNavigator","MaterialTopTabBar","MaterialTopTabView"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,6BAApB,QAAyD,4CAAzD;AAEA;AACA;AACA;;AACA,SAASD,OAAO,IAAIE,iBAApB,QAA6C,2BAA7C;AACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,4BAA9C;AAEA;AACA;AACA","sourcesContent":["/**\n * Navigators\n */\nexport { default as createMaterialTopTabNavigator } from './navigators/createMaterialTopTabNavigator';\n\n/**\n * Views\n */\nexport { default as MaterialTopTabBar } from './views/MaterialTopTabBar';\nexport { default as MaterialTopTabView } from './views/MaterialTopTabView';\n\n/**\n * Types\n */\nexport type {\n MaterialTopTabBarProps,\n MaterialTopTabNavigationEventMap,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationProp,\n MaterialTopTabScreenProps,\n} from './types';\n"]}
|
|
@@ -5,24 +5,28 @@ import * as React from 'react';
|
|
|
5
5
|
import warnOnce from 'warn-once';
|
|
6
6
|
import MaterialTopTabView from '../views/MaterialTopTabView';
|
|
7
7
|
|
|
8
|
-
function MaterialTopTabNavigator({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
function MaterialTopTabNavigator(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
initialRouteName,
|
|
11
|
+
backBehavior,
|
|
12
|
+
children,
|
|
13
|
+
screenListeners,
|
|
14
|
+
screenOptions,
|
|
15
|
+
...restWithDeprecated
|
|
16
|
+
} = _ref;
|
|
17
|
+
const {
|
|
18
|
+
// @ts-expect-error: swipeEnabled is deprecated
|
|
19
|
+
swipeEnabled,
|
|
20
|
+
// @ts-expect-error: lazy is deprecated
|
|
21
|
+
lazy,
|
|
22
|
+
// @ts-expect-error: lazyPlaceholder is deprecated
|
|
23
|
+
lazyPlaceholder,
|
|
24
|
+
// @ts-expect-error: lazyPreloadDistance is deprecated
|
|
25
|
+
lazyPreloadDistance,
|
|
26
|
+
// @ts-expect-error: tabBarOptions is deprecated
|
|
27
|
+
tabBarOptions,
|
|
28
|
+
...rest
|
|
29
|
+
} = restWithDeprecated;
|
|
26
30
|
let defaultScreenOptions = {};
|
|
27
31
|
|
|
28
32
|
if (tabBarOptions) {
|
|
@@ -61,7 +65,9 @@ function MaterialTopTabNavigator({
|
|
|
61
65
|
lazyPlaceholder,
|
|
62
66
|
lazyPreloadDistance
|
|
63
67
|
};
|
|
64
|
-
Object.entries(deprecatedProps).forEach(
|
|
68
|
+
Object.entries(deprecatedProps).forEach(_ref2 => {
|
|
69
|
+
let [propName, propValue] = _ref2;
|
|
70
|
+
|
|
65
71
|
if (propValue !== undefined) {
|
|
66
72
|
// @ts-expect-error: Object.entries doesn't return strict types
|
|
67
73
|
defaultScreenOptions[propName] = propValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["createMaterialTopTabNavigator.tsx"],"names":["createNavigatorFactory","TabRouter","useNavigationBuilder","React","warnOnce","MaterialTopTabView","MaterialTopTabNavigator","initialRouteName","backBehavior","children","screenListeners","screenOptions","swipeEnabled","lazy","lazyPlaceholder","lazyPreloadDistance","tabBarOptions","rest","defaultScreenOptions","Object","assign","tabBarActiveTintColor","activeTintColor","tabBarInactiveTintColor","inactiveTintColor","tabBarPressColor","pressColor","tabBarPressOpacity","pressOpacity","tabBarShowLabel","showLabel","tabBarShowIcon","showIcon","tabBarAllowFontScaling","allowFontScaling","tabBarBounces","bounces","tabBarScrollEnabled","scrollEnabled","tabBarIconStyle","iconStyle","tabBarLabelStyle","labelStyle","tabBarItemStyle","tabStyle","tabBarBadge","renderBadge","tabBarIndicator","renderIndicator","tabBarIndicatorStyle","indicatorStyle","tabBarIndicatorContainerStyle","indicatorContainerStyle","tabBarContentContainerStyle","contentContainerStyle","tabBarStyle","style","keys","forEach","key","undefined","JSON","stringify","deprecatedProps","entries","propName","propValue","toLowerCase","state","descriptors","navigation","NavigationContent"],"mappings":";;AAAA,SACEA,sBADF,EAMEC,SANF,EAQEC,oBARF,QASO,0BATP;AAUA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,QAAP,MAAqB,WAArB;AAOA,OAAOC,kBAAP,MAA+B,6BAA/B;;AAWA,SAASC,uBAAT,
|
|
1
|
+
{"version":3,"sources":["createMaterialTopTabNavigator.tsx"],"names":["createNavigatorFactory","TabRouter","useNavigationBuilder","React","warnOnce","MaterialTopTabView","MaterialTopTabNavigator","initialRouteName","backBehavior","children","screenListeners","screenOptions","restWithDeprecated","swipeEnabled","lazy","lazyPlaceholder","lazyPreloadDistance","tabBarOptions","rest","defaultScreenOptions","Object","assign","tabBarActiveTintColor","activeTintColor","tabBarInactiveTintColor","inactiveTintColor","tabBarPressColor","pressColor","tabBarPressOpacity","pressOpacity","tabBarShowLabel","showLabel","tabBarShowIcon","showIcon","tabBarAllowFontScaling","allowFontScaling","tabBarBounces","bounces","tabBarScrollEnabled","scrollEnabled","tabBarIconStyle","iconStyle","tabBarLabelStyle","labelStyle","tabBarItemStyle","tabStyle","tabBarBadge","renderBadge","tabBarIndicator","renderIndicator","tabBarIndicatorStyle","indicatorStyle","tabBarIndicatorContainerStyle","indicatorContainerStyle","tabBarContentContainerStyle","contentContainerStyle","tabBarStyle","style","keys","forEach","key","undefined","JSON","stringify","deprecatedProps","entries","propName","propValue","toLowerCase","state","descriptors","navigation","NavigationContent"],"mappings":";;AAAA,SACEA,sBADF,EAMEC,SANF,EAQEC,oBARF,QASO,0BATP;AAUA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,QAAP,MAAqB,WAArB;AAOA,OAAOC,kBAAP,MAA+B,6BAA/B;;AAWA,SAASC,uBAAT,OAOU;AAAA,MAPuB;AAC/BC,IAAAA,gBAD+B;AAE/BC,IAAAA,YAF+B;AAG/BC,IAAAA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KAFT;AAGE,IAAA,UAAU,EAAEE,UAHd;AAIE,IAAA,WAAW,EAAED;AAJf,KADF,CADF;AAUD;;AAED,eAAetE,sBAAsB,CAKnCM,uBALmC,CAArC","sourcesContent":["import {\n createNavigatorFactory,\n DefaultNavigatorOptions,\n ParamListBase,\n TabActionHelpers,\n TabNavigationState,\n TabRouter,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport warnOnce from 'warn-once';\n\nimport type {\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationEventMap,\n MaterialTopTabNavigationOptions,\n} from '../types';\nimport MaterialTopTabView from '../views/MaterialTopTabView';\n\ntype Props = DefaultNavigatorOptions<\n ParamListBase,\n TabNavigationState<ParamListBase>,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationEventMap\n> &\n TabRouterOptions &\n MaterialTopTabNavigationConfig;\n\nfunction MaterialTopTabNavigator({\n initialRouteName,\n backBehavior,\n children,\n screenListeners,\n screenOptions,\n ...restWithDeprecated\n}: Props) {\n const {\n // @ts-expect-error: swipeEnabled is deprecated\n swipeEnabled,\n // @ts-expect-error: lazy is deprecated\n lazy,\n // @ts-expect-error: lazyPlaceholder is deprecated\n lazyPlaceholder,\n // @ts-expect-error: lazyPreloadDistance is deprecated\n lazyPreloadDistance,\n // @ts-expect-error: tabBarOptions is deprecated\n tabBarOptions,\n ...rest\n } = restWithDeprecated;\n\n let defaultScreenOptions: MaterialTopTabNavigationOptions = {};\n\n if (tabBarOptions) {\n Object.assign(defaultScreenOptions, {\n tabBarActiveTintColor: tabBarOptions.activeTintColor,\n tabBarInactiveTintColor: tabBarOptions.inactiveTintColor,\n tabBarPressColor: tabBarOptions.pressColor,\n tabBarPressOpacity: tabBarOptions.pressOpacity,\n tabBarShowLabel: tabBarOptions.showLabel,\n tabBarShowIcon: tabBarOptions.showIcon,\n tabBarAllowFontScaling: tabBarOptions.allowFontScaling,\n tabBarBounces: tabBarOptions.bounces,\n tabBarScrollEnabled: tabBarOptions.scrollEnabled,\n tabBarIconStyle: tabBarOptions.iconStyle,\n tabBarLabelStyle: tabBarOptions.labelStyle,\n tabBarItemStyle: tabBarOptions.tabStyle,\n tabBarBadge: tabBarOptions.renderBadge,\n tabBarIndicator: tabBarOptions.renderIndicator,\n tabBarIndicatorStyle: tabBarOptions.indicatorStyle,\n tabBarIndicatorContainerStyle: tabBarOptions.indicatorContainerStyle,\n tabBarContentContainerStyle: tabBarOptions.contentContainerStyle,\n tabBarStyle: tabBarOptions.style,\n });\n\n (\n Object.keys(\n defaultScreenOptions\n ) as (keyof MaterialTopTabNavigationOptions)[]\n ).forEach((key) => {\n if (defaultScreenOptions[key] === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete defaultScreenOptions[key];\n }\n });\n\n warnOnce(\n tabBarOptions,\n `Material Top Tab Navigator: 'tabBarOptions' is deprecated. Migrate the options to 'screenOptions' instead.\\n\\nPlace the following in 'screenOptions' in your code to keep current behavior:\\n\\n${JSON.stringify(\n defaultScreenOptions,\n null,\n 2\n )}\\n\\nSee https://reactnavigation.org/docs/material-top-tab-navigator#options for more details.`\n );\n }\n\n const deprecatedProps = {\n swipeEnabled,\n lazy,\n lazyPlaceholder,\n lazyPreloadDistance,\n } as const;\n\n Object.entries(deprecatedProps).forEach(([propName, propValue]) => {\n if (propValue !== undefined) {\n // @ts-expect-error: Object.entries doesn't return strict types\n defaultScreenOptions[propName] = propValue;\n\n warnOnce(\n true,\n `Material Top Tab Navigator: '${propName}' in props is deprecated. Move it to 'screenOptions' instead.\\n\\nSee https://reactnavigation.org/docs/material-top-tab-navigator#${propName.toLowerCase()} for more details.`\n );\n }\n });\n\n const { state, descriptors, navigation, NavigationContent } =\n useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n TabActionHelpers<ParamListBase>,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationEventMap\n >(TabRouter, {\n initialRouteName,\n backBehavior,\n children,\n screenListeners,\n screenOptions,\n defaultScreenOptions,\n });\n\n return (\n <NavigationContent>\n <MaterialTopTabView\n {...rest}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n />\n </NavigationContent>\n );\n}\n\nexport default createNavigatorFactory<\n TabNavigationState<ParamListBase>,\n MaterialTopTabNavigationOptions,\n MaterialTopTabNavigationEventMap,\n typeof MaterialTopTabNavigator\n>(MaterialTopTabNavigator);\n"]}
|
|
@@ -5,14 +5,15 @@ import Color from 'color';
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { StyleSheet, Text, View } from 'react-native';
|
|
7
7
|
import { TabBar, TabBarIndicator } from 'react-native-tab-view';
|
|
8
|
-
export default function TabBarTop({
|
|
9
|
-
state,
|
|
10
|
-
navigation,
|
|
11
|
-
descriptors,
|
|
12
|
-
...rest
|
|
13
|
-
}) {
|
|
8
|
+
export default function TabBarTop(_ref) {
|
|
14
9
|
var _focusedOptions$tabBa, _focusedOptions$tabBa2;
|
|
15
10
|
|
|
11
|
+
let {
|
|
12
|
+
state,
|
|
13
|
+
navigation,
|
|
14
|
+
descriptors,
|
|
15
|
+
...rest
|
|
16
|
+
} = _ref;
|
|
16
17
|
const {
|
|
17
18
|
colors
|
|
18
19
|
} = useTheme();
|
|
@@ -36,16 +37,23 @@ export default function TabBarTop({
|
|
|
36
37
|
style: [{
|
|
37
38
|
backgroundColor: colors.card
|
|
38
39
|
}, focusedOptions.tabBarStyle],
|
|
39
|
-
getAccessibilityLabel:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
route
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
getAccessibilityLabel: _ref2 => {
|
|
41
|
+
let {
|
|
42
|
+
route
|
|
43
|
+
} = _ref2;
|
|
44
|
+
return descriptors[route.key].options.tabBarAccessibilityLabel;
|
|
45
|
+
},
|
|
46
|
+
getTestID: _ref3 => {
|
|
47
|
+
let {
|
|
48
|
+
route
|
|
49
|
+
} = _ref3;
|
|
50
|
+
return descriptors[route.key].options.tabBarTestID;
|
|
51
|
+
},
|
|
52
|
+
onTabPress: _ref4 => {
|
|
53
|
+
let {
|
|
54
|
+
route,
|
|
55
|
+
preventDefault
|
|
56
|
+
} = _ref4;
|
|
49
57
|
const event = navigation.emit({
|
|
50
58
|
type: 'tabPress',
|
|
51
59
|
target: route.key,
|
|
@@ -56,17 +64,21 @@ export default function TabBarTop({
|
|
|
56
64
|
preventDefault();
|
|
57
65
|
}
|
|
58
66
|
},
|
|
59
|
-
onTabLongPress:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
onTabLongPress: _ref5 => {
|
|
68
|
+
let {
|
|
69
|
+
route
|
|
70
|
+
} = _ref5;
|
|
71
|
+
return navigation.emit({
|
|
72
|
+
type: 'tabLongPress',
|
|
73
|
+
target: route.key
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
renderIcon: _ref6 => {
|
|
77
|
+
let {
|
|
78
|
+
route,
|
|
79
|
+
focused,
|
|
80
|
+
color
|
|
81
|
+
} = _ref6;
|
|
70
82
|
const {
|
|
71
83
|
options
|
|
72
84
|
} = descriptors[route.key];
|
|
@@ -87,11 +99,12 @@ export default function TabBarTop({
|
|
|
87
99
|
|
|
88
100
|
return null;
|
|
89
101
|
},
|
|
90
|
-
renderLabel:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
renderLabel: _ref7 => {
|
|
103
|
+
let {
|
|
104
|
+
route,
|
|
105
|
+
focused,
|
|
106
|
+
color
|
|
107
|
+
} = _ref7;
|
|
95
108
|
const {
|
|
96
109
|
options
|
|
97
110
|
} = descriptors[route.key];
|
|
@@ -116,20 +129,22 @@ export default function TabBarTop({
|
|
|
116
129
|
color
|
|
117
130
|
});
|
|
118
131
|
},
|
|
119
|
-
renderBadge:
|
|
120
|
-
route
|
|
121
|
-
}) => {
|
|
132
|
+
renderBadge: _ref8 => {
|
|
122
133
|
var _tabBarBadge;
|
|
123
134
|
|
|
135
|
+
let {
|
|
136
|
+
route
|
|
137
|
+
} = _ref8;
|
|
124
138
|
const {
|
|
125
139
|
tabBarBadge
|
|
126
140
|
} = descriptors[route.key].options;
|
|
127
141
|
return (_tabBarBadge = tabBarBadge === null || tabBarBadge === void 0 ? void 0 : tabBarBadge()) !== null && _tabBarBadge !== void 0 ? _tabBarBadge : null;
|
|
128
142
|
},
|
|
129
|
-
renderIndicator:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
renderIndicator: _ref9 => {
|
|
144
|
+
let {
|
|
145
|
+
navigationState: state,
|
|
146
|
+
...rest
|
|
147
|
+
} = _ref9;
|
|
133
148
|
return focusedOptions.tabBarIndicator ? focusedOptions.tabBarIndicator({
|
|
134
149
|
state: state,
|
|
135
150
|
...rest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MaterialTopTabBar.tsx"],"names":["useTheme","Color","React","StyleSheet","Text","View","TabBar","TabBarIndicator","TabBarTop","state","navigation","descriptors","rest","colors","focusedOptions","routes","index","key","options","activeColor","tabBarActiveTintColor","text","inactiveColor","tabBarInactiveTintColor","alpha","rgb","string","tabBarScrollEnabled","tabBarBounces","tabBarPressColor","tabBarPressOpacity","tabBarItemStyle","backgroundColor","primary","tabBarIndicatorStyle","tabBarIndicatorContainerStyle","tabBarContentContainerStyle","card","tabBarStyle","route","tabBarAccessibilityLabel","tabBarTestID","preventDefault","event","emit","type","target","canPreventDefault","defaultPrevented","focused","color","tabBarShowIcon","tabBarIcon","undefined","icon","styles","tabBarIconStyle","tabBarShowLabel","label","tabBarLabel","title","name","tabBarLabelStyle","tabBarAllowFontScaling","tabBarBadge","navigationState","tabBarIndicator","create","height","width","textAlign","textTransform","fontSize","margin"],"mappings":";;AAAA,SAIEA,QAJF,QAKO,0BALP;AAMA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,EAAqBC,IAArB,EAA2BC,IAA3B,QAAuC,cAAvC;AACA,SAASC,MAAT,EAAiBC,eAAjB,QAAwC,uBAAxC;AAIA,eAAe,SAASC,SAAT,
|
|
1
|
+
{"version":3,"sources":["MaterialTopTabBar.tsx"],"names":["useTheme","Color","React","StyleSheet","Text","View","TabBar","TabBarIndicator","TabBarTop","state","navigation","descriptors","rest","colors","focusedOptions","routes","index","key","options","activeColor","tabBarActiveTintColor","text","inactiveColor","tabBarInactiveTintColor","alpha","rgb","string","tabBarScrollEnabled","tabBarBounces","tabBarPressColor","tabBarPressOpacity","tabBarItemStyle","backgroundColor","primary","tabBarIndicatorStyle","tabBarIndicatorContainerStyle","tabBarContentContainerStyle","card","tabBarStyle","route","tabBarAccessibilityLabel","tabBarTestID","preventDefault","event","emit","type","target","canPreventDefault","defaultPrevented","focused","color","tabBarShowIcon","tabBarIcon","undefined","icon","styles","tabBarIconStyle","tabBarShowLabel","label","tabBarLabel","title","name","tabBarLabelStyle","tabBarAllowFontScaling","tabBarBadge","navigationState","tabBarIndicator","create","height","width","textAlign","textTransform","fontSize","margin"],"mappings":";;AAAA,SAIEA,QAJF,QAKO,0BALP;AAMA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,EAAqBC,IAArB,EAA2BC,IAA3B,QAAuC,cAAvC;AACA,SAASC,MAAT,EAAiBC,eAAjB,QAAwC,uBAAxC;AAIA,eAAe,SAASC,SAAT,OAKY;AAAA;;AAAA,MALO;AAChCC,IAAAA,KADgC;AAEhCC,IAAAA,UAFgC;AAGhCC,IAAAA,WAHgC;AAIhC,OAAGC;AAJ6B,GAKP;AACzB,QAAM;AAAEC,IAAAA;AAAF,MAAab,QAAQ,EAA3B;AAEA,QAAMc,cAAc,GAAGH,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AA7B,OAAwC;AACxD,aAAOE,cAAc,CAACoD,eAAf,GACLpD,cAAc,CAACoD,eAAf,CAA+B;AAC7BzD,QAAAA,KAAK,EAAEA,KADsB;AAE7B,WAAGG;AAF0B,OAA/B,CADK,gBAML,oBAAC,eAAD;AAAiB,QAAA,eAAe,EAAEH;AAAlC,SAA6CG,IAA7C,EANF;AAQD;AAhGH,KADF;AAoGD;AAED,MAAM2C,MAAM,GAAGpD,UAAU,CAACgE,MAAX,CAAkB;AAC/Bb,EAAAA,IAAI,EAAE;AACJc,IAAAA,MAAM,EAAE,EADJ;AAEJC,IAAAA,KAAK,EAAE;AAFH,GADyB;AAK/BX,EAAAA,KAAK,EAAE;AACLY,IAAAA,SAAS,EAAE,QADN;AAELC,IAAAA,aAAa,EAAE,WAFV;AAGLC,IAAAA,QAAQ,EAAE,EAHL;AAILC,IAAAA,MAAM,EAAE,CAJH;AAKLzC,IAAAA,eAAe,EAAE;AALZ;AALwB,CAAlB,CAAf","sourcesContent":["import {\n ParamListBase,\n Route,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport Color from 'color';\nimport * as React from 'react';\nimport { StyleSheet, Text, View } from 'react-native';\nimport { TabBar, TabBarIndicator } from 'react-native-tab-view';\n\nimport type { MaterialTopTabBarProps } from '../types';\n\nexport default function TabBarTop({\n state,\n navigation,\n descriptors,\n ...rest\n}: MaterialTopTabBarProps) {\n const { colors } = useTheme();\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n const activeColor = focusedOptions.tabBarActiveTintColor ?? colors.text;\n const inactiveColor =\n focusedOptions.tabBarInactiveTintColor ??\n Color(activeColor).alpha(0.5).rgb().string();\n\n return (\n <TabBar\n {...rest}\n navigationState={state}\n scrollEnabled={focusedOptions.tabBarScrollEnabled}\n bounces={focusedOptions.tabBarBounces}\n activeColor={activeColor}\n inactiveColor={inactiveColor}\n pressColor={focusedOptions.tabBarPressColor}\n pressOpacity={focusedOptions.tabBarPressOpacity}\n tabStyle={focusedOptions.tabBarItemStyle}\n indicatorStyle={[\n { backgroundColor: colors.primary },\n focusedOptions.tabBarIndicatorStyle,\n ]}\n indicatorContainerStyle={focusedOptions.tabBarIndicatorContainerStyle}\n contentContainerStyle={focusedOptions.tabBarContentContainerStyle}\n style={[{ backgroundColor: colors.card }, focusedOptions.tabBarStyle]}\n getAccessibilityLabel={({ route }) =>\n descriptors[route.key].options.tabBarAccessibilityLabel\n }\n getTestID={({ route }) => descriptors[route.key].options.tabBarTestID}\n onTabPress={({ route, preventDefault }) => {\n const event = navigation.emit({\n type: 'tabPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (event.defaultPrevented) {\n preventDefault();\n }\n }}\n onTabLongPress={({ route }) =>\n navigation.emit({\n type: 'tabLongPress',\n target: route.key,\n })\n }\n renderIcon={({ route, focused, color }) => {\n const { options } = descriptors[route.key];\n\n if (options.tabBarShowIcon === false) {\n return null;\n }\n\n if (options.tabBarIcon !== undefined) {\n const icon = options.tabBarIcon({ focused, color });\n\n return (\n <View style={[styles.icon, options.tabBarIconStyle]}>{icon}</View>\n );\n }\n\n return null;\n }}\n renderLabel={({ route, focused, color }) => {\n const { options } = descriptors[route.key];\n\n if (options.tabBarShowLabel === false) {\n return null;\n }\n\n const label =\n options.tabBarLabel !== undefined\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : (route as Route<string>).name;\n\n if (typeof label === 'string') {\n return (\n <Text\n style={[styles.label, { color }, options.tabBarLabelStyle]}\n allowFontScaling={options.tabBarAllowFontScaling}\n >\n {label}\n </Text>\n );\n }\n\n return label({ focused, color });\n }}\n renderBadge={({ route }) => {\n const { tabBarBadge } = descriptors[route.key].options;\n\n return tabBarBadge?.() ?? null;\n }}\n renderIndicator={({ navigationState: state, ...rest }) => {\n return focusedOptions.tabBarIndicator ? (\n focusedOptions.tabBarIndicator({\n state: state as TabNavigationState<ParamListBase>,\n ...rest,\n })\n ) : (\n <TabBarIndicator navigationState={state} {...rest} />\n );\n }}\n />\n );\n}\n\nconst styles = StyleSheet.create({\n icon: {\n height: 24,\n width: 24,\n },\n label: {\n textAlign: 'center',\n textTransform: 'uppercase',\n fontSize: 13,\n margin: 4,\n backgroundColor: 'transparent',\n },\n});\n"]}
|
|
@@ -4,14 +4,15 @@ import { CommonActions, useTheme } from '@react-navigation/native';
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { TabView } from 'react-native-tab-view';
|
|
6
6
|
import MaterialTopTabBar from './MaterialTopTabBar';
|
|
7
|
-
export default function MaterialTopTabView({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export default function MaterialTopTabView(_ref) {
|
|
8
|
+
let {
|
|
9
|
+
tabBar = props => /*#__PURE__*/React.createElement(MaterialTopTabBar, props),
|
|
10
|
+
state,
|
|
11
|
+
navigation,
|
|
12
|
+
descriptors,
|
|
13
|
+
sceneContainerStyle,
|
|
14
|
+
...rest
|
|
15
|
+
} = _ref;
|
|
15
16
|
const {
|
|
16
17
|
colors
|
|
17
18
|
} = useTheme();
|
|
@@ -32,21 +33,28 @@ export default function MaterialTopTabView({
|
|
|
32
33
|
}),
|
|
33
34
|
target: state.key
|
|
34
35
|
}),
|
|
35
|
-
renderScene:
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
renderScene: _ref2 => {
|
|
37
|
+
let {
|
|
38
|
+
route
|
|
39
|
+
} = _ref2;
|
|
40
|
+
return descriptors[route.key].render();
|
|
41
|
+
},
|
|
38
42
|
navigationState: state,
|
|
39
43
|
renderTabBar: renderTabBar,
|
|
40
|
-
renderLazyPlaceholder:
|
|
41
|
-
route
|
|
42
|
-
}) => {
|
|
44
|
+
renderLazyPlaceholder: _ref3 => {
|
|
43
45
|
var _descriptors$route$ke, _descriptors$route$ke2, _descriptors$route$ke3;
|
|
44
46
|
|
|
47
|
+
let {
|
|
48
|
+
route
|
|
49
|
+
} = _ref3;
|
|
45
50
|
return (_descriptors$route$ke = (_descriptors$route$ke2 = (_descriptors$route$ke3 = descriptors[route.key].options).lazyPlaceholder) === null || _descriptors$route$ke2 === void 0 ? void 0 : _descriptors$route$ke2.call(_descriptors$route$ke3)) !== null && _descriptors$route$ke !== void 0 ? _descriptors$route$ke : null;
|
|
46
51
|
},
|
|
47
|
-
lazy:
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
lazy: _ref4 => {
|
|
53
|
+
let {
|
|
54
|
+
route
|
|
55
|
+
} = _ref4;
|
|
56
|
+
return descriptors[route.key].options.lazy === true;
|
|
57
|
+
},
|
|
50
58
|
lazyPreloadDistance: focusedOptions.lazyPreloadDistance,
|
|
51
59
|
swipeEnabled: focusedOptions.swipeEnabled,
|
|
52
60
|
onSwipeStart: () => navigation.emit({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MaterialTopTabView.tsx"],"names":["CommonActions","useTheme","React","TabView","MaterialTopTabBar","MaterialTopTabView","tabBar","props","state","navigation","descriptors","sceneContainerStyle","rest","colors","renderTabBar","focusedOptions","routes","index","key","options","dispatch","navigate","name","merge","target","route","render","lazyPlaceholder","lazy","lazyPreloadDistance","swipeEnabled","emit","type","backgroundColor","background"],"mappings":";;AAAA,SACEA,aADF,EAKEC,QALF,QAMO,0BANP;AAOA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAA6BC,OAA7B,QAA4C,uBAA5C;AAQA,OAAOC,iBAAP,MAA8B,qBAA9B;AAQA,eAAe,SAASC,kBAAT,
|
|
1
|
+
{"version":3,"sources":["MaterialTopTabView.tsx"],"names":["CommonActions","useTheme","React","TabView","MaterialTopTabBar","MaterialTopTabView","tabBar","props","state","navigation","descriptors","sceneContainerStyle","rest","colors","renderTabBar","focusedOptions","routes","index","key","options","dispatch","navigate","name","merge","target","route","render","lazyPlaceholder","lazy","lazyPreloadDistance","swipeEnabled","emit","type","backgroundColor","background"],"mappings":";;AAAA,SACEA,aADF,EAKEC,QALF,QAMO,0BANP;A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B;AAaE,IAAA,YAAY,EAAEM,YAbhB;AAcE,IAAA,qBAAqB,EAAE;AAAA;;AAAA,UAAC;AAAEW,QAAAA;AAAF,OAAD;AAAA,gEACrB,0BAAAf,WAAW,CAACe,KAAK,CAACP,GAAP,CAAX,CAAuBC,OAAvB,EAA+BQ,eADV,2DACrB,mDADqB,yEACiC,IADjC;AAAA,KAdzB;AAiBE,IAAA,IAAI,EAAE;AAAA,UAAC;AAAEF,QAAAA;AAAF,OAAD;AAAA,aAAef,WAAW,CAACe,KAAK,CAACP,GAAP,CAAX,CAAuBC,OAAvB,CAA+BS,IAA/B,KAAwC,IAAvD;AAAA,KAjBR;AAkBE,IAAA,mBAAmB,EAAEb,cAAc,CAACc,mBAlBtC;AAmBE,IAAA,YAAY,EAAEd,cAAc,CAACe,YAnB/B;AAoBE,IAAA,YAAY,EAAE,MAAMrB,UAAU,CAACsB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CApBtB;AAqBE,IAAA,UAAU,EAAE,MAAMvB,UAAU,CAACsB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CArBpB;AAsBE,IAAA,mBAAmB,EAAE,CACnB;AAAEC,MAAAA,eAAe,EAAEpB,MAAM,CAACqB;AAA1B,KADmB,EAEnBvB,mBAFmB;AAtBvB,KADF;AA6BD","sourcesContent":["import {\n CommonActions,\n ParamListBase,\n Route,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { SceneRendererProps, TabView } from 'react-native-tab-view';\n\nimport type {\n MaterialTopTabBarProps,\n MaterialTopTabDescriptorMap,\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationHelpers,\n} from '../types';\nimport MaterialTopTabBar from './MaterialTopTabBar';\n\ntype Props = MaterialTopTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: MaterialTopTabNavigationHelpers;\n descriptors: MaterialTopTabDescriptorMap;\n};\n\nexport default function MaterialTopTabView({\n tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,\n state,\n navigation,\n descriptors,\n sceneContainerStyle,\n ...rest\n}: Props) {\n const { colors } = useTheme();\n\n const renderTabBar = (props: SceneRendererProps) => {\n return tabBar({\n ...props,\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n });\n };\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n return (\n <TabView<Route<string>>\n {...rest}\n onIndexChange={(index) =>\n navigation.dispatch({\n ...CommonActions.navigate({\n name: state.routes[index].name,\n merge: true,\n }),\n target: state.key,\n })\n }\n renderScene={({ route }) => descriptors[route.key].render()}\n navigationState={state}\n renderTabBar={renderTabBar}\n renderLazyPlaceholder={({ route }) =>\n descriptors[route.key].options.lazyPlaceholder?.() ?? null\n }\n lazy={({ route }) => descriptors[route.key].options.lazy === true}\n lazyPreloadDistance={focusedOptions.lazyPreloadDistance}\n swipeEnabled={focusedOptions.swipeEnabled}\n onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}\n onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}\n sceneContainerStyle={[\n { backgroundColor: colors.background },\n sceneContainerStyle,\n ]}\n />\n );\n}\n"]}
|
|
@@ -10,4 +10,4 @@ export { default as MaterialTopTabView } from './views/MaterialTopTabView';
|
|
|
10
10
|
/**
|
|
11
11
|
* Types
|
|
12
12
|
*/
|
|
13
|
-
export type { MaterialTopTabBarProps, MaterialTopTabNavigationOptions, MaterialTopTabNavigationProp, MaterialTopTabScreenProps, } from './types';
|
|
13
|
+
export type { MaterialTopTabBarProps, MaterialTopTabNavigationEventMap, MaterialTopTabNavigationOptions, MaterialTopTabNavigationProp, MaterialTopTabScreenProps, } from './types';
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import { DefaultNavigatorOptions, ParamListBase, TabNavigationState, TabRouterOptions } from '@react-navigation/native';
|
|
3
3
|
import type { MaterialTopTabNavigationConfig, MaterialTopTabNavigationEventMap, MaterialTopTabNavigationOptions } from '../types';
|
|
4
4
|
declare type Props = DefaultNavigatorOptions<ParamListBase, TabNavigationState<ParamListBase>, MaterialTopTabNavigationOptions, MaterialTopTabNavigationEventMap> & TabRouterOptions & MaterialTopTabNavigationConfig;
|
|
5
|
-
declare function MaterialTopTabNavigator({ initialRouteName, backBehavior, children, screenListeners, screenOptions,
|
|
5
|
+
declare function MaterialTopTabNavigator({ initialRouteName, backBehavior, children, screenListeners, screenOptions, ...restWithDeprecated }: Props): JSX.Element;
|
|
6
6
|
declare const _default: <ParamList extends ParamListBase>() => import("@react-navigation/native").TypedNavigator<ParamList, TabNavigationState<ParamListBase>, MaterialTopTabNavigationOptions, MaterialTopTabNavigationEventMap, typeof MaterialTopTabNavigator>;
|
|
7
7
|
export default _default;
|
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": "6.
|
|
4
|
+
"version": "6.1.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
"warn-once": "^0.1.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@react-navigation/native": "^6.0.
|
|
48
|
+
"@react-navigation/native": "^6.0.8",
|
|
49
49
|
"@testing-library/react-native": "^7.2.0",
|
|
50
50
|
"@types/react": "^17.0.9",
|
|
51
51
|
"@types/react-native": "~0.64.9",
|
|
52
52
|
"del-cli": "^3.0.1",
|
|
53
|
-
"react": "
|
|
54
|
-
"react-native": "~0.
|
|
53
|
+
"react": "17.0.1",
|
|
54
|
+
"react-native": "~0.64.3",
|
|
55
55
|
"react-native-builder-bob": "^0.18.1",
|
|
56
|
-
"react-native-pager-view": "
|
|
56
|
+
"react-native-pager-view": "5.4.9",
|
|
57
57
|
"react-native-tab-view": "^3.1.1",
|
|
58
58
|
"typescript": "^4.3.2"
|
|
59
59
|
},
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
]
|
|
79
79
|
]
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "4cddbce150413c15db93897c76b813f436f5186d"
|
|
82
82
|
}
|
package/src/index.tsx
CHANGED
|
@@ -33,18 +33,22 @@ function MaterialTopTabNavigator({
|
|
|
33
33
|
children,
|
|
34
34
|
screenListeners,
|
|
35
35
|
screenOptions,
|
|
36
|
-
|
|
37
|
-
swipeEnabled,
|
|
38
|
-
// @ts-expect-error: lazy is deprecated
|
|
39
|
-
lazy,
|
|
40
|
-
// @ts-expect-error: lazyPlaceholder is deprecated
|
|
41
|
-
lazyPlaceholder,
|
|
42
|
-
// @ts-expect-error: lazyPreloadDistance is deprecated
|
|
43
|
-
lazyPreloadDistance,
|
|
44
|
-
// @ts-expect-error: tabBarOptions is deprecated
|
|
45
|
-
tabBarOptions,
|
|
46
|
-
...rest
|
|
36
|
+
...restWithDeprecated
|
|
47
37
|
}: Props) {
|
|
38
|
+
const {
|
|
39
|
+
// @ts-expect-error: swipeEnabled is deprecated
|
|
40
|
+
swipeEnabled,
|
|
41
|
+
// @ts-expect-error: lazy is deprecated
|
|
42
|
+
lazy,
|
|
43
|
+
// @ts-expect-error: lazyPlaceholder is deprecated
|
|
44
|
+
lazyPlaceholder,
|
|
45
|
+
// @ts-expect-error: lazyPreloadDistance is deprecated
|
|
46
|
+
lazyPreloadDistance,
|
|
47
|
+
// @ts-expect-error: tabBarOptions is deprecated
|
|
48
|
+
tabBarOptions,
|
|
49
|
+
...rest
|
|
50
|
+
} = restWithDeprecated;
|
|
51
|
+
|
|
48
52
|
let defaultScreenOptions: MaterialTopTabNavigationOptions = {};
|
|
49
53
|
|
|
50
54
|
if (tabBarOptions) {
|