@amazon-devices/react-navigation__material-bottom-tabs 2.0.1758683737
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 +7 -0
- package/README.md +5 -0
- package/SystemBundles/48b2d0564ba9108d11d2a44e7db78d96e57b1571852ee96e2ae586ec3f92ac7c.bundle +37933 -0
- package/SystemBundles/48b2d0564ba9108d11d2a44e7db78d96e57b1571852ee96e2ae586ec3f92ac7c.map +9186 -0
- package/SystemBundles/dfdc0833a74825464b3c13f4ae466765136f1747e62e61be666c766e2b8fe7c6.bundle +32656 -0
- package/SystemBundles/dfdc0833a74825464b3c13f4ae466765136f1747e62e61be666c766e2b8fe7c6.map +1 -0
- package/SystemModules/amzn__react-navigation__material-bottom-tabs-2.modules.txt +4 -0
- package/SystemModules/amzn__react-navigation__material-bottom-tabs-2.private.modules.txt +250 -0
- package/SystemModules/keplerscript-system-bundle-config.json +7 -0
- package/THIRD_PARTY_NOTICES.txt +24 -0
- package/kepler-compatibility.json +8 -0
- package/kepler-transformed-package-info.json +3 -0
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/navigators/createMaterialBottomTabNavigator.js +43 -0
- package/lib/commonjs/navigators/createMaterialBottomTabNavigator.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/views/MaterialBottomTabView.js +196 -0
- package/lib/commonjs/views/MaterialBottomTabView.js.map +1 -0
- package/lib/module/index.js +14 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/navigators/createMaterialBottomTabNavigator.js +34 -0
- package/lib/module/navigators/createMaterialBottomTabNavigator.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/views/MaterialBottomTabView.js +188 -0
- package/lib/module/views/MaterialBottomTabView.js.map +1 -0
- package/lib/typescript/src/index.d.ts +13 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/navigators/createMaterialBottomTabNavigator.d.ts +8 -0
- package/lib/typescript/src/navigators/createMaterialBottomTabNavigator.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +56 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/views/MaterialBottomTabView.d.ts +11 -0
- package/lib/typescript/src/views/MaterialBottomTabView.d.ts.map +1 -0
- package/package.json +1 -0
- package/src/index.tsx +19 -0
- package/src/navigators/createMaterialBottomTabNavigator.tsx +71 -0
- package/src/types.tsx +118 -0
- package/src/views/MaterialBottomTabView.tsx +244 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigators
|
|
3
|
+
*/
|
|
4
|
+
export { default as createMaterialBottomTabNavigator } from './navigators/createMaterialBottomTabNavigator';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Views
|
|
8
|
+
*/
|
|
9
|
+
export { default as MaterialBottomTabView } from './views/MaterialBottomTabView';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Types
|
|
13
|
+
*/
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","createMaterialBottomTabNavigator","MaterialBottomTabView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,gCAAgC,QAAQ,+CAA+C;;AAE3G;AACA;AACA;AACA,SAASD,OAAO,IAAIE,qBAAqB,QAAQ,+BAA+B;;AAEhF;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import { createNavigatorFactory, TabRouter, useNavigationBuilder } from '@amazon-devices/react-navigation__native';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import MaterialBottomTabView from '../views/MaterialBottomTabView';
|
|
5
|
+
function MaterialBottomTabNavigator({
|
|
6
|
+
id,
|
|
7
|
+
initialRouteName,
|
|
8
|
+
backBehavior,
|
|
9
|
+
children,
|
|
10
|
+
screenListeners,
|
|
11
|
+
screenOptions,
|
|
12
|
+
...rest
|
|
13
|
+
}) {
|
|
14
|
+
const {
|
|
15
|
+
state,
|
|
16
|
+
descriptors,
|
|
17
|
+
navigation,
|
|
18
|
+
NavigationContent
|
|
19
|
+
} = useNavigationBuilder(TabRouter, {
|
|
20
|
+
id,
|
|
21
|
+
initialRouteName,
|
|
22
|
+
backBehavior,
|
|
23
|
+
children,
|
|
24
|
+
screenListeners,
|
|
25
|
+
screenOptions
|
|
26
|
+
});
|
|
27
|
+
return /*#__PURE__*/React.createElement(NavigationContent, null, /*#__PURE__*/React.createElement(MaterialBottomTabView, _extends({}, rest, {
|
|
28
|
+
state: state,
|
|
29
|
+
navigation: navigation,
|
|
30
|
+
descriptors: descriptors
|
|
31
|
+
})));
|
|
32
|
+
}
|
|
33
|
+
export default createNavigatorFactory(MaterialBottomTabNavigator);
|
|
34
|
+
//# sourceMappingURL=createMaterialBottomTabNavigator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createNavigatorFactory","TabRouter","useNavigationBuilder","React","MaterialBottomTabView","MaterialBottomTabNavigator","id","initialRouteName","backBehavior","children","screenListeners","screenOptions","rest","state","descriptors","navigation","NavigationContent","createElement","_extends"],"sourceRoot":"../../../src","sources":["navigators/createMaterialBottomTabNavigator.tsx"],"mappings":";AAAA,SACEA,sBAAsB,EAKtBC,SAAS,EAETC,oBAAoB,QACf,gCAAgC;AACvC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAO9B,OAAOC,qBAAqB,MAAM,gCAAgC;AAWlE,SAASC,0BAA0BA,CAAC;EAClCC,EAAE;EACFC,gBAAgB;EAChBC,YAAY;EACZC,QAAQ;EACRC,eAAe;EACfC,aAAa;EACb,GAAGC;AACE,CAAC,EAAE;EACR,MAAM;IAAEC,KAAK;IAAEC,WAAW;IAAEC,UAAU;IAAEC;EAAkB,CAAC,GACzDd,oBAAoB,CAMlBD,SAAS,EAAE;IACXK,EAAE;IACFC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC,eAAe;IACfC;EACF,CAAC,CAAC;EAEJ,oBACER,KAAA,CAAAc,aAAA,CAACD,iBAAiB,qBAChBb,KAAA,CAAAc,aAAA,CAACb,qBAAqB,EAAAc,QAAA,KAChBN,IAAI;IACRC,KAAK,EAAEA,KAAM;IACbE,UAAU,EAAEA,UAAW;IACvBD,WAAW,EAAEA;EAAY,EAC1B,CACgB,CAAC;AAExB;AAEA,eAAed,sBAAsB,CAKnCK,0BAA0B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import { SafeAreaProviderCompat } from '@amazon-devices/react-navigation__elements';
|
|
3
|
+
import { CommonActions, Link, useLinkBuilder, useTheme } from '@amazon-devices/react-navigation__native';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { Platform, StyleSheet, Text } from 'react-native';
|
|
6
|
+
import { BottomNavigation, DarkTheme, DefaultTheme, useTheme as usePaperTheme } from 'react-native-paper';
|
|
7
|
+
import { useSafeAreaInsets } from '@amazon-devices/react-native-safe-area-context';
|
|
8
|
+
// Optionally require vector-icons referenced from react-native-paper:
|
|
9
|
+
// https://github.com/callstack/react-native-paper/blob/4b26429c49053eaa4c3e0fae208639e01093fa87/src/components/MaterialCommunityIcon.tsx#L14
|
|
10
|
+
let MaterialCommunityIcons;
|
|
11
|
+
try {
|
|
12
|
+
// Optionally require vector-icons
|
|
13
|
+
MaterialCommunityIcons = require('react-native-vector-icons/MaterialCommunityIcons').default;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
let isErrorLogged = false;
|
|
16
|
+
|
|
17
|
+
// Fallback component for icons
|
|
18
|
+
MaterialCommunityIcons = ({
|
|
19
|
+
name,
|
|
20
|
+
color,
|
|
21
|
+
size,
|
|
22
|
+
selectionColor: _0,
|
|
23
|
+
onLayout: _1,
|
|
24
|
+
...rest
|
|
25
|
+
}) => {
|
|
26
|
+
if (!isErrorLogged) {
|
|
27
|
+
if (!/(Cannot find module|Module not found|Cannot resolve module)/.test(e.message)) {
|
|
28
|
+
console.error(e);
|
|
29
|
+
}
|
|
30
|
+
console.warn(`Tried to use the icon '${name}' in a component from '@amazon-devices/react-navigation__material-bottom-tabs', but 'react-native-vector-icons/MaterialCommunityIcons' could not be loaded.`, `To remove this warning, try installing 'react-native-vector-icons' or use another method to specify icon: https://reactnavigation.org/docs/material-bottom-tab-navigator/#tabbaricon.`);
|
|
31
|
+
isErrorLogged = true;
|
|
32
|
+
}
|
|
33
|
+
return /*#__PURE__*/React.createElement(Text, _extends({}, rest, {
|
|
34
|
+
style: [styles.icon, {
|
|
35
|
+
color: typeof color !== 'number' ? color : undefined,
|
|
36
|
+
fontSize: size
|
|
37
|
+
}]
|
|
38
|
+
}), "\u25A1");
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function MaterialBottomTabViewInner({
|
|
42
|
+
state,
|
|
43
|
+
navigation,
|
|
44
|
+
descriptors,
|
|
45
|
+
safeAreaInsets,
|
|
46
|
+
...rest
|
|
47
|
+
}) {
|
|
48
|
+
const insets = useSafeAreaInsets();
|
|
49
|
+
const {
|
|
50
|
+
dark,
|
|
51
|
+
colors
|
|
52
|
+
} = useTheme();
|
|
53
|
+
const paperTheme = usePaperTheme();
|
|
54
|
+
const buildLink = useLinkBuilder();
|
|
55
|
+
const t =
|
|
56
|
+
// If the theme from React Navigation and Paper match, then user the customized theme
|
|
57
|
+
// Otherwise fallback to the matching default theme from Paper
|
|
58
|
+
dark === paperTheme.dark ? paperTheme : dark ? DarkTheme : DefaultTheme;
|
|
59
|
+
const theme = React.useMemo(() => {
|
|
60
|
+
return {
|
|
61
|
+
...t,
|
|
62
|
+
colors: {
|
|
63
|
+
...t.colors,
|
|
64
|
+
...colors,
|
|
65
|
+
surface: colors.card
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}, [colors, t]);
|
|
69
|
+
return /*#__PURE__*/React.createElement(BottomNavigation, _extends({}, rest, {
|
|
70
|
+
theme: theme,
|
|
71
|
+
navigationState: state,
|
|
72
|
+
onIndexChange: index => navigation.dispatch({
|
|
73
|
+
...CommonActions.navigate({
|
|
74
|
+
name: state.routes[index].name,
|
|
75
|
+
merge: true
|
|
76
|
+
}),
|
|
77
|
+
target: state.key
|
|
78
|
+
}),
|
|
79
|
+
renderScene: ({
|
|
80
|
+
route
|
|
81
|
+
}) => descriptors[route.key].render(),
|
|
82
|
+
renderTouchable: Platform.OS === 'web' ? ({
|
|
83
|
+
onPress,
|
|
84
|
+
route,
|
|
85
|
+
accessibilityRole: _0,
|
|
86
|
+
borderless: _1,
|
|
87
|
+
centered: _2,
|
|
88
|
+
rippleColor: _3,
|
|
89
|
+
style,
|
|
90
|
+
...rest
|
|
91
|
+
}) => {
|
|
92
|
+
return /*#__PURE__*/React.createElement(Link, _extends({}, rest, {
|
|
93
|
+
// @ts-expect-error: to could be undefined, but it doesn't affect functionality
|
|
94
|
+
to: buildLink(route.name, route.params),
|
|
95
|
+
accessibilityRole: "link",
|
|
96
|
+
onPress: e => {
|
|
97
|
+
if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && (
|
|
98
|
+
// ignore clicks with modifier keys
|
|
99
|
+
e.button == null || e.button === 0) // ignore everything but left clicks
|
|
100
|
+
) {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
onPress === null || onPress === void 0 || onPress(e);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// TODO: Update @types/react-native to higher version when it will be available and remove ts-ignore
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
,
|
|
108
|
+
style: [styles.touchable, style]
|
|
109
|
+
}));
|
|
110
|
+
} : undefined,
|
|
111
|
+
renderIcon: ({
|
|
112
|
+
route,
|
|
113
|
+
focused,
|
|
114
|
+
color
|
|
115
|
+
}) => {
|
|
116
|
+
const {
|
|
117
|
+
options
|
|
118
|
+
} = descriptors[route.key];
|
|
119
|
+
if (typeof options.tabBarIcon === 'string') {
|
|
120
|
+
return /*#__PURE__*/React.createElement(MaterialCommunityIcons, {
|
|
121
|
+
name: options.tabBarIcon,
|
|
122
|
+
color: color,
|
|
123
|
+
size: 24,
|
|
124
|
+
style: styles.icon
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (typeof options.tabBarIcon === 'function') {
|
|
128
|
+
return options.tabBarIcon({
|
|
129
|
+
focused,
|
|
130
|
+
color
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
},
|
|
135
|
+
getLabelText: ({
|
|
136
|
+
route
|
|
137
|
+
}) => {
|
|
138
|
+
const {
|
|
139
|
+
options
|
|
140
|
+
} = descriptors[route.key];
|
|
141
|
+
return options.tabBarLabel !== undefined ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
|
|
142
|
+
},
|
|
143
|
+
getColor: ({
|
|
144
|
+
route
|
|
145
|
+
}) => descriptors[route.key].options.tabBarColor,
|
|
146
|
+
getBadge: ({
|
|
147
|
+
route
|
|
148
|
+
}) => descriptors[route.key].options.tabBarBadge,
|
|
149
|
+
getAccessibilityLabel: ({
|
|
150
|
+
route
|
|
151
|
+
}) => descriptors[route.key].options.tabBarAccessibilityLabel,
|
|
152
|
+
getTestID: ({
|
|
153
|
+
route
|
|
154
|
+
}) => descriptors[route.key].options.tabBarTestID,
|
|
155
|
+
onTabPress: ({
|
|
156
|
+
route,
|
|
157
|
+
preventDefault
|
|
158
|
+
}) => {
|
|
159
|
+
const event = navigation.emit({
|
|
160
|
+
type: 'tabPress',
|
|
161
|
+
target: route.key,
|
|
162
|
+
canPreventDefault: true
|
|
163
|
+
});
|
|
164
|
+
if (event.defaultPrevented) {
|
|
165
|
+
preventDefault();
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
safeAreaInsets: {
|
|
169
|
+
top: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.top) ?? (insets === null || insets === void 0 ? void 0 : insets.top),
|
|
170
|
+
right: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.right) ?? (insets === null || insets === void 0 ? void 0 : insets.right),
|
|
171
|
+
bottom: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.bottom) ?? (insets === null || insets === void 0 ? void 0 : insets.bottom),
|
|
172
|
+
left: (safeAreaInsets === null || safeAreaInsets === void 0 ? void 0 : safeAreaInsets.left) ?? (insets === null || insets === void 0 ? void 0 : insets.left)
|
|
173
|
+
}
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
export default function MaterialBottomTabView(props) {
|
|
177
|
+
return /*#__PURE__*/React.createElement(SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(MaterialBottomTabViewInner, props));
|
|
178
|
+
}
|
|
179
|
+
const styles = StyleSheet.create({
|
|
180
|
+
icon: {
|
|
181
|
+
backgroundColor: 'transparent'
|
|
182
|
+
},
|
|
183
|
+
touchable: {
|
|
184
|
+
display: 'flex',
|
|
185
|
+
justifyContent: 'center'
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
//# sourceMappingURL=MaterialBottomTabView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SafeAreaProviderCompat","CommonActions","Link","useLinkBuilder","useTheme","React","Platform","StyleSheet","Text","BottomNavigation","DarkTheme","DefaultTheme","usePaperTheme","useSafeAreaInsets","MaterialCommunityIcons","require","default","e","isErrorLogged","name","color","size","selectionColor","_0","onLayout","_1","rest","test","message","console","error","warn","createElement","_extends","style","styles","icon","undefined","fontSize","MaterialBottomTabViewInner","state","navigation","descriptors","safeAreaInsets","insets","dark","colors","paperTheme","buildLink","t","theme","useMemo","surface","card","navigationState","onIndexChange","index","dispatch","navigate","routes","merge","target","key","renderScene","route","render","renderTouchable","OS","onPress","accessibilityRole","borderless","centered","_2","rippleColor","_3","to","params","metaKey","altKey","ctrlKey","shiftKey","button","preventDefault","touchable","renderIcon","focused","options","tabBarIcon","getLabelText","tabBarLabel","title","getColor","tabBarColor","getBadge","tabBarBadge","getAccessibilityLabel","tabBarAccessibilityLabel","getTestID","tabBarTestID","onTabPress","event","emit","type","canPreventDefault","defaultPrevented","top","right","bottom","left","MaterialBottomTabView","props","create","backgroundColor","display","justifyContent"],"sourceRoot":"../../../src","sources":["views/MaterialBottomTabView.tsx"],"mappings":";AAAA,SAASA,sBAAsB,QAAQ,kCAAkC;AACzE,SACEC,aAAa,EACbC,IAAI,EAIJC,cAAc,EACdC,QAAQ,QACH,gCAAgC;AACvC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACzD,SACEC,gBAAgB,EAChBC,SAAS,EACTC,YAAY,EACZP,QAAQ,IAAIQ,aAAa,QACpB,oBAAoB;AAC3B,SAASC,iBAAiB,QAAQ,sCAAsC;AAgBxE;AACA;AACA,IAAIC,sBAIH;AAED,IAAI;EACF;EACAA,sBAAsB,GACpBC,OAAO,CAAC,kDAAkD,CAAC,CAACC,OAAO;AACvE,CAAC,CAAC,OAAOC,CAAM,EAAE;EACf,IAAIC,aAAa,GAAG,KAAK;;EAEzB;EACAJ,sBAAsB,GAAGA,CAAC;IACxBK,IAAI;IAC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dA,cAAc,uBAAdA,cAAc,CAAEiE,IAAI,MAAIhE,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEgE,IAAI;IAC5C;EAAE,EACH,CAAC;AAEN;AAEA,eAAe,SAASC,qBAAqBA,CAACC,KAAY,EAAE;EAC1D,oBACEzG,KAAA,CAAA2B,aAAA,CAAChC,sBAAsB,qBACrBK,KAAA,CAAA2B,aAAA,CAACO,0BAA0B,EAAKuE,KAAQ,CAClB,CAAC;AAE7B;AAEA,MAAM3E,MAAM,GAAG5B,UAAU,CAACwG,MAAM,CAAC;EAC/B3E,IAAI,EAAE;IACJ4E,eAAe,EAAE;EACnB,CAAC;EACD7B,SAAS,EAAE;IACT8B,OAAO,EAAE,MAAM;IACfC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigators
|
|
3
|
+
*/
|
|
4
|
+
export { default as createMaterialBottomTabNavigator } from './navigators/createMaterialBottomTabNavigator';
|
|
5
|
+
/**
|
|
6
|
+
* Views
|
|
7
|
+
*/
|
|
8
|
+
export { default as MaterialBottomTabView } from './views/MaterialBottomTabView';
|
|
9
|
+
/**
|
|
10
|
+
* Types
|
|
11
|
+
*/
|
|
12
|
+
export type { MaterialBottomTabNavigationEventMap, MaterialBottomTabNavigationOptions, MaterialBottomTabNavigationProp, MaterialBottomTabScreenProps, } from './types';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AAE5G;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEjF;;GAEG;AACH,YAAY,EACV,mCAAmC,EACnC,kCAAkC,EAClC,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DefaultNavigatorOptions, ParamListBase, TabNavigationState, TabRouterOptions } from '@amazon-devices/react-navigation__native';
|
|
3
|
+
import type { MaterialBottomTabNavigationConfig, MaterialBottomTabNavigationEventMap, MaterialBottomTabNavigationOptions } from '../types';
|
|
4
|
+
type Props = DefaultNavigatorOptions<ParamListBase, TabNavigationState<ParamListBase>, MaterialBottomTabNavigationOptions, MaterialBottomTabNavigationEventMap> & TabRouterOptions & MaterialBottomTabNavigationConfig;
|
|
5
|
+
declare function MaterialBottomTabNavigator({ id, initialRouteName, backBehavior, children, screenListeners, screenOptions, ...rest }: Props): JSX.Element;
|
|
6
|
+
declare const _default: <ParamList extends ParamListBase>() => import("@amazon-devices/react-navigation__native").TypedNavigator<ParamList, TabNavigationState<ParamListBase>, MaterialBottomTabNavigationOptions, MaterialBottomTabNavigationEventMap, typeof MaterialBottomTabNavigator>;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=createMaterialBottomTabNavigator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMaterialBottomTabNavigator.d.ts","sourceRoot":"","sources":["../../../../src/navigators/createMaterialBottomTabNavigator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,uBAAuB,EACvB,aAAa,EAEb,kBAAkB,EAElB,gBAAgB,EAEjB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EACV,iCAAiC,EACjC,mCAAmC,EACnC,kCAAkC,EACnC,MAAM,UAAU,CAAC;AAGlB,KAAK,KAAK,GAAG,uBAAuB,CAClC,aAAa,EACb,kBAAkB,CAAC,aAAa,CAAC,EACjC,kCAAkC,EAClC,mCAAmC,CACpC,GACC,gBAAgB,GAChB,iCAAiC,CAAC;AAEpC,iBAAS,0BAA0B,CAAC,EAClC,EAAE,EACF,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,aAAa,EACb,GAAG,IAAI,EACR,EAAE,KAAK,eA2BP;;AAED,wBAK8B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Descriptor, NavigationHelpers, NavigationProp, ParamListBase, RouteProp, TabActionHelpers, TabNavigationState } from '@amazon-devices/react-navigation__native';
|
|
3
|
+
import type { BottomNavigation } from 'react-native-paper';
|
|
4
|
+
export type MaterialBottomTabNavigationEventMap = {
|
|
5
|
+
/**
|
|
6
|
+
* Event which fires on tapping on the tab in the tab bar.
|
|
7
|
+
*/
|
|
8
|
+
tabPress: {
|
|
9
|
+
data: undefined;
|
|
10
|
+
canPreventDefault: true;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type MaterialBottomTabNavigationHelpers = NavigationHelpers<ParamListBase, MaterialBottomTabNavigationEventMap> & TabActionHelpers<ParamListBase>;
|
|
14
|
+
export type MaterialBottomTabNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = NavigationProp<ParamList, RouteName, NavigatorID, TabNavigationState<ParamList>, MaterialBottomTabNavigationOptions, MaterialBottomTabNavigationEventMap> & TabActionHelpers<ParamList>;
|
|
15
|
+
export type MaterialBottomTabScreenProps<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = {
|
|
16
|
+
navigation: MaterialBottomTabNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
17
|
+
route: RouteProp<ParamList, RouteName>;
|
|
18
|
+
};
|
|
19
|
+
export type MaterialBottomTabNavigationOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* Title text for the screen.
|
|
22
|
+
*/
|
|
23
|
+
title?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Color of the tab bar when this tab is active. Only used when `shifting` is `true`.
|
|
26
|
+
*/
|
|
27
|
+
tabBarColor?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Label text of the tab displayed in the navigation bar. When undefined, scene title is used.
|
|
30
|
+
*/
|
|
31
|
+
tabBarLabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* String referring to an icon in the `MaterialCommunityIcons` set, or a
|
|
34
|
+
* function that given { focused: boolean, color: string } returns a React.Node to display in the navigation bar.
|
|
35
|
+
*/
|
|
36
|
+
tabBarIcon?: string | ((props: {
|
|
37
|
+
focused: boolean;
|
|
38
|
+
color: string;
|
|
39
|
+
}) => React.ReactNode);
|
|
40
|
+
/**
|
|
41
|
+
* Badge to show on the tab icon, can be `true` to show a dot, `string` or `number` to show text.
|
|
42
|
+
*/
|
|
43
|
+
tabBarBadge?: boolean | number | string;
|
|
44
|
+
/**
|
|
45
|
+
* Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.
|
|
46
|
+
*/
|
|
47
|
+
tabBarAccessibilityLabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* ID to locate this tab button in tests.
|
|
50
|
+
*/
|
|
51
|
+
tabBarTestID?: string;
|
|
52
|
+
};
|
|
53
|
+
export type MaterialBottomTabDescriptor = Descriptor<MaterialBottomTabNavigationOptions, MaterialBottomTabNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
|
|
54
|
+
export type MaterialBottomTabDescriptorMap = Record<string, MaterialBottomTabDescriptor>;
|
|
55
|
+
export type MaterialBottomTabNavigationConfig = Partial<Omit<React.ComponentProps<typeof BottomNavigation>, 'navigationState' | 'onIndexChange' | 'onTabPress' | 'renderScene' | 'renderLabel' | 'renderIcon' | 'getAccessibilityLabel' | 'getBadge' | 'getColor' | 'getLabelText' | 'getTestID'>>;
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAA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CAAC,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAEtE;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAExC;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAClD,kCAAkC,EAClC,+BAA+B,CAAC,aAAa,CAAC,EAC9C,SAAS,CAAC,aAAa,CAAC,CACzB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,MAAM,CACjD,MAAM,EACN,2BAA2B,CAC5B,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CACrD,IAAI,CACF,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,EAC3C,iBAAiB,GACjB,eAAe,GACf,YAAY,GACZ,aAAa,GACb,aAAa,GACb,YAAY,GACZ,uBAAuB,GACvB,UAAU,GACV,UAAU,GACV,cAAc,GACd,WAAW,CACd,CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ParamListBase, TabNavigationState } from '@amazon-devices/react-navigation__native';
|
|
3
|
+
import type { MaterialBottomTabDescriptorMap, MaterialBottomTabNavigationConfig, MaterialBottomTabNavigationHelpers } from '../types';
|
|
4
|
+
type Props = MaterialBottomTabNavigationConfig & {
|
|
5
|
+
state: TabNavigationState<ParamListBase>;
|
|
6
|
+
navigation: MaterialBottomTabNavigationHelpers;
|
|
7
|
+
descriptors: MaterialBottomTabDescriptorMap;
|
|
8
|
+
};
|
|
9
|
+
export default function MaterialBottomTabView(props: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=MaterialBottomTabView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaterialBottomTabView.d.ts","sourceRoot":"","sources":["../../../../src/views/MaterialBottomTabView.tsx"],"names":[],"mappings":";AACA,OAAO,EAGL,aAAa,EAEb,kBAAkB,EAGnB,MAAM,gCAAgC,CAAC;AAWxC,OAAO,KAAK,EACV,8BAA8B,EAC9B,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,UAAU,CAAC;AAElB,KAAK,KAAK,GAAG,iCAAiC,GAAG;IAC/C,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,kCAAkC,CAAC;IAC/C,WAAW,EAAE,8BAA8B,CAAC;CAC7C,CAAC;AAqMF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,KAAK,EAAE,KAAK,eAMzD"}
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name": "@amazon-devices/react-navigation__material-bottom-tabs", "description": "Integration for bottom navigation component from react-native-paper", "version": "2.0.1758683737+6.2.18", "keywords": ["react-native-component", "react-component", "react-native", "react-navigation", "ios", "android", "material", "tab"], "license": "See license in LICENSE", "repository": {"type": "git", "url": "https://github.com/react-navigation/react-navigation.git", "directory": "packages/material-bottom-tabs"}, "bugs": {"url": "https://github.com/react-navigation/react-navigation/issues"}, "homepage": "https://reactnavigation.org/docs/material-bottom-tab-navigator/", "main": "lib/commonjs/index.js", "react-native": "src/index.tsx", "source": "src/index.tsx", "module": "lib/module/index.js", "types": "lib/typescript/src/index.d.ts", "files": ["src", "lib", "kepler-compatibility.json", "!**/__tests__", "SystemModules", "SystemBundles", "THIRD_PARTY_NOTICES.txt", "kepler-transformed-package-info.json"], "sideEffects": false, "kepler": {"temporary-alias-for-package": {"name": "@react-navigation/material-bottom-tabs", "version": "6.2.18"}}, "publishConfig": {"access": "public"}, "scripts": {"clean": "del lib"}, "dependencies": {"@amazon-devices/react-navigation__elements": "^2.0.0+1.3.20"}, "devDependencies": {"@amazon-devices/react-navigation__native": "^2.0.0+6.1.9", "@testing-library/react-native": "11.5.0", "@types/react": "17.0.2", "@types/jest": "26.0.15", "@types/react-native-vector-icons": "6.4.10", "del-cli": "5.0.0", "react": "17.0.2", "react-native": "0.72.0", "react-native-builder-bob": "0.20.4", "react-native-paper": "4.12.1", "@amazon-devices/react-native-safe-area-context": "^2.0.0+3.2.0", "react-native-vector-icons": "9.1.0", "typescript": "4.9.4"}, "peerDependencies": {"@amazon-devices/react-navigation__native": "^2.0.0+6.1.9", "react": "*", "react-native": "*", "react-native-paper": ">= 3.0.0", "@amazon-devices/react-native-safe-area-context": "^2.0.0+3.2.0", "react-native-vector-icons": ">= 6.0.0"}, "react-native-builder-bob": {"source": "src", "output": "lib", "targets": ["commonjs", "module", ["typescript", {"project": "tsconfig.build.json"}]]}}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigators
|
|
3
|
+
*/
|
|
4
|
+
export { default as createMaterialBottomTabNavigator } from './navigators/createMaterialBottomTabNavigator';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Views
|
|
8
|
+
*/
|
|
9
|
+
export { default as MaterialBottomTabView } from './views/MaterialBottomTabView';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Types
|
|
13
|
+
*/
|
|
14
|
+
export type {
|
|
15
|
+
MaterialBottomTabNavigationEventMap,
|
|
16
|
+
MaterialBottomTabNavigationOptions,
|
|
17
|
+
MaterialBottomTabNavigationProp,
|
|
18
|
+
MaterialBottomTabScreenProps,
|
|
19
|
+
} from './types';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createNavigatorFactory,
|
|
3
|
+
DefaultNavigatorOptions,
|
|
4
|
+
ParamListBase,
|
|
5
|
+
TabActionHelpers,
|
|
6
|
+
TabNavigationState,
|
|
7
|
+
TabRouter,
|
|
8
|
+
TabRouterOptions,
|
|
9
|
+
useNavigationBuilder,
|
|
10
|
+
} from '@amazon-devices/react-navigation__native';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
MaterialBottomTabNavigationConfig,
|
|
15
|
+
MaterialBottomTabNavigationEventMap,
|
|
16
|
+
MaterialBottomTabNavigationOptions,
|
|
17
|
+
} from '../types';
|
|
18
|
+
import MaterialBottomTabView from '../views/MaterialBottomTabView';
|
|
19
|
+
|
|
20
|
+
type Props = DefaultNavigatorOptions<
|
|
21
|
+
ParamListBase,
|
|
22
|
+
TabNavigationState<ParamListBase>,
|
|
23
|
+
MaterialBottomTabNavigationOptions,
|
|
24
|
+
MaterialBottomTabNavigationEventMap
|
|
25
|
+
> &
|
|
26
|
+
TabRouterOptions &
|
|
27
|
+
MaterialBottomTabNavigationConfig;
|
|
28
|
+
|
|
29
|
+
function MaterialBottomTabNavigator({
|
|
30
|
+
id,
|
|
31
|
+
initialRouteName,
|
|
32
|
+
backBehavior,
|
|
33
|
+
children,
|
|
34
|
+
screenListeners,
|
|
35
|
+
screenOptions,
|
|
36
|
+
...rest
|
|
37
|
+
}: Props) {
|
|
38
|
+
const { state, descriptors, navigation, NavigationContent } =
|
|
39
|
+
useNavigationBuilder<
|
|
40
|
+
TabNavigationState<ParamListBase>,
|
|
41
|
+
TabRouterOptions,
|
|
42
|
+
TabActionHelpers<ParamListBase>,
|
|
43
|
+
MaterialBottomTabNavigationOptions,
|
|
44
|
+
MaterialBottomTabNavigationEventMap
|
|
45
|
+
>(TabRouter, {
|
|
46
|
+
id,
|
|
47
|
+
initialRouteName,
|
|
48
|
+
backBehavior,
|
|
49
|
+
children,
|
|
50
|
+
screenListeners,
|
|
51
|
+
screenOptions,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<NavigationContent>
|
|
56
|
+
<MaterialBottomTabView
|
|
57
|
+
{...rest}
|
|
58
|
+
state={state}
|
|
59
|
+
navigation={navigation}
|
|
60
|
+
descriptors={descriptors}
|
|
61
|
+
/>
|
|
62
|
+
</NavigationContent>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default createNavigatorFactory<
|
|
67
|
+
TabNavigationState<ParamListBase>,
|
|
68
|
+
MaterialBottomTabNavigationOptions,
|
|
69
|
+
MaterialBottomTabNavigationEventMap,
|
|
70
|
+
typeof MaterialBottomTabNavigator
|
|
71
|
+
>(MaterialBottomTabNavigator);
|
package/src/types.tsx
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Descriptor,
|
|
3
|
+
NavigationHelpers,
|
|
4
|
+
NavigationProp,
|
|
5
|
+
ParamListBase,
|
|
6
|
+
RouteProp,
|
|
7
|
+
TabActionHelpers,
|
|
8
|
+
TabNavigationState,
|
|
9
|
+
} from '@amazon-devices/react-navigation__native';
|
|
10
|
+
import type { BottomNavigation } from 'react-native-paper';
|
|
11
|
+
|
|
12
|
+
export type MaterialBottomTabNavigationEventMap = {
|
|
13
|
+
/**
|
|
14
|
+
* Event which fires on tapping on the tab in the tab bar.
|
|
15
|
+
*/
|
|
16
|
+
tabPress: { data: undefined; canPreventDefault: true };
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type MaterialBottomTabNavigationHelpers = NavigationHelpers<
|
|
20
|
+
ParamListBase,
|
|
21
|
+
MaterialBottomTabNavigationEventMap
|
|
22
|
+
> &
|
|
23
|
+
TabActionHelpers<ParamListBase>;
|
|
24
|
+
|
|
25
|
+
export type MaterialBottomTabNavigationProp<
|
|
26
|
+
ParamList extends ParamListBase,
|
|
27
|
+
RouteName extends keyof ParamList = keyof ParamList,
|
|
28
|
+
NavigatorID extends string | undefined = undefined
|
|
29
|
+
> = NavigationProp<
|
|
30
|
+
ParamList,
|
|
31
|
+
RouteName,
|
|
32
|
+
NavigatorID,
|
|
33
|
+
TabNavigationState<ParamList>,
|
|
34
|
+
MaterialBottomTabNavigationOptions,
|
|
35
|
+
MaterialBottomTabNavigationEventMap
|
|
36
|
+
> &
|
|
37
|
+
TabActionHelpers<ParamList>;
|
|
38
|
+
|
|
39
|
+
export type MaterialBottomTabScreenProps<
|
|
40
|
+
ParamList extends ParamListBase,
|
|
41
|
+
RouteName extends keyof ParamList = keyof ParamList,
|
|
42
|
+
NavigatorID extends string | undefined = undefined
|
|
43
|
+
> = {
|
|
44
|
+
navigation: MaterialBottomTabNavigationProp<
|
|
45
|
+
ParamList,
|
|
46
|
+
RouteName,
|
|
47
|
+
NavigatorID
|
|
48
|
+
>;
|
|
49
|
+
route: RouteProp<ParamList, RouteName>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type MaterialBottomTabNavigationOptions = {
|
|
53
|
+
/**
|
|
54
|
+
* Title text for the screen.
|
|
55
|
+
*/
|
|
56
|
+
title?: string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Color of the tab bar when this tab is active. Only used when `shifting` is `true`.
|
|
60
|
+
*/
|
|
61
|
+
tabBarColor?: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Label text of the tab displayed in the navigation bar. When undefined, scene title is used.
|
|
65
|
+
*/
|
|
66
|
+
tabBarLabel?: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* String referring to an icon in the `MaterialCommunityIcons` set, or a
|
|
70
|
+
* function that given { focused: boolean, color: string } returns a React.Node to display in the navigation bar.
|
|
71
|
+
*/
|
|
72
|
+
tabBarIcon?:
|
|
73
|
+
| string
|
|
74
|
+
| ((props: { focused: boolean; color: string }) => React.ReactNode);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Badge to show on the tab icon, can be `true` to show a dot, `string` or `number` to show text.
|
|
78
|
+
*/
|
|
79
|
+
tabBarBadge?: boolean | number | string;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.
|
|
83
|
+
*/
|
|
84
|
+
tabBarAccessibilityLabel?: string;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* ID to locate this tab button in tests.
|
|
88
|
+
*/
|
|
89
|
+
tabBarTestID?: string;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type MaterialBottomTabDescriptor = Descriptor<
|
|
93
|
+
MaterialBottomTabNavigationOptions,
|
|
94
|
+
MaterialBottomTabNavigationProp<ParamListBase>,
|
|
95
|
+
RouteProp<ParamListBase>
|
|
96
|
+
>;
|
|
97
|
+
|
|
98
|
+
export type MaterialBottomTabDescriptorMap = Record<
|
|
99
|
+
string,
|
|
100
|
+
MaterialBottomTabDescriptor
|
|
101
|
+
>;
|
|
102
|
+
|
|
103
|
+
export type MaterialBottomTabNavigationConfig = Partial<
|
|
104
|
+
Omit<
|
|
105
|
+
React.ComponentProps<typeof BottomNavigation>,
|
|
106
|
+
| 'navigationState'
|
|
107
|
+
| 'onIndexChange'
|
|
108
|
+
| 'onTabPress'
|
|
109
|
+
| 'renderScene'
|
|
110
|
+
| 'renderLabel'
|
|
111
|
+
| 'renderIcon'
|
|
112
|
+
| 'getAccessibilityLabel'
|
|
113
|
+
| 'getBadge'
|
|
114
|
+
| 'getColor'
|
|
115
|
+
| 'getLabelText'
|
|
116
|
+
| 'getTestID'
|
|
117
|
+
>
|
|
118
|
+
>;
|