@react-navigation/material-top-tabs 6.0.6 → 6.2.0

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.
@@ -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,14 +21,16 @@ 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
- initialRouteName,
26
- backBehavior,
27
- children,
28
- screenListeners,
29
- screenOptions,
30
- ...restWithDeprecated
31
- }) {
24
+ function MaterialTopTabNavigator(_ref) {
25
+ let {
26
+ id,
27
+ initialRouteName,
28
+ backBehavior,
29
+ children,
30
+ screenListeners,
31
+ screenOptions,
32
+ ...restWithDeprecated
33
+ } = _ref;
32
34
  const {
33
35
  // @ts-expect-error: swipeEnabled is deprecated
34
36
  swipeEnabled,
@@ -80,7 +82,9 @@ function MaterialTopTabNavigator({
80
82
  lazyPlaceholder,
81
83
  lazyPreloadDistance
82
84
  };
83
- Object.entries(deprecatedProps).forEach(([propName, propValue]) => {
85
+ Object.entries(deprecatedProps).forEach(_ref2 => {
86
+ let [propName, propValue] = _ref2;
87
+
84
88
  if (propValue !== undefined) {
85
89
  // @ts-expect-error: Object.entries doesn't return strict types
86
90
  defaultScreenOptions[propName] = propValue;
@@ -93,6 +97,7 @@ function MaterialTopTabNavigator({
93
97
  navigation,
94
98
  NavigationContent
95
99
  } = (0, _native.useNavigationBuilder)(_native.TabRouter, {
100
+ id,
96
101
  initialRouteName,
97
102
  backBehavior,
98
103
  children,
@@ -1 +1 @@
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,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/B,KAAGC;AAN4B,CAAjC,EAOU;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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,MAAM,CAAC6C,OAAP,CAAeD,eAAf,EAAgCL,OAAhC,CAAwC,CAAC,CAACO,QAAD,EAAWC,SAAX,CAAD,KAA2B;AACjE,QAAIA,SAAS,KAAKN,SAAlB,EAA6B;AAC3B;AACA1C,MAAAA,oBAAoB,CAAC+C,QAAD,CAApB,GAAiCC,SAAjC;AAEA,6BACE,IADF,EAEG,gCAA+BD,QAAS,oIAAmIA,QAAQ,CAACE,WAAT,EAAuB,oBAFrM;AAID;AACF,GAVD;AAYA,QAAM;AAAEC,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"]}
1
+ {"version":3,"sources":["createMaterialTopTabNavigator.tsx"],"names":["MaterialTopTabNavigator","id","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,OAQU;AAAA,MARuB;AAC/BC,IAAAA,EAD+B;AAE/BC,IAAAA,gBAF+B;AAG/BC,IAAAA,YAH+B;AAI/BC,IAAAA,QAJ+B;AAK/BC,IAAAA,eAL+B;AAM/BC,IAAAA,aAN+B;AAO/B,OAAGC;AAP4B,GAQvB;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,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ACE,IADF,EAEG,gCAA+BD,QAAS,oIAAmIA,QAAQ,CAACE,WAAT,EAAuB,oBAFrM;AAID;AACF,GAVD;AAYA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA,UAAtB;AAAkCC,IAAAA;AAAlC,MACJ,kCAMEC,iBANF,EAMa;AACXnE,IAAAA,EADW;AAEXC,IAAAA,gBAFW;AAGXC,IAAAA,YAHW;AAIXC,IAAAA,QAJW;AAKXC,IAAAA,eALW;AAMXC,IAAAA,aANW;AAOXQ,IAAAA;AAPW,GANb,CADF;AAiBA,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,oCAKbjE,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 id,\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 id,\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
- route
59
- }) => descriptors[route.key].options.tabBarAccessibilityLabel,
60
- getTestID: ({
61
- route
62
- }) => descriptors[route.key].options.tabBarTestID,
63
- onTabPress: ({
64
- route,
65
- preventDefault
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
- route
79
- }) => navigation.emit({
80
- type: 'tabLongPress',
81
- target: route.key
82
- }),
83
- renderIcon: ({
84
- route,
85
- focused,
86
- color
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
- route,
110
- focused,
111
- color
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
- navigationState: state,
149
- ...rest
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,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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ML,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"]}
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,CAACM,MAAN,CAAaN,KAAK,CAACO,KAAnB,EAA0BC,GAA3B,CAAX,CAA2CC,OAAlE;AAEA,QAAMC,WAAW,4BAAGL,cAAc,CAACM,qBAAlB,yEAA2CP,MAAM,CAACQ,IAAnE;AACA,QAAMC,aAAa,6BACjBR,cAAc,CAACS,uBADE,2EAEjB,oBAAMJ,WAAN,EAAmBK,KAAnB,CAAyB,GAAzB,EAA8BC,GAA9B,GAAoCC,MAApC,EAFF;AAIA,sBACE,oBAAC,0BAAD,eACMd,IADN;AAEE,IAAA,eAAe,EAAEH,KAFnB;AAGE,IAAA,aAAa,EAAEK,cAAc,CAACa,mBAHhC;AAIE,IAAA,OAAO,EAAEb,cAAc,CA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AAA,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
- tabBar = props => /*#__PURE__*/React.createElement(_MaterialTopTabBar.default, props),
26
- state,
27
- navigation,
28
- descriptors,
29
- sceneContainerStyle,
30
- ...rest
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
- route
54
- }) => descriptors[route.key].render(),
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
- route
66
- }) => descriptors[route.key].options.lazy === true,
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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AAC;AAAEY,MAAAA;AAAF,KAAD;AAAA;;AAAA,gEACrB,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"]}
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,EAAuBA,KAAvB,CADH;AAEzCC,IAAAA,KAFyC;AAGzCC,IAAAA,UAHyC;AAIzCC,IAAAA,WAJyC;AAKzCC,IAAAA,mBALyC;AAMzC,OAAGC;AANsC,GAOjC;AACR,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;;AAEA,QAAMC,YAAY,GA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,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"]}
@@ -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,14 +5,16 @@ 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
- initialRouteName,
10
- backBehavior,
11
- children,
12
- screenListeners,
13
- screenOptions,
14
- ...restWithDeprecated
15
- }) {
8
+ function MaterialTopTabNavigator(_ref) {
9
+ let {
10
+ id,
11
+ initialRouteName,
12
+ backBehavior,
13
+ children,
14
+ screenListeners,
15
+ screenOptions,
16
+ ...restWithDeprecated
17
+ } = _ref;
16
18
  const {
17
19
  // @ts-expect-error: swipeEnabled is deprecated
18
20
  swipeEnabled,
@@ -64,7 +66,9 @@ function MaterialTopTabNavigator({
64
66
  lazyPlaceholder,
65
67
  lazyPreloadDistance
66
68
  };
67
- Object.entries(deprecatedProps).forEach(([propName, propValue]) => {
69
+ Object.entries(deprecatedProps).forEach(_ref2 => {
70
+ let [propName, propValue] = _ref2;
71
+
68
72
  if (propValue !== undefined) {
69
73
  // @ts-expect-error: Object.entries doesn't return strict types
70
74
  defaultScreenOptions[propName] = propValue;
@@ -77,6 +81,7 @@ function MaterialTopTabNavigator({
77
81
  navigation,
78
82
  NavigationContent
79
83
  } = useNavigationBuilder(TabRouter, {
84
+ id,
80
85
  initialRouteName,
81
86
  backBehavior,
82
87
  children,
@@ -1 +1 @@
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,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/B,KAAGC;AAN4B,CAAjC,EAOU;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;AA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AAG;AACtBnD,IAAAA,YADsB;AAEtBC,IAAAA,IAFsB;AAGtBC,IAAAA,eAHsB;AAItBC,IAAAA;AAJsB,GAAxB;AAOAI,EAAAA,MAAM,CAAC6C,OAAP,CAAeD,eAAf,EAAgCL,OAAhC,CAAwC,CAAC,CAACO,QAAD,EAAWC,SAAX,CAAD,KAA2B;AACjE,QAAIA,SAAS,KAAKN,SAAlB,EAA6B;AAC3B;AACA1C,MAAAA,oBAAoB,CAAC+C,QAAD,CAApB,GAAiCC,SAAjC;AAEA/D,MAAAA,QAAQ,CACN,IADM,EAEL,gCAA+B8D,QAAS,oIAAmIA,QAAQ,CAACE,WAAT,EAAuB,oBAF7L,CAAR;AAID;AACF,GAVD;AAYA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA,UAAtB;AAAkCC,IAAAA;AAAlC,MACJtE,oBAAoB,CAMlBD,SANkB,EAMP;AACXM,IAAAA,gBADW;AAEXC,IAAAA,YAFW;AAGXC,IAAAA,QAHW;AAIXC,IAAAA,eAJW;AAKXC,IAAAA,aALW;AAMXQ,IAAAA;AANW,GANO,CADtB;AAgBA,sBACE,oBAAC,iBAAD,qBACE,oBAAC,kBAAD,eACMD,IADN;AAEE,IAAA,KAAK,EAAEmD,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"]}
1
+ {"version":3,"sources":["createMaterialTopTabNavigator.tsx"],"names":["createNavigatorFactory","TabRouter","useNavigationBuilder","React","warnOnce","MaterialTopTabView","MaterialTopTabNavigator","id","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,OAQU;AAAA,MARuB;AAC/BC,IAAAA,EAD+B;AAE/BC,IAAAA,gBAF+B;AAG/BC,IAAAA,YAH+B;AAI/BC,IAAAA,QAJ+B;AAK/BC,IAAAA,eAL+B;AAM/BC,IAAAA,aAN+B;AAO/B,OAAGC;AAP4B,GAQvB;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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,eAAe,GAAG;AACtBnD,IAAAA,YADsB;AAEtBC,IAAAA,IAFsB;AAGtBC,IAAAA,eAHsB;AAItBC,IAAAA;AAJsB,GAAxB;AAOAI,EAAAA,MAAM,CAAC6C,OAAP,CAAeD,eAAf,EAAgCL,OAAhC,CAAwC,SAA2B;AAAA,QAA1B,CAACO,QAAD,EAAWC,SAAX,CAA0B;;AACjE,QAAIA,SAAS,KAAKN,SAAlB,EAA6B;AAC3B;AACA1C,MAAAA,oBAAoB,CAAC+C,QAAD,CAApB,GAAiCC,SAAjC;AAEAhE,MAAAA,QAAQ,CACN,IADM,EAEL,gCAA+B+D,QAAS,oIAAmIA,QAAQ,CAACE,WAAT,EAAuB,oBAF7L,CAAR;AAID;AACF,GAVD;AAYA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA,UAAtB;AAAkCC,IAAAA;AAAlC,MACJvE,oBAAoB,CAMlBD,SANkB,EAMP;AACXM,IAAAA,EADW;AAEXC,IAAAA,gBAFW;AAGXC,IAAAA,YAHW;AAIXC,IAAAA,QAJW;AAKXC,IAAAA,eALW;AAMXC,IAAAA,aANW;AAOXQ,IAAAA;AAPW,GANO,CADtB;AAiBA,sBACE,oBAAC,iBAAD,qBACE,oBAAC,kBAAD,eACMD,IADN;AAEE,IAAA,KAAK,EAAEmD,KAFT;AAGE,IAAA,UAAU,EAAEE,UAHd;AAIE,IAAA,WAAW,EAAED;AAJf,KADF,CADF;AAUD;;AAED,eAAevE,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 id,\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 id,\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
- route
41
- }) => descriptors[route.key].options.tabBarAccessibilityLabel,
42
- getTestID: ({
43
- route
44
- }) => descriptors[route.key].options.tabBarTestID,
45
- onTabPress: ({
46
- route,
47
- preventDefault
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
- route
61
- }) => navigation.emit({
62
- type: 'tabLongPress',
63
- target: route.key
64
- }),
65
- renderIcon: ({
66
- route,
67
- focused,
68
- color
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
- route,
92
- focused,
93
- color
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
- navigationState: state,
131
- ...rest
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","tab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AAX,OAAD,CAAZ;AACD,KAjFH;AAkFE,IAAA,WAAW,EAAE,CAAC;AAAEX,MAAAA;AAAF,KAAD,KAAe;AAAA;;AAC1B,YAAM;AAAEyB,QAAAA;AAAF,UAAkBrD,WAAW,CAAC4B,KAAK,CAACtB,GAAP,CAAX,CAAuBC,OAA/C;AAEA,6BAAO8C,WAAP,aAAOA,WAAP,uBAAOA,WAAW,EAAlB,uDAA0B,IAA1B;AACD,KAtFH;AAuFE,IAAA,eAAe,EAAE,CAAC;AAAEC,MAAAA,eAAe,EAAExD,KAAnB;AAA0B,SAAGG;AAA7B,KAAD,KAAyC;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"]}
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,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AAc;AAC1B,YAAM;AAAEyB,QAAAA;AAAF,UAAkBrD,WAAW,CAAC4B,KAAK,CAACtB,GAAP,CAAX,CAAuBC,OAA/C;AAEA,6BAAO8C,WAAP,aAAOA,WAAP,uBAAOA,WAAW,EAAlB,uDAA0B,IAA1B;AACD,KAtFH;AAuFE,IAAA,eAAe,EAAE,SAAyC;AAAA,UAAxC;AAAEC,QAAAA,eAAe,EAAExD,KAAnB;AAA0B,WAAGG;AAA7B,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
- tabBar = props => /*#__PURE__*/React.createElement(MaterialTopTabBar, props),
9
- state,
10
- navigation,
11
- descriptors,
12
- sceneContainerStyle,
13
- ...rest
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
- route
37
- }) => descriptors[route.key].render(),
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
- route
49
- }) => descriptors[route.key].options.lazy === true,
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,CAA4B;AACzCC,EAAAA,MAAM,GAAIC,KAAD,iBAAmC,oBAAC,iBAAD,EAAuBA,KAAvB,CADH;AAEzCC,EAAAA,KAFyC;AAGzCC,EAAAA,UAHyC;AAIzCC,EAAAA,WAJyC;AAKzCC,EAAAA,mBALyC;AAMzC,KAAGC;AANsC,CAA5B,EAOL;AACR,QAAM;AAAEC,IAAAA;AAAF,MAAaZ,QAAQ,EAA3B;;AAEA,QAAMa,YAAY,GAAIP,KAAD,IAA+B;AAClD,WAAOD,MAAM,CAAC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AAE,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"]}
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,OAOL;AAAA,MAPiC;AACzCC,IAAAA,MAAM,GAAIC,KAAD,iBAAmC,oBAAC,iBAAD,EAAuBA,KAAvB,CADH;AAEzCC,IAAAA,KAFyC;AAGzCC,IAAAA,UAHyC;AAIzCC,IAAAA,WAJyC;AAKzCC,IAAAA,mBALyC;AAMzC,OAAGC;AANsC,GAOjC;AACR,QAAM;AAAEC,IAAAA;AAAF,MAAaZ,QAAQ,EAA3B;;AAEA,QAAMa,YAAY,GAAIP,KAAD,IAA+B;AAClD,WAAOD,MAAM,CAAC,EACZ,GAAGC,KADS;AAEZC,MAAAA,KAAK,EAAEA,KAFK;AAGZC,MAAAA,UAAU,EAAEA,UAHA;AAIZC,MAAAA,WAAW,EAAEA;AAJD,KAAD,CAAb;AAMD,GAPD;;AASA,QAAMK,cAAc,GAAGL,WAAW,CAACF,KAAK,CAACQ,MAAN,CAAaR,KAAK,CAACS,KAAnB,EAA0BC,GAA3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BpB;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, ...restWithDeprecated }: Props): JSX.Element;
5
+ declare function MaterialTopTabNavigator({ id, 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;
@@ -30,9 +30,9 @@ export declare type MaterialTopTabNavigationEventMap = {
30
30
  };
31
31
  };
32
32
  export declare type MaterialTopTabNavigationHelpers = NavigationHelpers<ParamListBase, MaterialTopTabNavigationEventMap> & TabActionHelpers<ParamListBase>;
33
- export declare type MaterialTopTabNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList> = NavigationProp<ParamList, RouteName, TabNavigationState<ParamList>, MaterialTopTabNavigationOptions, MaterialTopTabNavigationEventMap> & TabActionHelpers<ParamList>;
34
- export declare type MaterialTopTabScreenProps<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList> = {
35
- navigation: MaterialTopTabNavigationProp<ParamList, RouteName>;
33
+ export declare type MaterialTopTabNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = NavigationProp<ParamList, RouteName, NavigatorID, TabNavigationState<ParamList>, MaterialTopTabNavigationOptions, MaterialTopTabNavigationEventMap> & TabActionHelpers<ParamList>;
34
+ export declare type MaterialTopTabScreenProps<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = {
35
+ navigation: MaterialTopTabNavigationProp<ParamList, RouteName, NavigatorID>;
36
36
  route: RouteProp<ParamList, RouteName>;
37
37
  };
38
38
  export declare type MaterialTopTabNavigationOptions = {
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.0.6",
4
+ "version": "6.2.0",
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.6",
48
+ "@react-navigation/native": "^6.0.9",
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": "~16.13.1",
54
- "react-native": "~0.63.4",
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": "^5.1.10",
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": "e77a5ab9d342a03cd8e20b54938700dfd4e23f42"
81
+ "gitHead": "c5ef6b5e88426e658123ea8590da583314b9001e"
82
82
  }
package/src/index.tsx CHANGED
@@ -14,6 +14,7 @@ export { default as MaterialTopTabView } from './views/MaterialTopTabView';
14
14
  */
15
15
  export type {
16
16
  MaterialTopTabBarProps,
17
+ MaterialTopTabNavigationEventMap,
17
18
  MaterialTopTabNavigationOptions,
18
19
  MaterialTopTabNavigationProp,
19
20
  MaterialTopTabScreenProps,
@@ -28,6 +28,7 @@ type Props = DefaultNavigatorOptions<
28
28
  MaterialTopTabNavigationConfig;
29
29
 
30
30
  function MaterialTopTabNavigator({
31
+ id,
31
32
  initialRouteName,
32
33
  backBehavior,
33
34
  children,
@@ -121,6 +122,7 @@ function MaterialTopTabNavigator({
121
122
  MaterialTopTabNavigationOptions,
122
123
  MaterialTopTabNavigationEventMap
123
124
  >(TabRouter, {
125
+ id,
124
126
  initialRouteName,
125
127
  backBehavior,
126
128
  children,
package/src/types.tsx CHANGED
@@ -43,10 +43,12 @@ export type MaterialTopTabNavigationHelpers = NavigationHelpers<
43
43
 
44
44
  export type MaterialTopTabNavigationProp<
45
45
  ParamList extends ParamListBase,
46
- RouteName extends keyof ParamList = keyof ParamList
46
+ RouteName extends keyof ParamList = keyof ParamList,
47
+ NavigatorID extends string | undefined = undefined
47
48
  > = NavigationProp<
48
49
  ParamList,
49
50
  RouteName,
51
+ NavigatorID,
50
52
  TabNavigationState<ParamList>,
51
53
  MaterialTopTabNavigationOptions,
52
54
  MaterialTopTabNavigationEventMap
@@ -55,9 +57,10 @@ export type MaterialTopTabNavigationProp<
55
57
 
56
58
  export type MaterialTopTabScreenProps<
57
59
  ParamList extends ParamListBase,
58
- RouteName extends keyof ParamList = keyof ParamList
60
+ RouteName extends keyof ParamList = keyof ParamList,
61
+ NavigatorID extends string | undefined = undefined
59
62
  > = {
60
- navigation: MaterialTopTabNavigationProp<ParamList, RouteName>;
63
+ navigation: MaterialTopTabNavigationProp<ParamList, RouteName, NavigatorID>;
61
64
  route: RouteProp<ParamList, RouteName>;
62
65
  };
63
66