@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.
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/lib/commonjs/index.js +32 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/navigators/createMaterialTopTabNavigator.js +110 -0
- package/lib/commonjs/navigators/createMaterialTopTabNavigator.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/views/MaterialTopTabBar.js +174 -0
- package/lib/commonjs/views/MaterialTopTabBar.js.map +1 -0
- package/lib/commonjs/views/MaterialTopTabView.js +80 -0
- package/lib/commonjs/views/MaterialTopTabView.js.map +1 -0
- package/lib/module/index.js +14 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/navigators/createMaterialTopTabNavigator.js +92 -0
- package/lib/module/navigators/createMaterialTopTabNavigator.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/views/MaterialTopTabBar.js +155 -0
- package/lib/module/views/MaterialTopTabBar.js.map +1 -0
- package/lib/module/views/MaterialTopTabView.js +63 -0
- package/lib/module/views/MaterialTopTabView.js.map +1 -0
- package/lib/typescript/src/index.d.ts +13 -0
- package/lib/typescript/src/navigators/createMaterialTopTabNavigator.d.ts +7 -0
- package/lib/typescript/src/types.d.ts +190 -0
- package/lib/typescript/src/views/MaterialTopTabBar.d.ts +3 -0
- package/lib/typescript/src/views/MaterialTopTabView.d.ts +10 -0
- package/package.json +82 -0
- package/src/index.tsx +20 -0
- package/src/navigators/createMaterialTopTabNavigator.tsx +145 -0
- package/src/types.tsx +268 -0
- package/src/views/MaterialTopTabBar.tsx +143 -0
- package/src/views/MaterialTopTabView.tsx +75 -0
|
@@ -0,0 +1,155 @@
|
|
|
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 { useTheme } from '@react-navigation/native';
|
|
4
|
+
import Color from 'color';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
7
|
+
import { TabBar, TabBarIndicator } from 'react-native-tab-view';
|
|
8
|
+
export default function TabBarTop({
|
|
9
|
+
state,
|
|
10
|
+
navigation,
|
|
11
|
+
descriptors,
|
|
12
|
+
...rest
|
|
13
|
+
}) {
|
|
14
|
+
var _focusedOptions$tabBa, _focusedOptions$tabBa2;
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
colors
|
|
18
|
+
} = useTheme();
|
|
19
|
+
const focusedOptions = descriptors[state.routes[state.index].key].options;
|
|
20
|
+
const activeColor = (_focusedOptions$tabBa = focusedOptions.tabBarActiveTintColor) !== null && _focusedOptions$tabBa !== void 0 ? _focusedOptions$tabBa : colors.text;
|
|
21
|
+
const inactiveColor = (_focusedOptions$tabBa2 = focusedOptions.tabBarInactiveTintColor) !== null && _focusedOptions$tabBa2 !== void 0 ? _focusedOptions$tabBa2 : Color(activeColor).alpha(0.5).rgb().string();
|
|
22
|
+
return /*#__PURE__*/React.createElement(TabBar, _extends({}, rest, {
|
|
23
|
+
navigationState: state,
|
|
24
|
+
scrollEnabled: focusedOptions.tabBarScrollEnabled,
|
|
25
|
+
bounces: focusedOptions.tabBarBounces,
|
|
26
|
+
activeColor: activeColor,
|
|
27
|
+
inactiveColor: inactiveColor,
|
|
28
|
+
pressColor: focusedOptions.tabBarPressColor,
|
|
29
|
+
pressOpacity: focusedOptions.tabBarPressOpacity,
|
|
30
|
+
tabStyle: focusedOptions.tabBarItemStyle,
|
|
31
|
+
indicatorStyle: [{
|
|
32
|
+
backgroundColor: colors.primary
|
|
33
|
+
}, focusedOptions.tabBarIndicatorStyle],
|
|
34
|
+
indicatorContainerStyle: focusedOptions.tabBarIndicatorContainerStyle,
|
|
35
|
+
contentContainerStyle: focusedOptions.tabBarContentContainerStyle,
|
|
36
|
+
style: [{
|
|
37
|
+
backgroundColor: colors.card
|
|
38
|
+
}, 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
|
+
}) => {
|
|
49
|
+
const event = navigation.emit({
|
|
50
|
+
type: 'tabPress',
|
|
51
|
+
target: route.key,
|
|
52
|
+
canPreventDefault: true
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (event.defaultPrevented) {
|
|
56
|
+
preventDefault();
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
onTabLongPress: ({
|
|
60
|
+
route
|
|
61
|
+
}) => navigation.emit({
|
|
62
|
+
type: 'tabLongPress',
|
|
63
|
+
target: route.key
|
|
64
|
+
}),
|
|
65
|
+
renderIcon: ({
|
|
66
|
+
route,
|
|
67
|
+
focused,
|
|
68
|
+
color
|
|
69
|
+
}) => {
|
|
70
|
+
const {
|
|
71
|
+
options
|
|
72
|
+
} = descriptors[route.key];
|
|
73
|
+
|
|
74
|
+
if (options.tabBarShowIcon === false) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (options.tabBarIcon !== undefined) {
|
|
79
|
+
const icon = options.tabBarIcon({
|
|
80
|
+
focused,
|
|
81
|
+
color
|
|
82
|
+
});
|
|
83
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
84
|
+
style: [styles.icon, options.tabBarIconStyle]
|
|
85
|
+
}, icon);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return null;
|
|
89
|
+
},
|
|
90
|
+
renderLabel: ({
|
|
91
|
+
route,
|
|
92
|
+
focused,
|
|
93
|
+
color
|
|
94
|
+
}) => {
|
|
95
|
+
const {
|
|
96
|
+
options
|
|
97
|
+
} = descriptors[route.key];
|
|
98
|
+
|
|
99
|
+
if (options.tabBarShowLabel === false) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const label = options.tabBarLabel !== undefined ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
|
|
104
|
+
|
|
105
|
+
if (typeof label === 'string') {
|
|
106
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
107
|
+
style: [styles.label, {
|
|
108
|
+
color
|
|
109
|
+
}, options.tabBarLabelStyle],
|
|
110
|
+
allowFontScaling: options.tabBarAllowFontScaling
|
|
111
|
+
}, label);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return label({
|
|
115
|
+
focused,
|
|
116
|
+
color
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
renderBadge: ({
|
|
120
|
+
route
|
|
121
|
+
}) => {
|
|
122
|
+
var _tabBarBadge;
|
|
123
|
+
|
|
124
|
+
const {
|
|
125
|
+
tabBarBadge
|
|
126
|
+
} = descriptors[route.key].options;
|
|
127
|
+
return (_tabBarBadge = tabBarBadge === null || tabBarBadge === void 0 ? void 0 : tabBarBadge()) !== null && _tabBarBadge !== void 0 ? _tabBarBadge : null;
|
|
128
|
+
},
|
|
129
|
+
renderIndicator: ({
|
|
130
|
+
navigationState: state,
|
|
131
|
+
...rest
|
|
132
|
+
}) => {
|
|
133
|
+
return focusedOptions.tabBarIndicator ? focusedOptions.tabBarIndicator({
|
|
134
|
+
state: state,
|
|
135
|
+
...rest
|
|
136
|
+
}) : /*#__PURE__*/React.createElement(TabBarIndicator, _extends({
|
|
137
|
+
navigationState: state
|
|
138
|
+
}, rest));
|
|
139
|
+
}
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
const styles = StyleSheet.create({
|
|
143
|
+
icon: {
|
|
144
|
+
height: 24,
|
|
145
|
+
width: 24
|
|
146
|
+
},
|
|
147
|
+
label: {
|
|
148
|
+
textAlign: 'center',
|
|
149
|
+
textTransform: 'uppercase',
|
|
150
|
+
fontSize: 13,
|
|
151
|
+
margin: 4,
|
|
152
|
+
backgroundColor: 'transparent'
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
//# sourceMappingURL=MaterialTopTabBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["MaterialTopTabBar.tsx"],"names":["useTheme","Color","React","StyleSheet","Text","View","TabBar","TabBarIndicator","TabBarTop","state","navigation","descriptors","rest","colors","focusedOptions","routes","index","key","options","activeColor","tabBarActiveTintColor","text","inactiveColor","tabBarInactiveTintColor","alpha","rgb","string","tabBarScrollEnabled","tabBarBounces","tabBarPressColor","tabBarPressOpacity","tabBarItemStyle","backgroundColor","primary","tabBarIndicatorStyle","tabBarIndicatorContainerStyle","tabBarContentContainerStyle","card","tabBarStyle","route","tabBarAccessibilityLabel","tabBarTestID","preventDefault","event","emit","type","target","canPreventDefault","defaultPrevented","focused","color","tabBarShowIcon","tabBarIcon","undefined","icon","styles","tabBarIconStyle","tabBarShowLabel","label","tabBarLabel","title","name","tabBarLabelStyle","tabBarAllowFontScaling","tabBarBadge","navigationState","tabBarIndicator","create","height","width","textAlign","textTransform","fontSize","margin"],"mappings":";;AAAA,SAIEA,QAJF,QAKO,0BALP;AAMA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,EAAqBC,IAArB,EAA2BC,IAA3B,QAAuC,cAAvC;AACA,SAASC,MAAT,EAAiBC,eAAjB,QAAwC,uBAAxC;AAIA,eAAe,SAASC,SAAT,CAAmB;AAChCC,EAAAA,KADgC;AAEhCC,EAAAA,UAFgC;AAGhCC,EAAAA,WAHgC;AAIhC,KAAGC;AAJ6B,CAAnB,EAKY;AAAA;;AACzB,QAAM;A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Af,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"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { CommonActions, useTheme } from '@react-navigation/native';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { TabView } from 'react-native-tab-view';
|
|
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
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
colors
|
|
17
|
+
} = useTheme();
|
|
18
|
+
|
|
19
|
+
const renderTabBar = props => {
|
|
20
|
+
return tabBar({ ...props,
|
|
21
|
+
state: state,
|
|
22
|
+
navigation: navigation,
|
|
23
|
+
descriptors: descriptors
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const focusedOptions = descriptors[state.routes[state.index].key].options;
|
|
28
|
+
return /*#__PURE__*/React.createElement(TabView, _extends({}, rest, {
|
|
29
|
+
onIndexChange: index => navigation.dispatch({ ...CommonActions.navigate({
|
|
30
|
+
name: state.routes[index].name,
|
|
31
|
+
merge: true
|
|
32
|
+
}),
|
|
33
|
+
target: state.key
|
|
34
|
+
}),
|
|
35
|
+
renderScene: ({
|
|
36
|
+
route
|
|
37
|
+
}) => descriptors[route.key].render(),
|
|
38
|
+
navigationState: state,
|
|
39
|
+
renderTabBar: renderTabBar,
|
|
40
|
+
renderLazyPlaceholder: ({
|
|
41
|
+
route
|
|
42
|
+
}) => {
|
|
43
|
+
var _descriptors$route$ke, _descriptors$route$ke2, _descriptors$route$ke3;
|
|
44
|
+
|
|
45
|
+
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
|
+
},
|
|
47
|
+
lazy: ({
|
|
48
|
+
route
|
|
49
|
+
}) => descriptors[route.key].options.lazy === true,
|
|
50
|
+
lazyPreloadDistance: focusedOptions.lazyPreloadDistance,
|
|
51
|
+
swipeEnabled: focusedOptions.swipeEnabled,
|
|
52
|
+
onSwipeStart: () => navigation.emit({
|
|
53
|
+
type: 'swipeStart'
|
|
54
|
+
}),
|
|
55
|
+
onSwipeEnd: () => navigation.emit({
|
|
56
|
+
type: 'swipeEnd'
|
|
57
|
+
}),
|
|
58
|
+
sceneContainerStyle: [{
|
|
59
|
+
backgroundColor: colors.background
|
|
60
|
+
}, sceneContainerStyle]
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=MaterialTopTabView.js.map
|
|
@@ -0,0 +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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,CAAX,CAAuBC,OAAvB,EAA+BQ,eADV,2DACrB,mDADqB,yEACiC,IADjC;AAAA,KAdzB;AAiBE,IAAA,IAAI,EAAE,CAAC;AAAEF,MAAAA;AAAF,KAAD,KAAef,WAAW,CAACe,KAAK,CAACP,GAAP,CAAX,CAAuBC,OAAvB,CAA+BS,IAA/B,KAAwC,IAjB/D;AAkBE,IAAA,mBAAmB,EAAEb,cAAc,CAACc,mBAlBtC;AAmBE,IAAA,YAAY,EAAEd,cAAc,CAACe,YAnB/B;AAoBE,IAAA,YAAY,EAAE,MAAMrB,UAAU,CAACsB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CApBtB;AAqBE,IAAA,UAAU,EAAE,MAAMvB,UAAU,CAACsB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CArBpB;AAsBE,IAAA,mBAAmB,EAAE,CACnB;AAAEC,MAAAA,eAAe,EAAEpB,MAAM,CAACqB;AAA1B,KADmB,EAEnBvB,mBAFmB;AAtBvB,KADF;AA6BD","sourcesContent":["import {\n CommonActions,\n ParamListBase,\n Route,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { SceneRendererProps, TabView } from 'react-native-tab-view';\n\nimport type {\n MaterialTopTabBarProps,\n MaterialTopTabDescriptorMap,\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationHelpers,\n} from '../types';\nimport MaterialTopTabBar from './MaterialTopTabBar';\n\ntype Props = MaterialTopTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: MaterialTopTabNavigationHelpers;\n descriptors: MaterialTopTabDescriptorMap;\n};\n\nexport default function MaterialTopTabView({\n tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,\n state,\n navigation,\n descriptors,\n sceneContainerStyle,\n ...rest\n}: Props) {\n const { colors } = useTheme();\n\n const renderTabBar = (props: SceneRendererProps) => {\n return tabBar({\n ...props,\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n });\n };\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n return (\n <TabView<Route<string>>\n {...rest}\n onIndexChange={(index) =>\n navigation.dispatch({\n ...CommonActions.navigate({\n name: state.routes[index].name,\n merge: true,\n }),\n target: state.key,\n })\n }\n renderScene={({ route }) => descriptors[route.key].render()}\n navigationState={state}\n renderTabBar={renderTabBar}\n renderLazyPlaceholder={({ route }) =>\n descriptors[route.key].options.lazyPlaceholder?.() ?? null\n }\n lazy={({ route }) => descriptors[route.key].options.lazy === true}\n lazyPreloadDistance={focusedOptions.lazyPreloadDistance}\n swipeEnabled={focusedOptions.swipeEnabled}\n onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}\n onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}\n sceneContainerStyle={[\n { backgroundColor: colors.background },\n sceneContainerStyle,\n ]}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigators
|
|
3
|
+
*/
|
|
4
|
+
export { default as createMaterialTopTabNavigator } from './navigators/createMaterialTopTabNavigator';
|
|
5
|
+
/**
|
|
6
|
+
* Views
|
|
7
|
+
*/
|
|
8
|
+
export { default as MaterialTopTabBar } from './views/MaterialTopTabBar';
|
|
9
|
+
export { default as MaterialTopTabView } from './views/MaterialTopTabView';
|
|
10
|
+
/**
|
|
11
|
+
* Types
|
|
12
|
+
*/
|
|
13
|
+
export type { MaterialTopTabBarProps, MaterialTopTabNavigationOptions, MaterialTopTabNavigationProp, MaterialTopTabScreenProps, } from './types';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DefaultNavigatorOptions, ParamListBase, TabNavigationState, TabRouterOptions } from '@react-navigation/native';
|
|
3
|
+
import type { MaterialTopTabNavigationConfig, MaterialTopTabNavigationEventMap, MaterialTopTabNavigationOptions } from '../types';
|
|
4
|
+
declare type Props = DefaultNavigatorOptions<ParamListBase, TabNavigationState<ParamListBase>, MaterialTopTabNavigationOptions, MaterialTopTabNavigationEventMap> & TabRouterOptions & MaterialTopTabNavigationConfig;
|
|
5
|
+
declare function MaterialTopTabNavigator({ initialRouteName, backBehavior, children, screenListeners, screenOptions, swipeEnabled, lazy, lazyPlaceholder, lazyPreloadDistance, tabBarOptions, ...rest }: Props): JSX.Element;
|
|
6
|
+
declare const _default: <ParamList extends ParamListBase>() => import("@react-navigation/native").TypedNavigator<ParamList, TabNavigationState<ParamListBase>, MaterialTopTabNavigationOptions, MaterialTopTabNavigationEventMap, typeof MaterialTopTabNavigator>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { Descriptor, NavigationHelpers, NavigationProp, ParamListBase, Route, RouteProp, TabActionHelpers, TabNavigationState } from '@react-navigation/native';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
4
|
+
import type { SceneRendererProps, TabBar, TabViewProps } from 'react-native-tab-view';
|
|
5
|
+
export declare type MaterialTopTabNavigationEventMap = {
|
|
6
|
+
/**
|
|
7
|
+
* Event which fires on tapping on the tab in the tab bar.
|
|
8
|
+
*/
|
|
9
|
+
tabPress: {
|
|
10
|
+
data: undefined;
|
|
11
|
+
canPreventDefault: true;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Event which fires on long press on the tab in the tab bar.
|
|
15
|
+
*/
|
|
16
|
+
tabLongPress: {
|
|
17
|
+
data: undefined;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Event which fires when a swipe gesture starts, i.e. finger touches the screen.
|
|
21
|
+
*/
|
|
22
|
+
swipeStart: {
|
|
23
|
+
data: undefined;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Event which fires when a swipe gesture ends, i.e. finger leaves the screen.
|
|
27
|
+
*/
|
|
28
|
+
swipeEnd: {
|
|
29
|
+
data: undefined;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
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>;
|
|
36
|
+
route: RouteProp<ParamList, RouteName>;
|
|
37
|
+
};
|
|
38
|
+
export declare type MaterialTopTabNavigationOptions = {
|
|
39
|
+
/**
|
|
40
|
+
* Title text for the screen.
|
|
41
|
+
*/
|
|
42
|
+
title?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Title string of a tab displayed in the tab bar
|
|
45
|
+
* or a function that given { focused: boolean, color: string } returns a React.Node, to display in tab bar.
|
|
46
|
+
*
|
|
47
|
+
* When undefined, scene title is used. Use `tabBarShowLabel` to hide the label.
|
|
48
|
+
*/
|
|
49
|
+
tabBarLabel?: string | ((props: {
|
|
50
|
+
focused: boolean;
|
|
51
|
+
color: string;
|
|
52
|
+
}) => React.ReactNode);
|
|
53
|
+
/**
|
|
54
|
+
* Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.
|
|
55
|
+
* It's recommended to set this if you don't have a label for the tab.
|
|
56
|
+
*/
|
|
57
|
+
tabBarAccessibilityLabel?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Whether label font should scale to respect Text Size accessibility settings.
|
|
60
|
+
*/
|
|
61
|
+
tabBarAllowFontScaling?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the tab label should be visible. Defaults to `true`.
|
|
64
|
+
*/
|
|
65
|
+
tabBarShowLabel?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* A function that given { focused: boolean, color: string } returns a React.Node to display in the tab bar.
|
|
68
|
+
*/
|
|
69
|
+
tabBarIcon?: (props: {
|
|
70
|
+
focused: boolean;
|
|
71
|
+
color: string;
|
|
72
|
+
}) => React.ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Whether the tab icon should be visible. Defaults to `false`.
|
|
75
|
+
*/
|
|
76
|
+
tabBarShowIcon?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Function that returns a React element to use as a badge for the tab.
|
|
79
|
+
*/
|
|
80
|
+
tabBarBadge?: () => React.ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Function that returns a React element as the tab bar indicator.
|
|
83
|
+
*/
|
|
84
|
+
tabBarIndicator?: (props: Omit<Parameters<React.ComponentProps<typeof TabBar>['renderIndicator']>[0], 'navigationState'> & {
|
|
85
|
+
state: TabNavigationState<ParamListBase>;
|
|
86
|
+
}) => React.ReactNode;
|
|
87
|
+
/**
|
|
88
|
+
* Style object for the tab bar indicator.
|
|
89
|
+
*/
|
|
90
|
+
tabBarIndicatorStyle?: StyleProp<ViewStyle>;
|
|
91
|
+
/**
|
|
92
|
+
* Style object for the view containing the tab bar indicator.
|
|
93
|
+
*/
|
|
94
|
+
tabBarIndicatorContainerStyle?: StyleProp<ViewStyle>;
|
|
95
|
+
/**
|
|
96
|
+
* ID to locate this tab button in tests.
|
|
97
|
+
*/
|
|
98
|
+
tabBarTestID?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Color for the icon and label in the active tab.
|
|
101
|
+
*/
|
|
102
|
+
tabBarActiveTintColor?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Color for the icon and label in the inactive tabs.
|
|
105
|
+
*/
|
|
106
|
+
tabBarInactiveTintColor?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Color for material ripple (Android >= 5.0 only).
|
|
109
|
+
*/
|
|
110
|
+
tabBarPressColor?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Opacity for pressed tab (iOS and Android < 5.0 only).
|
|
113
|
+
*/
|
|
114
|
+
tabBarPressOpacity?: number;
|
|
115
|
+
/**
|
|
116
|
+
* Boolean indicating whether the tab bar bounces when overscrolling.
|
|
117
|
+
*/
|
|
118
|
+
tabBarBounces?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Boolean indicating whether to make the tab bar scrollable.
|
|
121
|
+
*
|
|
122
|
+
* If you set this to `true`, you should also specify a width in `tabBarItemStyle` to improve the performance of initial render.
|
|
123
|
+
*/
|
|
124
|
+
tabBarScrollEnabled?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Style object for the tab icon container.
|
|
127
|
+
*/
|
|
128
|
+
tabBarIconStyle?: StyleProp<ViewStyle>;
|
|
129
|
+
/**
|
|
130
|
+
* Style object for the tab label.
|
|
131
|
+
*/
|
|
132
|
+
tabBarLabelStyle?: StyleProp<TextStyle>;
|
|
133
|
+
/**
|
|
134
|
+
* Style object for the individual tab items.
|
|
135
|
+
*/
|
|
136
|
+
tabBarItemStyle?: StyleProp<ViewStyle>;
|
|
137
|
+
/**
|
|
138
|
+
* Style object for the view containing the tab items.
|
|
139
|
+
*/
|
|
140
|
+
tabBarContentContainerStyle?: StyleProp<ViewStyle>;
|
|
141
|
+
/**
|
|
142
|
+
* Style object for the the tab bar.
|
|
143
|
+
*/
|
|
144
|
+
tabBarStyle?: StyleProp<ViewStyle>;
|
|
145
|
+
/**
|
|
146
|
+
* Whether to enable swipe gestures when this screen is focused.
|
|
147
|
+
* Swipe gestures are enabled by default. Passing `false` will disable swipe gestures,
|
|
148
|
+
* but the user can still switch tabs by pressing the tab bar.
|
|
149
|
+
*/
|
|
150
|
+
swipeEnabled?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Whether this screen should be lazily rendered. When this is set to `true`,
|
|
153
|
+
* the screen will be rendered as it comes into the viewport.
|
|
154
|
+
* By default all screens are rendered to provide a smoother swipe experience.
|
|
155
|
+
* But you might want to defer the rendering of screens out of the viewport until the user sees them.
|
|
156
|
+
* To enable lazy rendering for this screen, set `lazy` to `true`.
|
|
157
|
+
*
|
|
158
|
+
* When you enable `lazy`, the lazy loaded screens will usually take some time to render
|
|
159
|
+
* when they come into the viewport. You can use the `lazyPlaceholder` prop to customize
|
|
160
|
+
* what the user sees during this short period.
|
|
161
|
+
*/
|
|
162
|
+
lazy?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* When `lazy` is enabled, you can specify how many adjacent screens should be preloaded in advance with this prop.
|
|
165
|
+
* This value defaults to `0` which means lazy pages are loaded as they come into the viewport.
|
|
166
|
+
*/
|
|
167
|
+
lazyPreloadDistance?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Function that returns a React element to render if this screen hasn't been rendered yet.
|
|
170
|
+
* The `lazy` option also needs to be enabled for this to work.
|
|
171
|
+
*
|
|
172
|
+
* This view is usually only shown for a split second. Keep it lightweight.
|
|
173
|
+
*
|
|
174
|
+
* By default, this renders `null`.
|
|
175
|
+
*/
|
|
176
|
+
lazyPlaceholder?: () => React.ReactNode;
|
|
177
|
+
};
|
|
178
|
+
export declare type MaterialTopTabDescriptor = Descriptor<MaterialTopTabNavigationOptions, MaterialTopTabNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
|
|
179
|
+
export declare type MaterialTopTabDescriptorMap = Record<string, MaterialTopTabDescriptor>;
|
|
180
|
+
export declare type MaterialTopTabNavigationConfig = Omit<TabViewProps<Route<string>>, 'navigationState' | 'onIndexChange' | 'onSwipeStart' | 'onSwipeEnd' | 'renderScene' | 'renderTabBar' | 'renderLazyPlaceholder' | 'swipeEnabled' | 'lazy' | 'lazyPreloadDistance' | 'lazyPlaceholder'> & {
|
|
181
|
+
/**
|
|
182
|
+
* Function that returns a React element to display as the tab bar.
|
|
183
|
+
*/
|
|
184
|
+
tabBar?: (props: MaterialTopTabBarProps) => React.ReactNode;
|
|
185
|
+
};
|
|
186
|
+
export declare type MaterialTopTabBarProps = SceneRendererProps & {
|
|
187
|
+
state: TabNavigationState<ParamListBase>;
|
|
188
|
+
navigation: NavigationHelpers<ParamListBase, MaterialTopTabNavigationEventMap>;
|
|
189
|
+
descriptors: MaterialTopTabDescriptorMap;
|
|
190
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ParamListBase, TabNavigationState } from '@react-navigation/native';
|
|
3
|
+
import type { MaterialTopTabDescriptorMap, MaterialTopTabNavigationConfig, MaterialTopTabNavigationHelpers } from '../types';
|
|
4
|
+
declare type Props = MaterialTopTabNavigationConfig & {
|
|
5
|
+
state: TabNavigationState<ParamListBase>;
|
|
6
|
+
navigation: MaterialTopTabNavigationHelpers;
|
|
7
|
+
descriptors: MaterialTopTabDescriptorMap;
|
|
8
|
+
};
|
|
9
|
+
export default function MaterialTopTabView({ tabBar, state, navigation, descriptors, sceneContainerStyle, ...rest }: Props): JSX.Element;
|
|
10
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-navigation/material-top-tabs",
|
|
3
|
+
"description": "Integration for the animated tab view component from react-native-tab-view",
|
|
4
|
+
"version": "6.0.3",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native-component",
|
|
7
|
+
"react-component",
|
|
8
|
+
"react-native",
|
|
9
|
+
"react-navigation",
|
|
10
|
+
"ios",
|
|
11
|
+
"android",
|
|
12
|
+
"material",
|
|
13
|
+
"tab"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/react-navigation/react-navigation.git",
|
|
19
|
+
"directory": "packages/material-top-tabs"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/react-navigation/react-navigation/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://reactnavigation.org/docs/material-top-tab-navigator/",
|
|
25
|
+
"main": "lib/commonjs/index.js",
|
|
26
|
+
"react-native": "src/index.tsx",
|
|
27
|
+
"source": "src/index.tsx",
|
|
28
|
+
"module": "lib/module/index.js",
|
|
29
|
+
"types": "lib/typescript/src/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"src",
|
|
32
|
+
"lib",
|
|
33
|
+
"!**/__tests__"
|
|
34
|
+
],
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"prepare": "bob build",
|
|
41
|
+
"clean": "del lib"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"color": "^3.1.3",
|
|
45
|
+
"warn-once": "^0.1.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@react-navigation/native": "^6.0.3",
|
|
49
|
+
"@testing-library/react-native": "^7.2.0",
|
|
50
|
+
"@types/react": "^17.0.9",
|
|
51
|
+
"@types/react-native": "~0.64.9",
|
|
52
|
+
"del-cli": "^3.0.1",
|
|
53
|
+
"react": "~16.13.1",
|
|
54
|
+
"react-native": "~0.63.4",
|
|
55
|
+
"react-native-builder-bob": "^0.18.1",
|
|
56
|
+
"react-native-pager-view": "^5.1.10",
|
|
57
|
+
"react-native-tab-view": "^3.1.1",
|
|
58
|
+
"typescript": "^4.3.2"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@react-navigation/native": "^6.0.0",
|
|
62
|
+
"react": "*",
|
|
63
|
+
"react-native": "*",
|
|
64
|
+
"react-native-pager-view": ">= 4.0.0",
|
|
65
|
+
"react-native-tab-view": ">= 3.0.0"
|
|
66
|
+
},
|
|
67
|
+
"react-native-builder-bob": {
|
|
68
|
+
"source": "src",
|
|
69
|
+
"output": "lib",
|
|
70
|
+
"targets": [
|
|
71
|
+
"commonjs",
|
|
72
|
+
"module",
|
|
73
|
+
[
|
|
74
|
+
"typescript",
|
|
75
|
+
{
|
|
76
|
+
"project": "tsconfig.build.json"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"gitHead": "38ac69f17ee314f96d3d4bcee02349fa4a02d422"
|
|
82
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigators
|
|
3
|
+
*/
|
|
4
|
+
export { default as createMaterialTopTabNavigator } from './navigators/createMaterialTopTabNavigator';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Views
|
|
8
|
+
*/
|
|
9
|
+
export { default as MaterialTopTabBar } from './views/MaterialTopTabBar';
|
|
10
|
+
export { default as MaterialTopTabView } from './views/MaterialTopTabView';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Types
|
|
14
|
+
*/
|
|
15
|
+
export type {
|
|
16
|
+
MaterialTopTabBarProps,
|
|
17
|
+
MaterialTopTabNavigationOptions,
|
|
18
|
+
MaterialTopTabNavigationProp,
|
|
19
|
+
MaterialTopTabScreenProps,
|
|
20
|
+
} from './types';
|