@react-navigation/material-top-tabs 6.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/lib/commonjs/index.js +32 -0
  4. package/lib/commonjs/index.js.map +1 -0
  5. package/lib/commonjs/navigators/createMaterialTopTabNavigator.js +110 -0
  6. package/lib/commonjs/navigators/createMaterialTopTabNavigator.js.map +1 -0
  7. package/lib/commonjs/types.js +6 -0
  8. package/lib/commonjs/types.js.map +1 -0
  9. package/lib/commonjs/views/MaterialTopTabBar.js +174 -0
  10. package/lib/commonjs/views/MaterialTopTabBar.js.map +1 -0
  11. package/lib/commonjs/views/MaterialTopTabView.js +80 -0
  12. package/lib/commonjs/views/MaterialTopTabView.js.map +1 -0
  13. package/lib/module/index.js +14 -0
  14. package/lib/module/index.js.map +1 -0
  15. package/lib/module/navigators/createMaterialTopTabNavigator.js +92 -0
  16. package/lib/module/navigators/createMaterialTopTabNavigator.js.map +1 -0
  17. package/lib/module/types.js +2 -0
  18. package/lib/module/types.js.map +1 -0
  19. package/lib/module/views/MaterialTopTabBar.js +155 -0
  20. package/lib/module/views/MaterialTopTabBar.js.map +1 -0
  21. package/lib/module/views/MaterialTopTabView.js +63 -0
  22. package/lib/module/views/MaterialTopTabView.js.map +1 -0
  23. package/lib/typescript/src/index.d.ts +13 -0
  24. package/lib/typescript/src/navigators/createMaterialTopTabNavigator.d.ts +7 -0
  25. package/lib/typescript/src/types.d.ts +190 -0
  26. package/lib/typescript/src/views/MaterialTopTabBar.d.ts +3 -0
  27. package/lib/typescript/src/views/MaterialTopTabView.d.ts +10 -0
  28. package/package.json +82 -0
  29. package/src/index.tsx +20 -0
  30. package/src/navigators/createMaterialTopTabNavigator.tsx +145 -0
  31. package/src/types.tsx +268 -0
  32. package/src/views/MaterialTopTabBar.tsx +143 -0
  33. package/src/views/MaterialTopTabView.tsx +75 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 React Navigation Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # `@react-navigation/material-top-tabs`
2
+
3
+ React Navigation integration for animated tab view component from [`react-native-tab-view`](https://github.com/satya164/react-native-tab-view).
4
+
5
+ Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/material-top-tab-navigator/).
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "createMaterialTopTabNavigator", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _createMaterialTopTabNavigator.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "MaterialTopTabBar", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _MaterialTopTabBar.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "MaterialTopTabView", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _MaterialTopTabView.default;
22
+ }
23
+ });
24
+
25
+ var _createMaterialTopTabNavigator = _interopRequireDefault(require("./navigators/createMaterialTopTabNavigator"));
26
+
27
+ var _MaterialTopTabBar = _interopRequireDefault(require("./views/MaterialTopTabBar"));
28
+
29
+ var _MaterialTopTabView = _interopRequireDefault(require("./views/MaterialTopTabView"));
30
+
31
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _native = require("@react-navigation/native");
9
+
10
+ var React = _interopRequireWildcard(require("react"));
11
+
12
+ var _warnOnce = _interopRequireDefault(require("warn-once"));
13
+
14
+ var _MaterialTopTabView = _interopRequireDefault(require("../views/MaterialTopTabView"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
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
+
24
+ function MaterialTopTabNavigator({
25
+ initialRouteName,
26
+ backBehavior,
27
+ children,
28
+ screenListeners,
29
+ screenOptions,
30
+ // @ts-expect-error: swipeEnabled is deprecated
31
+ swipeEnabled,
32
+ // @ts-expect-error: lazy is deprecated
33
+ lazy,
34
+ // @ts-expect-error: lazyPlaceholder is deprecated
35
+ lazyPlaceholder,
36
+ // @ts-expect-error: lazyPreloadDistance is deprecated
37
+ lazyPreloadDistance,
38
+ // @ts-expect-error: tabBarOptions is deprecated
39
+ tabBarOptions,
40
+ ...rest
41
+ }) {
42
+ let defaultScreenOptions = {};
43
+
44
+ if (tabBarOptions) {
45
+ Object.assign(defaultScreenOptions, {
46
+ tabBarActiveTintColor: tabBarOptions.activeTintColor,
47
+ tabBarInactiveTintColor: tabBarOptions.inactiveTintColor,
48
+ tabBarPressColor: tabBarOptions.pressColor,
49
+ tabBarPressOpacity: tabBarOptions.pressOpacity,
50
+ tabBarShowLabel: tabBarOptions.showLabel,
51
+ tabBarShowIcon: tabBarOptions.showIcon,
52
+ tabBarAllowFontScaling: tabBarOptions.allowFontScaling,
53
+ tabBarBounces: tabBarOptions.bounces,
54
+ tabBarScrollEnabled: tabBarOptions.scrollEnabled,
55
+ tabBarIconStyle: tabBarOptions.iconStyle,
56
+ tabBarLabelStyle: tabBarOptions.labelStyle,
57
+ tabBarItemStyle: tabBarOptions.tabStyle,
58
+ tabBarBadge: tabBarOptions.renderBadge,
59
+ tabBarIndicator: tabBarOptions.renderIndicator,
60
+ tabBarIndicatorStyle: tabBarOptions.indicatorStyle,
61
+ tabBarIndicatorContainerStyle: tabBarOptions.indicatorContainerStyle,
62
+ tabBarContentContainerStyle: tabBarOptions.contentContainerStyle,
63
+ tabBarStyle: tabBarOptions.style
64
+ });
65
+ Object.keys(defaultScreenOptions).forEach(key => {
66
+ if (defaultScreenOptions[key] === undefined) {
67
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
68
+ delete defaultScreenOptions[key];
69
+ }
70
+ });
71
+ (0, _warnOnce.default)(tabBarOptions, `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(defaultScreenOptions, null, 2)}\n\nSee https://reactnavigation.org/docs/material-top-tab-navigator#options for more details.`);
72
+ }
73
+
74
+ const deprecatedProps = {
75
+ swipeEnabled,
76
+ lazy,
77
+ lazyPlaceholder,
78
+ lazyPreloadDistance
79
+ };
80
+ Object.entries(deprecatedProps).forEach(([propName, propValue]) => {
81
+ if (propValue !== undefined) {
82
+ // @ts-expect-error: Object.entries doesn't return strict types
83
+ defaultScreenOptions[propName] = propValue;
84
+ (0, _warnOnce.default)(true, `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.`);
85
+ }
86
+ });
87
+ const {
88
+ state,
89
+ descriptors,
90
+ navigation,
91
+ NavigationContent
92
+ } = (0, _native.useNavigationBuilder)(_native.TabRouter, {
93
+ initialRouteName,
94
+ backBehavior,
95
+ children,
96
+ screenListeners,
97
+ screenOptions,
98
+ defaultScreenOptions
99
+ });
100
+ return /*#__PURE__*/React.createElement(NavigationContent, null, /*#__PURE__*/React.createElement(_MaterialTopTabView.default, _extends({}, rest, {
101
+ state: state,
102
+ navigation: navigation,
103
+ descriptors: descriptors
104
+ })));
105
+ }
106
+
107
+ var _default = (0, _native.createNavigatorFactory)(MaterialTopTabNavigator);
108
+
109
+ exports.default = _default;
110
+ //# sourceMappingURL=createMaterialTopTabNavigator.js.map
@@ -0,0 +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,CAAiC;AAC/BC,EAAAA,gBAD+B;AAE/BC,EAAAA,YAF+B;AAG/BC,EAAAA,QAH+B;AAI/BC,EAAAA,eAJ+B;AAK/BC,EAAAA,aAL+B;AAM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Options,\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 // @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}: Props) {\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"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = TabBarTop;
7
+
8
+ var _native = require("@react-navigation/native");
9
+
10
+ var _color = _interopRequireDefault(require("color"));
11
+
12
+ var React = _interopRequireWildcard(require("react"));
13
+
14
+ var _reactNative = require("react-native");
15
+
16
+ var _reactNativeTabView = require("react-native-tab-view");
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
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
+
26
+ function TabBarTop({
27
+ state,
28
+ navigation,
29
+ descriptors,
30
+ ...rest
31
+ }) {
32
+ var _focusedOptions$tabBa, _focusedOptions$tabBa2;
33
+
34
+ const {
35
+ colors
36
+ } = (0, _native.useTheme)();
37
+ const focusedOptions = descriptors[state.routes[state.index].key].options;
38
+ const activeColor = (_focusedOptions$tabBa = focusedOptions.tabBarActiveTintColor) !== null && _focusedOptions$tabBa !== void 0 ? _focusedOptions$tabBa : colors.text;
39
+ const inactiveColor = (_focusedOptions$tabBa2 = focusedOptions.tabBarInactiveTintColor) !== null && _focusedOptions$tabBa2 !== void 0 ? _focusedOptions$tabBa2 : (0, _color.default)(activeColor).alpha(0.5).rgb().string();
40
+ return /*#__PURE__*/React.createElement(_reactNativeTabView.TabBar, _extends({}, rest, {
41
+ navigationState: state,
42
+ scrollEnabled: focusedOptions.tabBarScrollEnabled,
43
+ bounces: focusedOptions.tabBarBounces,
44
+ activeColor: activeColor,
45
+ inactiveColor: inactiveColor,
46
+ pressColor: focusedOptions.tabBarPressColor,
47
+ pressOpacity: focusedOptions.tabBarPressOpacity,
48
+ tabStyle: focusedOptions.tabBarItemStyle,
49
+ indicatorStyle: [{
50
+ backgroundColor: colors.primary
51
+ }, focusedOptions.tabBarIndicatorStyle],
52
+ indicatorContainerStyle: focusedOptions.tabBarIndicatorContainerStyle,
53
+ contentContainerStyle: focusedOptions.tabBarContentContainerStyle,
54
+ style: [{
55
+ backgroundColor: colors.card
56
+ }, focusedOptions.tabBarStyle],
57
+ getAccessibilityLabel: ({
58
+ route
59
+ }) => descriptors[route.key].options.tabBarAccessibilityLabel,
60
+ getTestID: ({
61
+ route
62
+ }) => descriptors[route.key].options.tabBarTestID,
63
+ onTabPress: ({
64
+ route,
65
+ preventDefault
66
+ }) => {
67
+ const event = navigation.emit({
68
+ type: 'tabPress',
69
+ target: route.key,
70
+ canPreventDefault: true
71
+ });
72
+
73
+ if (event.defaultPrevented) {
74
+ preventDefault();
75
+ }
76
+ },
77
+ onTabLongPress: ({
78
+ route
79
+ }) => navigation.emit({
80
+ type: 'tabLongPress',
81
+ target: route.key
82
+ }),
83
+ renderIcon: ({
84
+ route,
85
+ focused,
86
+ color
87
+ }) => {
88
+ const {
89
+ options
90
+ } = descriptors[route.key];
91
+
92
+ if (options.tabBarShowIcon === false) {
93
+ return null;
94
+ }
95
+
96
+ if (options.tabBarIcon !== undefined) {
97
+ const icon = options.tabBarIcon({
98
+ focused,
99
+ color
100
+ });
101
+ return /*#__PURE__*/React.createElement(_reactNative.View, {
102
+ style: [styles.icon, options.tabBarIconStyle]
103
+ }, icon);
104
+ }
105
+
106
+ return null;
107
+ },
108
+ renderLabel: ({
109
+ route,
110
+ focused,
111
+ color
112
+ }) => {
113
+ const {
114
+ options
115
+ } = descriptors[route.key];
116
+
117
+ if (options.tabBarShowLabel === false) {
118
+ return null;
119
+ }
120
+
121
+ const label = options.tabBarLabel !== undefined ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
122
+
123
+ if (typeof label === 'string') {
124
+ return /*#__PURE__*/React.createElement(_reactNative.Text, {
125
+ style: [styles.label, {
126
+ color
127
+ }, options.tabBarLabelStyle],
128
+ allowFontScaling: options.tabBarAllowFontScaling
129
+ }, label);
130
+ }
131
+
132
+ return label({
133
+ focused,
134
+ color
135
+ });
136
+ },
137
+ renderBadge: ({
138
+ route
139
+ }) => {
140
+ var _tabBarBadge;
141
+
142
+ const {
143
+ tabBarBadge
144
+ } = descriptors[route.key].options;
145
+ return (_tabBarBadge = tabBarBadge === null || tabBarBadge === void 0 ? void 0 : tabBarBadge()) !== null && _tabBarBadge !== void 0 ? _tabBarBadge : null;
146
+ },
147
+ renderIndicator: ({
148
+ navigationState: state,
149
+ ...rest
150
+ }) => {
151
+ return focusedOptions.tabBarIndicator ? focusedOptions.tabBarIndicator({
152
+ state: state,
153
+ ...rest
154
+ }) : /*#__PURE__*/React.createElement(_reactNativeTabView.TabBarIndicator, _extends({
155
+ navigationState: state
156
+ }, rest));
157
+ }
158
+ }));
159
+ }
160
+
161
+ const styles = _reactNative.StyleSheet.create({
162
+ icon: {
163
+ height: 24,
164
+ width: 24
165
+ },
166
+ label: {
167
+ textAlign: 'center',
168
+ textTransform: 'uppercase',
169
+ fontSize: 13,
170
+ margin: 4,
171
+ backgroundColor: 'transparent'
172
+ }
173
+ });
174
+ //# sourceMappingURL=MaterialTopTabBar.js.map
@@ -0,0 +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,CAAmB;AAChCC,EAAAA,KADgC;AAEhCC,EAAAA,UAFgC;AAGhCC,EAAAA,WAHgC;AAIhC,KAAGC;AAJ6B,CAAnB,EAKY;AAAA;;AACzB,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;AAEA,QAAMC,cAAc,GAAGH,WAAW,CAACF,KAAK,CAACM,MAAN,CAAaN,KAAK,CAACO,KAAnB,EAA0BC,GAA3B,CAAX,CAA2CC,O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AA6CG,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"]}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = MaterialTopTabView;
7
+
8
+ var _native = require("@react-navigation/native");
9
+
10
+ var React = _interopRequireWildcard(require("react"));
11
+
12
+ var _reactNativeTabView = require("react-native-tab-view");
13
+
14
+ var _MaterialTopTabBar = _interopRequireDefault(require("./MaterialTopTabBar"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
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
+
24
+ function MaterialTopTabView({
25
+ tabBar = props => /*#__PURE__*/React.createElement(_MaterialTopTabBar.default, props),
26
+ state,
27
+ navigation,
28
+ descriptors,
29
+ sceneContainerStyle,
30
+ ...rest
31
+ }) {
32
+ const {
33
+ colors
34
+ } = (0, _native.useTheme)();
35
+
36
+ const renderTabBar = props => {
37
+ return tabBar({ ...props,
38
+ state: state,
39
+ navigation: navigation,
40
+ descriptors: descriptors
41
+ });
42
+ };
43
+
44
+ const focusedOptions = descriptors[state.routes[state.index].key].options;
45
+ return /*#__PURE__*/React.createElement(_reactNativeTabView.TabView, _extends({}, rest, {
46
+ onIndexChange: index => navigation.dispatch({ ..._native.CommonActions.navigate({
47
+ name: state.routes[index].name,
48
+ merge: true
49
+ }),
50
+ target: state.key
51
+ }),
52
+ renderScene: ({
53
+ route
54
+ }) => descriptors[route.key].render(),
55
+ navigationState: state,
56
+ renderTabBar: renderTabBar,
57
+ renderLazyPlaceholder: ({
58
+ route
59
+ }) => {
60
+ var _descriptors$route$ke, _descriptors$route$ke2, _descriptors$route$ke3;
61
+
62
+ 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
+ },
64
+ lazy: ({
65
+ route
66
+ }) => descriptors[route.key].options.lazy === true,
67
+ lazyPreloadDistance: focusedOptions.lazyPreloadDistance,
68
+ swipeEnabled: focusedOptions.swipeEnabled,
69
+ onSwipeStart: () => navigation.emit({
70
+ type: 'swipeStart'
71
+ }),
72
+ onSwipeEnd: () => navigation.emit({
73
+ type: 'swipeEnd'
74
+ }),
75
+ sceneContainerStyle: [{
76
+ backgroundColor: colors.background
77
+ }, sceneContainerStyle]
78
+ }));
79
+ }
80
+ //# sourceMappingURL=MaterialTopTabView.js.map
@@ -0,0 +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"],"mapp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EACrB,0BAAAhB,WAAW,CAACgB,KAAK,CAACR,GAAP,CAAX,CAAuBC,OAAvB,EAA+BS,eADV,2DACrB,mDADqB,yEACiC,IADjC;AAAA,KAdzB;AAiBE,IAAA,IAAI,EAAE,CAAC;AAAEF,MAAAA;AAAF,KAAD,KAAehB,WAAW,CAACgB,KAAK,CAACR,GAAP,CAAX,CAAuBC,OAAvB,CAA+BU,IAA/B,KAAwC,IAjB/D;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"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Navigators
3
+ */
4
+ export { default as createMaterialTopTabNavigator } from './navigators/createMaterialTopTabNavigator';
5
+ /**
6
+ * Views
7
+ */
8
+
9
+ export { default as MaterialTopTabBar } from './views/MaterialTopTabBar';
10
+ export { default as MaterialTopTabView } from './views/MaterialTopTabView';
11
+ /**
12
+ * Types
13
+ */
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,92 @@
1
+ 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); }
2
+
3
+ import { createNavigatorFactory, TabRouter, useNavigationBuilder } from '@react-navigation/native';
4
+ import * as React from 'react';
5
+ import warnOnce from 'warn-once';
6
+ import MaterialTopTabView from '../views/MaterialTopTabView';
7
+
8
+ function MaterialTopTabNavigator({
9
+ initialRouteName,
10
+ backBehavior,
11
+ children,
12
+ screenListeners,
13
+ screenOptions,
14
+ // @ts-expect-error: swipeEnabled is deprecated
15
+ swipeEnabled,
16
+ // @ts-expect-error: lazy is deprecated
17
+ lazy,
18
+ // @ts-expect-error: lazyPlaceholder is deprecated
19
+ lazyPlaceholder,
20
+ // @ts-expect-error: lazyPreloadDistance is deprecated
21
+ lazyPreloadDistance,
22
+ // @ts-expect-error: tabBarOptions is deprecated
23
+ tabBarOptions,
24
+ ...rest
25
+ }) {
26
+ let defaultScreenOptions = {};
27
+
28
+ if (tabBarOptions) {
29
+ Object.assign(defaultScreenOptions, {
30
+ tabBarActiveTintColor: tabBarOptions.activeTintColor,
31
+ tabBarInactiveTintColor: tabBarOptions.inactiveTintColor,
32
+ tabBarPressColor: tabBarOptions.pressColor,
33
+ tabBarPressOpacity: tabBarOptions.pressOpacity,
34
+ tabBarShowLabel: tabBarOptions.showLabel,
35
+ tabBarShowIcon: tabBarOptions.showIcon,
36
+ tabBarAllowFontScaling: tabBarOptions.allowFontScaling,
37
+ tabBarBounces: tabBarOptions.bounces,
38
+ tabBarScrollEnabled: tabBarOptions.scrollEnabled,
39
+ tabBarIconStyle: tabBarOptions.iconStyle,
40
+ tabBarLabelStyle: tabBarOptions.labelStyle,
41
+ tabBarItemStyle: tabBarOptions.tabStyle,
42
+ tabBarBadge: tabBarOptions.renderBadge,
43
+ tabBarIndicator: tabBarOptions.renderIndicator,
44
+ tabBarIndicatorStyle: tabBarOptions.indicatorStyle,
45
+ tabBarIndicatorContainerStyle: tabBarOptions.indicatorContainerStyle,
46
+ tabBarContentContainerStyle: tabBarOptions.contentContainerStyle,
47
+ tabBarStyle: tabBarOptions.style
48
+ });
49
+ Object.keys(defaultScreenOptions).forEach(key => {
50
+ if (defaultScreenOptions[key] === undefined) {
51
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
52
+ delete defaultScreenOptions[key];
53
+ }
54
+ });
55
+ warnOnce(tabBarOptions, `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(defaultScreenOptions, null, 2)}\n\nSee https://reactnavigation.org/docs/material-top-tab-navigator#options for more details.`);
56
+ }
57
+
58
+ const deprecatedProps = {
59
+ swipeEnabled,
60
+ lazy,
61
+ lazyPlaceholder,
62
+ lazyPreloadDistance
63
+ };
64
+ Object.entries(deprecatedProps).forEach(([propName, propValue]) => {
65
+ if (propValue !== undefined) {
66
+ // @ts-expect-error: Object.entries doesn't return strict types
67
+ defaultScreenOptions[propName] = propValue;
68
+ warnOnce(true, `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.`);
69
+ }
70
+ });
71
+ const {
72
+ state,
73
+ descriptors,
74
+ navigation,
75
+ NavigationContent
76
+ } = useNavigationBuilder(TabRouter, {
77
+ initialRouteName,
78
+ backBehavior,
79
+ children,
80
+ screenListeners,
81
+ screenOptions,
82
+ defaultScreenOptions
83
+ });
84
+ return /*#__PURE__*/React.createElement(NavigationContent, null, /*#__PURE__*/React.createElement(MaterialTopTabView, _extends({}, rest, {
85
+ state: state,
86
+ navigation: navigation,
87
+ descriptors: descriptors
88
+ })));
89
+ }
90
+
91
+ export default createNavigatorFactory(MaterialTopTabNavigator);
92
+ //# sourceMappingURL=createMaterialTopTabNavigator.js.map
@@ -0,0 +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,CAAiC;AAC/BC,EAAAA,gBAD+B;AAE/BC,EAAAA,YAF+B;AAG/BC,EAAAA,QAH+B;AAI/BC,EAAAA,eAJ+B;AAK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ADF;AAUD;;AAED,eAAerE,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 // @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}: Props) {\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"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}