@react-navigation/bottom-tabs 6.0.6 → 6.1.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.
- package/lib/commonjs/index.js +6 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createBottomTabNavigator.js +17 -13
- package/lib/commonjs/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/commonjs/views/Badge.js +13 -10
- package/lib/commonjs/views/Badge.js.map +1 -1
- package/lib/commonjs/views/BottomTabBar.js +39 -31
- package/lib/commonjs/views/BottomTabBar.js.map +1 -1
- package/lib/commonjs/views/BottomTabItem.js +63 -56
- package/lib/commonjs/views/BottomTabItem.js.map +1 -1
- package/lib/commonjs/views/BottomTabView.js +10 -7
- package/lib/commonjs/views/BottomTabView.js.map +1 -1
- package/lib/commonjs/views/ScreenFallback.js +13 -9
- package/lib/commonjs/views/ScreenFallback.js.map +1 -1
- package/lib/commonjs/views/TabBarIcon.js +13 -12
- package/lib/commonjs/views/TabBarIcon.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createBottomTabNavigator.js +17 -13
- package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/module/views/Badge.js +13 -10
- package/lib/module/views/Badge.js.map +1 -1
- package/lib/module/views/BottomTabBar.js +39 -31
- package/lib/module/views/BottomTabBar.js.map +1 -1
- package/lib/module/views/BottomTabItem.js +63 -56
- package/lib/module/views/BottomTabItem.js.map +1 -1
- package/lib/module/views/BottomTabView.js +10 -7
- package/lib/module/views/BottomTabView.js.map +1 -1
- package/lib/module/views/ScreenFallback.js +13 -9
- package/lib/module/views/ScreenFallback.js.map +1 -1
- package/lib/module/views/TabBarIcon.js +13 -12
- package/lib/module/views/TabBarIcon.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +1 -1
- package/package.json +8 -8
- package/src/index.tsx +1 -0
- package/src/navigators/createBottomTabNavigator.tsx +9 -5
|
@@ -5,69 +5,74 @@ import Color from 'color';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Platform, Pressable, StyleSheet, Text } from 'react-native';
|
|
7
7
|
import TabBarIcon from './TabBarIcon';
|
|
8
|
-
export default function BottomTabBarItem({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
button = ({
|
|
17
|
-
children,
|
|
18
|
-
style,
|
|
19
|
-
onPress,
|
|
8
|
+
export default function BottomTabBarItem(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
focused,
|
|
11
|
+
route,
|
|
12
|
+
label,
|
|
13
|
+
icon,
|
|
14
|
+
badge,
|
|
15
|
+
badgeStyle,
|
|
20
16
|
to,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
button = _ref2 => {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
style,
|
|
21
|
+
onPress,
|
|
22
|
+
to,
|
|
23
|
+
accessibilityRole,
|
|
24
|
+
...rest
|
|
25
|
+
} = _ref2;
|
|
26
|
+
|
|
27
|
+
if (Platform.OS === 'web' && to) {
|
|
28
|
+
// React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.
|
|
29
|
+
// We need to use `onClick` to be able to prevent default browser handling of links.
|
|
30
|
+
return /*#__PURE__*/React.createElement(Link, _extends({}, rest, {
|
|
31
|
+
to: to,
|
|
32
|
+
style: [styles.button, style],
|
|
33
|
+
onPress: e => {
|
|
34
|
+
if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && ( // ignore clicks with modifier keys
|
|
35
|
+
e.button == null || e.button === 0) // ignore everything but left clicks
|
|
36
|
+
) {
|
|
34
37
|
e.preventDefault();
|
|
35
38
|
onPress === null || onPress === void 0 ? void 0 : onPress(e);
|
|
36
39
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
40
|
+
}
|
|
41
|
+
}), children);
|
|
42
|
+
} else {
|
|
43
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
|
|
44
|
+
accessibilityRole: accessibilityRole,
|
|
45
|
+
onPress: onPress,
|
|
46
|
+
style: style
|
|
47
|
+
}), children);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
accessibilityLabel,
|
|
51
|
+
testID,
|
|
52
|
+
onPress,
|
|
53
|
+
onLongPress,
|
|
54
|
+
horizontal,
|
|
55
|
+
activeTintColor: customActiveTintColor,
|
|
56
|
+
inactiveTintColor: customInactiveTintColor,
|
|
57
|
+
activeBackgroundColor = 'transparent',
|
|
58
|
+
inactiveBackgroundColor = 'transparent',
|
|
59
|
+
showLabel = true,
|
|
60
|
+
allowFontScaling,
|
|
61
|
+
labelStyle,
|
|
62
|
+
iconStyle,
|
|
63
|
+
style
|
|
64
|
+
} = _ref;
|
|
62
65
|
const {
|
|
63
66
|
colors
|
|
64
67
|
} = useTheme();
|
|
65
68
|
const activeTintColor = customActiveTintColor === undefined ? colors.primary : customActiveTintColor;
|
|
66
69
|
const inactiveTintColor = customInactiveTintColor === undefined ? Color(colors.text).mix(Color(colors.card), 0.5).hex() : customInactiveTintColor;
|
|
67
70
|
|
|
68
|
-
const renderLabel =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
const renderLabel = _ref3 => {
|
|
72
|
+
let {
|
|
73
|
+
focused
|
|
74
|
+
} = _ref3;
|
|
75
|
+
|
|
71
76
|
if (showLabel === false) {
|
|
72
77
|
return null;
|
|
73
78
|
}
|
|
@@ -91,9 +96,11 @@ export default function BottomTabBarItem({
|
|
|
91
96
|
});
|
|
92
97
|
};
|
|
93
98
|
|
|
94
|
-
const renderIcon =
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
const renderIcon = _ref4 => {
|
|
100
|
+
let {
|
|
101
|
+
focused
|
|
102
|
+
} = _ref4;
|
|
103
|
+
|
|
97
104
|
if (icon === undefined) {
|
|
98
105
|
return null;
|
|
99
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BottomTabItem.tsx"],"names":["Link","useTheme","Color","React","Platform","Pressable","StyleSheet","Text","TabBarIcon","BottomTabBarItem","focused","route","label","icon","badge","badgeStyle","to","button","children","style","onPress","accessibilityRole","rest","OS","styles","e","metaKey","altKey","ctrlKey","shiftKey","preventDefault","accessibilityLabel","testID","onLongPress","horizontal","activeTintColor","customActiveTintColor","inactiveTintColor","customInactiveTintColor","activeBackgroundColor","inactiveBackgroundColor","showLabel","allowFontScaling","labelStyle","iconStyle","colors","undefined","primary","text","mix","card","hex","renderLabel","color","labelBeside","labelBeneath","position","renderIcon","activeOpacity","inactiveOpacity","scene","backgroundColor","select","ios","default","accessibilityState","selected","accessibilityStates","tab","tabLandscape","tabPortrait","create","flex","alignItems","justifyContent","flexDirection","textAlign","fontSize","marginLeft","marginTop","display"],"mappings":";;AAAA,SAASA,IAAT,EAAsBC,QAAtB,QAAsC,0BAAtC;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAEEC,QAFF,EAGEC,SAHF,EAKEC,UALF,EAMEC,IANF,QASO,cATP;AAYA,OAAOC,UAAP,MAAuB,cAAvB;AA0GA,eAAe,SAASC,gBAAT,CAA0B;AACvCC,EAAAA,O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,EAAExD;AAAZ,KARR;AASZ;AACAyD,IAAAA,mBAAmB,EAAEzD,OAAO,GAAG,CAAC,UAAD,CAAH,GAAkB,EAVlC;AAWZS,IAAAA,KAAK,EAAE,CACLK,MAAM,CAAC4C,GADF,EAEL;AAAEP,MAAAA;AAAF,KAFK,EAGL3B,UAAU,GAAGV,MAAM,CAAC6C,YAAV,GAAyB7C,MAAM,CAAC8C,WAHrC,EAILnD,KAJK,CAXK;AAiBZD,IAAAA,QAAQ,eACN,oBAAC,KAAD,CAAO,QAAP,QACGuC,UAAU,CAACG,KAAD,CADb,EAEGR,WAAW,CAACQ,KAAD,CAFd;AAlBU,GAAD,CAAb;AAwBD;AAED,MAAMpC,MAAM,GAAGlB,UAAU,CAACiE,MAAX,CAAkB;AAC/BH,EAAAA,GAAG,EAAE;AACHI,IAAAA,IAAI,EAAE,CADH;AAEHC,IAAAA,UAAU,EAAE;AAFT,GAD0B;AAK/BH,EAAAA,WAAW,EAAE;AACXI,IAAAA,cAAc,EAAE,UADL;AAEXC,IAAAA,aAAa,EAAE;AAFJ,GALkB;AAS/BN,EAAAA,YAAY,EAAE;AACZK,IAAAA,cAAc,EAAE,QADJ;AAEZC,IAAAA,aAAa,EAAE;AAFH,GATiB;AAa/B/D,EAAAA,KAAK,EAAE;AACLgE,IAAAA,SAAS,EAAE,QADN;AAELf,IAAAA,eAAe,EAAE;AAFZ,GAbwB;AAiB/BN,EAAAA,YAAY,EAAE;AACZsB,IAAAA,QAAQ,EAAE;AADE,GAjBiB;AAoB/BvB,EAAAA,WAAW,EAAE;AACXuB,IAAAA,QAAQ,EAAE,EADC;AAEXC,IAAAA,UAAU,EAAE,EAFD;AAGXC,IAAAA,SAAS,EAAE;AAHA,GApBkB;AAyB/B9D,EAAAA,MAAM,EAAE;AACN+D,IAAAA,OAAO,EAAE;AADH;AAzBuB,CAAlB,CAAf","sourcesContent":["import { Link, Route, useTheme } from '@react-navigation/native';\nimport Color from 'color';\nimport React from 'react';\nimport {\n GestureResponderEvent,\n Platform,\n Pressable,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n ViewStyle,\n} from 'react-native';\n\nimport type { BottomTabBarButtonProps, LabelPosition } from '../types';\nimport TabBarIcon from './TabBarIcon';\n\ntype Props = {\n /**\n * Whether the tab is focused.\n */\n focused: boolean;\n /**\n * The route object which should be specified by the tab.\n */\n route: Route<string>;\n /**\n * The label text of the tab.\n */\n label:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n }) => React.ReactNode);\n /**\n * Icon to display for the tab.\n */\n icon: (props: {\n focused: boolean;\n size: number;\n color: string;\n }) => React.ReactNode;\n /**\n * Text to show in a badge on the tab icon.\n */\n badge?: number | string;\n /**\n * Custom style for the badge.\n */\n badgeStyle?: StyleProp<TextStyle>;\n /**\n * URL to use for the link to the tab.\n */\n to?: string;\n /**\n * The button for the tab. Uses a `TouchableWithoutFeedback` by default.\n */\n button?: (props: BottomTabBarButtonProps) => React.ReactNode;\n /**\n * The accessibility label for the tab.\n */\n accessibilityLabel?: string;\n /**\n * An unique ID for testing for the tab.\n */\n testID?: string;\n /**\n * Function to execute on press in React Native.\n * On the web, this will use onClick.\n */\n onPress: (\n e: React.MouseEvent<HTMLElement, MouseEvent> | GestureResponderEvent\n ) => void;\n /**\n * Function to execute on long press.\n */\n onLongPress: (e: GestureResponderEvent) => void;\n /**\n * Whether the label should be aligned with the icon horizontally.\n */\n horizontal: boolean;\n /**\n * Color for the icon and label when the item is active.\n */\n activeTintColor?: string;\n /**\n * Color for the icon and label when the item is inactive.\n */\n inactiveTintColor?: string;\n /**\n * Background color for item when its active.\n */\n activeBackgroundColor?: string;\n /**\n * Background color for item when its inactive.\n */\n inactiveBackgroundColor?: string;\n /**\n * Whether to show the label text for the tab.\n */\n showLabel?: boolean;\n /**\n * Whether to allow scaling the font for the label for accessibility purposes.\n */\n allowFontScaling?: boolean;\n /**\n * Style object for the label element.\n */\n labelStyle?: StyleProp<TextStyle>;\n /**\n * Style object for the icon element.\n */\n iconStyle?: StyleProp<ViewStyle>;\n /**\n * Style object for the wrapper element.\n */\n style?: StyleProp<ViewStyle>;\n};\n\nexport default function BottomTabBarItem({\n focused,\n route,\n label,\n icon,\n badge,\n badgeStyle,\n to,\n button = ({\n children,\n style,\n onPress,\n to,\n accessibilityRole,\n ...rest\n }: BottomTabBarButtonProps) => {\n if (Platform.OS === 'web' && to) {\n // React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.\n // We need to use `onClick` to be able to prevent default browser handling of links.\n return (\n <Link\n {...rest}\n to={to}\n style={[styles.button, style]}\n onPress={(e: any) => {\n if (\n !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys\n (e.button == null || e.button === 0) // ignore everything but left clicks\n ) {\n e.preventDefault();\n onPress?.(e);\n }\n }}\n >\n {children}\n </Link>\n );\n } else {\n return (\n <Pressable\n {...rest}\n accessibilityRole={accessibilityRole}\n onPress={onPress}\n style={style}\n >\n {children}\n </Pressable>\n );\n }\n },\n accessibilityLabel,\n testID,\n onPress,\n onLongPress,\n horizontal,\n activeTintColor: customActiveTintColor,\n inactiveTintColor: customInactiveTintColor,\n activeBackgroundColor = 'transparent',\n inactiveBackgroundColor = 'transparent',\n showLabel = true,\n allowFontScaling,\n labelStyle,\n iconStyle,\n style,\n}: Props) {\n const { colors } = useTheme();\n\n const activeTintColor =\n customActiveTintColor === undefined\n ? colors.primary\n : customActiveTintColor;\n\n const inactiveTintColor =\n customInactiveTintColor === undefined\n ? Color(colors.text).mix(Color(colors.card), 0.5).hex()\n : customInactiveTintColor;\n\n const renderLabel = ({ focused }: { focused: boolean }) => {\n if (showLabel === false) {\n return null;\n }\n\n const color = focused ? activeTintColor : inactiveTintColor;\n\n if (typeof label === 'string') {\n return (\n <Text\n numberOfLines={1}\n style={[\n styles.label,\n { color },\n horizontal ? styles.labelBeside : styles.labelBeneath,\n labelStyle,\n ]}\n allowFontScaling={allowFontScaling}\n >\n {label}\n </Text>\n );\n }\n\n return label({\n focused,\n color,\n position: horizontal ? 'beside-icon' : 'below-icon',\n });\n };\n\n const renderIcon = ({ focused }: { focused: boolean }) => {\n if (icon === undefined) {\n return null;\n }\n\n const activeOpacity = focused ? 1 : 0;\n const inactiveOpacity = focused ? 0 : 1;\n\n return (\n <TabBarIcon\n route={route}\n horizontal={horizontal}\n badge={badge}\n badgeStyle={badgeStyle}\n activeOpacity={activeOpacity}\n inactiveOpacity={inactiveOpacity}\n activeTintColor={activeTintColor}\n inactiveTintColor={inactiveTintColor}\n renderIcon={icon}\n style={iconStyle}\n />\n );\n };\n\n const scene = { route, focused };\n\n const backgroundColor = focused\n ? activeBackgroundColor\n : inactiveBackgroundColor;\n\n return button({\n to,\n onPress,\n onLongPress,\n testID,\n accessibilityLabel,\n // FIXME: accessibilityRole: 'tab' doesn't seem to work as expected on iOS\n accessibilityRole: Platform.select({ ios: 'button', default: 'tab' }),\n accessibilityState: { selected: focused },\n // @ts-expect-error: keep for compatibility with older React Native versions\n accessibilityStates: focused ? ['selected'] : [],\n style: [\n styles.tab,\n { backgroundColor },\n horizontal ? styles.tabLandscape : styles.tabPortrait,\n style,\n ],\n children: (\n <React.Fragment>\n {renderIcon(scene)}\n {renderLabel(scene)}\n </React.Fragment>\n ),\n }) as React.ReactElement;\n}\n\nconst styles = StyleSheet.create({\n tab: {\n flex: 1,\n alignItems: 'center',\n },\n tabPortrait: {\n justifyContent: 'flex-end',\n flexDirection: 'column',\n },\n tabLandscape: {\n justifyContent: 'center',\n flexDirection: 'row',\n },\n label: {\n textAlign: 'center',\n backgroundColor: 'transparent',\n },\n labelBeneath: {\n fontSize: 10,\n },\n labelBeside: {\n fontSize: 13,\n marginLeft: 20,\n marginTop: 3,\n },\n button: {\n display: 'flex',\n },\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["BottomTabItem.tsx"],"names":["Link","useTheme","Color","React","Platform","Pressable","StyleSheet","Text","TabBarIcon","BottomTabBarItem","focused","route","label","icon","badge","badgeStyle","to","button","children","style","onPress","accessibilityRole","rest","OS","styles","e","metaKey","altKey","ctrlKey","shiftKey","preventDefault","accessibilityLabel","testID","onLongPress","horizontal","activeTintColor","customActiveTintColor","inactiveTintColor","customInactiveTintColor","activeBackgroundColor","inactiveBackgroundColor","showLabel","allowFontScaling","labelStyle","iconStyle","colors","undefined","primary","text","mix","card","hex","renderLabel","color","labelBeside","labelBeneath","position","renderIcon","activeOpacity","inactiveOpacity","scene","backgroundColor","select","ios","default","accessibilityState","selected","accessibilityStates","tab","tabLandscape","tabPortrait","create","flex","alignItems","justifyContent","flexDirection","textAlign","fontSize","marginLeft","marginTop","display"],"mappings":";;AAAA,SAASA,IAAT,EAAsBC,QAAtB,QAAsC,0BAAtC;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAEEC,QAFF,EAGEC,SAHF,EAKEC,UALF,EAMEC,IANF,QASO,cATP;AAYA,OAAOC,UAAP,MAAuB,cAAvB;AA0GA,eAAe,SAASC,gBAAT,OAgEL;AAAA,MAhE+B;AACvCC,IAAAA,OADuC;AAEvCC,IAAAA,KAFuC;AAGvCC,IAAAA,KAHuC;AAIvCC,IAAAA,IAJuC;AAKvCC,IAAAA,KALuC;AAMvCC,IAAAA,UANuC;AAOvCC,IAAAA,EAPuC;AAQvCC,IAAAA,MAAM,GAAG,SAOsB;AAAA,UAPrB;AACRC,QAAAA,QADQ;AAERC,QAAAA,KAFQ;AAGRC,QAAAA,OAHQ;AAIRJ,QAAAA,EAJQ;AAKRK,QAAAA,iBALQ;AAMR,WAAGC;AANK,OAOqB;;AAC7B,UAAIlB,QAAQ,CAACmB,EAAT,KAAgB,KAAhB,IAAyBP,EAA7B,EAAiC;AAC/B;AACA;AACA,4BACE,oBAAC,IAAD,eACMM,IADN;AAEE,UAAA,EAAE,EAAEN,EAFN;AAGE,UAAA,KAAK,EAAE,CAACQ,MAAM,CAACP,MAAR,EAAgBE,KAAhB,CAHT;AAIE,UAAA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ADH;AAEHC,IAAAA,UAAU,EAAE;AAFT,GAD0B;AAK/BH,EAAAA,WAAW,EAAE;AACXI,IAAAA,cAAc,EAAE,UADL;AAEXC,IAAAA,aAAa,EAAE;AAFJ,GALkB;AAS/BN,EAAAA,YAAY,EAAE;AACZK,IAAAA,cAAc,EAAE,QADJ;AAEZC,IAAAA,aAAa,EAAE;AAFH,GATiB;AAa/B/D,EAAAA,KAAK,EAAE;AACLgE,IAAAA,SAAS,EAAE,QADN;AAELf,IAAAA,eAAe,EAAE;AAFZ,GAbwB;AAiB/BN,EAAAA,YAAY,EAAE;AACZsB,IAAAA,QAAQ,EAAE;AADE,GAjBiB;AAoB/BvB,EAAAA,WAAW,EAAE;AACXuB,IAAAA,QAAQ,EAAE,EADC;AAEXC,IAAAA,UAAU,EAAE,EAFD;AAGXC,IAAAA,SAAS,EAAE;AAHA,GApBkB;AAyB/B9D,EAAAA,MAAM,EAAE;AACN+D,IAAAA,OAAO,EAAE;AADH;AAzBuB,CAAlB,CAAf","sourcesContent":["import { Link, Route, useTheme } from '@react-navigation/native';\nimport Color from 'color';\nimport React from 'react';\nimport {\n GestureResponderEvent,\n Platform,\n Pressable,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n ViewStyle,\n} from 'react-native';\n\nimport type { BottomTabBarButtonProps, LabelPosition } from '../types';\nimport TabBarIcon from './TabBarIcon';\n\ntype Props = {\n /**\n * Whether the tab is focused.\n */\n focused: boolean;\n /**\n * The route object which should be specified by the tab.\n */\n route: Route<string>;\n /**\n * The label text of the tab.\n */\n label:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n }) => React.ReactNode);\n /**\n * Icon to display for the tab.\n */\n icon: (props: {\n focused: boolean;\n size: number;\n color: string;\n }) => React.ReactNode;\n /**\n * Text to show in a badge on the tab icon.\n */\n badge?: number | string;\n /**\n * Custom style for the badge.\n */\n badgeStyle?: StyleProp<TextStyle>;\n /**\n * URL to use for the link to the tab.\n */\n to?: string;\n /**\n * The button for the tab. Uses a `TouchableWithoutFeedback` by default.\n */\n button?: (props: BottomTabBarButtonProps) => React.ReactNode;\n /**\n * The accessibility label for the tab.\n */\n accessibilityLabel?: string;\n /**\n * An unique ID for testing for the tab.\n */\n testID?: string;\n /**\n * Function to execute on press in React Native.\n * On the web, this will use onClick.\n */\n onPress: (\n e: React.MouseEvent<HTMLElement, MouseEvent> | GestureResponderEvent\n ) => void;\n /**\n * Function to execute on long press.\n */\n onLongPress: (e: GestureResponderEvent) => void;\n /**\n * Whether the label should be aligned with the icon horizontally.\n */\n horizontal: boolean;\n /**\n * Color for the icon and label when the item is active.\n */\n activeTintColor?: string;\n /**\n * Color for the icon and label when the item is inactive.\n */\n inactiveTintColor?: string;\n /**\n * Background color for item when its active.\n */\n activeBackgroundColor?: string;\n /**\n * Background color for item when its inactive.\n */\n inactiveBackgroundColor?: string;\n /**\n * Whether to show the label text for the tab.\n */\n showLabel?: boolean;\n /**\n * Whether to allow scaling the font for the label for accessibility purposes.\n */\n allowFontScaling?: boolean;\n /**\n * Style object for the label element.\n */\n labelStyle?: StyleProp<TextStyle>;\n /**\n * Style object for the icon element.\n */\n iconStyle?: StyleProp<ViewStyle>;\n /**\n * Style object for the wrapper element.\n */\n style?: StyleProp<ViewStyle>;\n};\n\nexport default function BottomTabBarItem({\n focused,\n route,\n label,\n icon,\n badge,\n badgeStyle,\n to,\n button = ({\n children,\n style,\n onPress,\n to,\n accessibilityRole,\n ...rest\n }: BottomTabBarButtonProps) => {\n if (Platform.OS === 'web' && to) {\n // React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.\n // We need to use `onClick` to be able to prevent default browser handling of links.\n return (\n <Link\n {...rest}\n to={to}\n style={[styles.button, style]}\n onPress={(e: any) => {\n if (\n !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys\n (e.button == null || e.button === 0) // ignore everything but left clicks\n ) {\n e.preventDefault();\n onPress?.(e);\n }\n }}\n >\n {children}\n </Link>\n );\n } else {\n return (\n <Pressable\n {...rest}\n accessibilityRole={accessibilityRole}\n onPress={onPress}\n style={style}\n >\n {children}\n </Pressable>\n );\n }\n },\n accessibilityLabel,\n testID,\n onPress,\n onLongPress,\n horizontal,\n activeTintColor: customActiveTintColor,\n inactiveTintColor: customInactiveTintColor,\n activeBackgroundColor = 'transparent',\n inactiveBackgroundColor = 'transparent',\n showLabel = true,\n allowFontScaling,\n labelStyle,\n iconStyle,\n style,\n}: Props) {\n const { colors } = useTheme();\n\n const activeTintColor =\n customActiveTintColor === undefined\n ? colors.primary\n : customActiveTintColor;\n\n const inactiveTintColor =\n customInactiveTintColor === undefined\n ? Color(colors.text).mix(Color(colors.card), 0.5).hex()\n : customInactiveTintColor;\n\n const renderLabel = ({ focused }: { focused: boolean }) => {\n if (showLabel === false) {\n return null;\n }\n\n const color = focused ? activeTintColor : inactiveTintColor;\n\n if (typeof label === 'string') {\n return (\n <Text\n numberOfLines={1}\n style={[\n styles.label,\n { color },\n horizontal ? styles.labelBeside : styles.labelBeneath,\n labelStyle,\n ]}\n allowFontScaling={allowFontScaling}\n >\n {label}\n </Text>\n );\n }\n\n return label({\n focused,\n color,\n position: horizontal ? 'beside-icon' : 'below-icon',\n });\n };\n\n const renderIcon = ({ focused }: { focused: boolean }) => {\n if (icon === undefined) {\n return null;\n }\n\n const activeOpacity = focused ? 1 : 0;\n const inactiveOpacity = focused ? 0 : 1;\n\n return (\n <TabBarIcon\n route={route}\n horizontal={horizontal}\n badge={badge}\n badgeStyle={badgeStyle}\n activeOpacity={activeOpacity}\n inactiveOpacity={inactiveOpacity}\n activeTintColor={activeTintColor}\n inactiveTintColor={inactiveTintColor}\n renderIcon={icon}\n style={iconStyle}\n />\n );\n };\n\n const scene = { route, focused };\n\n const backgroundColor = focused\n ? activeBackgroundColor\n : inactiveBackgroundColor;\n\n return button({\n to,\n onPress,\n onLongPress,\n testID,\n accessibilityLabel,\n // FIXME: accessibilityRole: 'tab' doesn't seem to work as expected on iOS\n accessibilityRole: Platform.select({ ios: 'button', default: 'tab' }),\n accessibilityState: { selected: focused },\n // @ts-expect-error: keep for compatibility with older React Native versions\n accessibilityStates: focused ? ['selected'] : [],\n style: [\n styles.tab,\n { backgroundColor },\n horizontal ? styles.tabLandscape : styles.tabPortrait,\n style,\n ],\n children: (\n <React.Fragment>\n {renderIcon(scene)}\n {renderLabel(scene)}\n </React.Fragment>\n ),\n }) as React.ReactElement;\n}\n\nconst styles = StyleSheet.create({\n tab: {\n flex: 1,\n alignItems: 'center',\n },\n tabPortrait: {\n justifyContent: 'flex-end',\n flexDirection: 'column',\n },\n tabLandscape: {\n justifyContent: 'center',\n flexDirection: 'row',\n },\n label: {\n textAlign: 'center',\n backgroundColor: 'transparent',\n },\n labelBeneath: {\n fontSize: 10,\n },\n labelBeside: {\n fontSize: 13,\n marginLeft: 20,\n marginTop: 3,\n },\n button: {\n display: 'flex',\n },\n});\n"]}
|
|
@@ -82,13 +82,16 @@ export default function BottomTabView(props) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
const {
|
|
85
|
-
header =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
header = _ref5 => {
|
|
86
|
+
let {
|
|
87
|
+
layout,
|
|
88
|
+
options
|
|
89
|
+
} = _ref5;
|
|
90
|
+
return /*#__PURE__*/React.createElement(Header, _extends({}, options, {
|
|
91
|
+
layout: layout,
|
|
92
|
+
title: getHeaderTitle(options, route.name)
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
92
95
|
} = descriptor.options;
|
|
93
96
|
return /*#__PURE__*/React.createElement(MaybeScreen, {
|
|
94
97
|
key: route.key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BottomTabView.tsx"],"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","React","Platform","StyleSheet","SafeAreaInsetsContext","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","BottomTabBar","getTabBarHeight","MaybeScreen","MaybeScreenContainer","BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","useState","includes","dimensions","initialMetrics","frame","tabBarHeight","setTabBarHeight","layout","width","height","insets","style","options","tabBarStyle","renderTabBar","top","right","bottom","left","styles","container","map","route","descriptor","lazy","unmountOnBlur","isFocused","header","name","absoluteFill","zIndex","headerShown","headerTransparent","headerStatusBarHeight","render","create","flex","overflow"],"mappings":";;AAAA,SACEA,cADF,EAEEC,MAFF,EAGEC,sBAHF,EAIEC,MAJF,QAKO,4BALP;AAUA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,cAArC;AACA,SAASC,qBAAT,QAAsC,gCAAtC;AAUA,OAAOC,iCAAP,MAA8C,4CAA9C;AACA,OAAOC,yBAAP,MAAsC,oCAAtC;AACA,OAAOC,YAAP,IAAuBC,eAAvB,QAA8C,gBAA9C;AACA,SAASC,WAAT,EAAsBC,oBAAtB,QAAkD,kBAAlD;AAQA,eAAe,SAASC,aAAT,CAAuBC,KAAvB,EAAqC;AAClD,QAAM;AACJC,IAAAA,MAAM,GAAID,KAAD,iBAA8B,oBAAC,YAAD,EAAkBA,KAAlB,CADnC;AAEJE,IAAAA,KAFI;AAGJC,IAAAA,UAHI;AAIJC,IAAAA,WAJI;AAKJC,IAAAA,cALI;AAMJC,IAAAA,qBAAqB,GAAGhB,QAAQ,CAACiB,EAAT,KAAgB,KAAhB,IACtBjB,QAAQ,CAACiB,EAAT,KAAgB,SADM,IAEtBjB,QAAQ,CAACiB,EAAT,KAAgB,KARd;AASJC,IAAAA;AATI,MAUFR,KAVJ;AAYA,QAAMS,eAAe,GAAGP,KAAK,CAACQ,MAAN,CAAaR,KAAK,CAACS,KAAnB,EAA0BC,GAAlD;AACA,QAAM,CAACC,MAAD,EAASC,SAAT,IAAsBzB,KAA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IAAA,KAAK,EAAE5B;AAAnD,KACGQ,YAAY,EADf,CA9DF,CADF;AAoED;AAED,MAAMK,MAAM,GAAG3C,UAAU,CAAC2D,MAAX,CAAkB;AAC/Bf,EAAAA,SAAS,EAAE;AACTgB,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AADoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n TabNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationProp,\n} from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';\nimport BottomTabBar, { getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nexport default function BottomTabView(props: Props) {\n const {\n tabBar = (props: BottomTabBarProps) => <BottomTabBar {...props} />,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n sceneContainerStyle,\n } = props;\n\n const focusedRouteKey = state.routes[state.index].key;\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n layout: { width: dimensions.width, height: 0 },\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index].key].options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) =>\n tabBar({\n state: state,\n descriptors: descriptors,\n navigation: navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n </SafeAreaInsetsContext.Consumer>\n );\n };\n\n const { routes } = state;\n\n return (\n <SafeAreaProviderCompat>\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n style={styles.container}\n >\n {routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const { lazy = true, unmountOnBlur } = descriptor.options;\n const isFocused = state.index === index;\n\n if (unmountOnBlur && !isFocused) {\n return null;\n }\n\n if (lazy && !loaded.includes(route.key) && !isFocused) {\n // Don't render a lazy screen if we've never navigated to it\n return null;\n }\n\n const {\n header = ({ layout, options }: BottomTabHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n />\n ),\n } = descriptor.options;\n\n return (\n <MaybeScreen\n key={route.key}\n style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}\n visible={isFocused}\n enabled={detachInactiveScreens}\n >\n <BottomTabBarHeightContext.Provider value={tabBarHeight}>\n <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={descriptor.options.headerShown}\n headerTransparent={descriptor.options.headerTransparent}\n headerStatusBarHeight={\n descriptor.options.headerStatusBarHeight\n }\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation:\n descriptor.navigation as BottomTabNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </BottomTabBarHeightContext.Provider>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n <BottomTabBarHeightCallbackContext.Provider value={setTabBarHeight}>\n {renderTabBar()}\n </BottomTabBarHeightCallbackContext.Provider>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["BottomTabView.tsx"],"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","React","Platform","StyleSheet","SafeAreaInsetsContext","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","BottomTabBar","getTabBarHeight","MaybeScreen","MaybeScreenContainer","BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","useState","includes","dimensions","initialMetrics","frame","tabBarHeight","setTabBarHeight","layout","width","height","insets","style","options","tabBarStyle","renderTabBar","top","right","bottom","left","styles","container","map","route","descriptor","lazy","unmountOnBlur","isFocused","header","name","absoluteFill","zIndex","headerShown","headerTransparent","headerStatusBarHeight","render","create","flex","overflow"],"mappings":";;AAAA,SACEA,cADF,EAEEC,MAFF,EAGEC,sBAHF,EAIEC,MAJF,QAKO,4BALP;AAUA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,cAArC;AACA,SAASC,qBAAT,QAAsC,gCAAtC;AAUA,OAAOC,iCAAP,MAA8C,4CAA9C;AACA,OAAOC,yBAAP,MAAsC,oCAAtC;AACA,OAAOC,YAAP,IAAuBC,eAAvB,QAA8C,gBAA9C;AACA,SAASC,WAAT,EAAsBC,oBAAtB,QAAkD,kBAAlD;AAQA,eAAe,SAASC,aAAT,CAAuBC,KAAvB,EAAqC;AAClD,QAAM;AACJC,IAAAA,MAAM,GAAID,KAAD,iB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ACX,OAAX,CAAmBoB,iBALxC;AAME,MAAA,qBAAqB,EACnBT,UAAU,CAACX,OAAX,CAAmBqB,qBAPvB;AASE,MAAA,MAAM,EAAEN,MAAM,CAAC;AACbpB,QAAAA,MAAM,EAAEL,UADK;AAEboB,QAAAA,KAAK,EAAEC,UAAU,CAACD,KAFL;AAGblC,QAAAA,UAAU,EACRmC,UAAU,CAACnC,UAJA;AAKbwB,QAAAA,OAAO,EAAEW,UAAU,CAACX;AALP,OAAD,CAThB;AAgBE,MAAA,KAAK,EAAEnB;AAhBT,OAkBG8B,UAAU,CAACW,MAAX,EAlBH,CADF,CANF,CADF;AA+BD,GAvDA,CAJH,CADF,eA8DE,oBAAC,iCAAD,CAAmC,QAAnC;AAA4C,IAAA,KAAK,EAAE5B;AAAnD,KACGQ,YAAY,EADf,CA9DF,CADF;AAoED;AAED,MAAMK,MAAM,GAAG3C,UAAU,CAAC2D,MAAX,CAAkB;AAC/Bf,EAAAA,SAAS,EAAE;AACTgB,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AADoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n TabNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationProp,\n} from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';\nimport BottomTabBar, { getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nexport default function BottomTabView(props: Props) {\n const {\n tabBar = (props: BottomTabBarProps) => <BottomTabBar {...props} />,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n sceneContainerStyle,\n } = props;\n\n const focusedRouteKey = state.routes[state.index].key;\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n layout: { width: dimensions.width, height: 0 },\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index].key].options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) =>\n tabBar({\n state: state,\n descriptors: descriptors,\n navigation: navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n </SafeAreaInsetsContext.Consumer>\n );\n };\n\n const { routes } = state;\n\n return (\n <SafeAreaProviderCompat>\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n style={styles.container}\n >\n {routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const { lazy = true, unmountOnBlur } = descriptor.options;\n const isFocused = state.index === index;\n\n if (unmountOnBlur && !isFocused) {\n return null;\n }\n\n if (lazy && !loaded.includes(route.key) && !isFocused) {\n // Don't render a lazy screen if we've never navigated to it\n return null;\n }\n\n const {\n header = ({ layout, options }: BottomTabHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n />\n ),\n } = descriptor.options;\n\n return (\n <MaybeScreen\n key={route.key}\n style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}\n visible={isFocused}\n enabled={detachInactiveScreens}\n >\n <BottomTabBarHeightContext.Provider value={tabBarHeight}>\n <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={descriptor.options.headerShown}\n headerTransparent={descriptor.options.headerTransparent}\n headerStatusBarHeight={\n descriptor.options.headerStatusBarHeight\n }\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation:\n descriptor.navigation as BottomTabNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </BottomTabBarHeightContext.Provider>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n <BottomTabBarHeightCallbackContext.Provider value={setTabBarHeight}>\n {renderTabBar()}\n </BottomTabBarHeightCallbackContext.Provider>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]}
|
|
@@ -10,12 +10,14 @@ try {
|
|
|
10
10
|
} catch (e) {// Ignore
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export const MaybeScreenContainer =
|
|
14
|
-
enabled,
|
|
15
|
-
...rest
|
|
16
|
-
}) => {
|
|
13
|
+
export const MaybeScreenContainer = _ref => {
|
|
17
14
|
var _Screens, _Screens$screensEnabl;
|
|
18
15
|
|
|
16
|
+
let {
|
|
17
|
+
enabled,
|
|
18
|
+
...rest
|
|
19
|
+
} = _ref;
|
|
20
|
+
|
|
19
21
|
if ((_Screens = Screens) !== null && _Screens !== void 0 && (_Screens$screensEnabl = _Screens.screensEnabled) !== null && _Screens$screensEnabl !== void 0 && _Screens$screensEnabl.call(_Screens)) {
|
|
20
22
|
return /*#__PURE__*/React.createElement(Screens.ScreenContainer, _extends({
|
|
21
23
|
enabled: enabled
|
|
@@ -24,13 +26,15 @@ export const MaybeScreenContainer = ({
|
|
|
24
26
|
|
|
25
27
|
return /*#__PURE__*/React.createElement(View, rest);
|
|
26
28
|
};
|
|
27
|
-
export function MaybeScreen({
|
|
28
|
-
visible,
|
|
29
|
-
children,
|
|
30
|
-
...rest
|
|
31
|
-
}) {
|
|
29
|
+
export function MaybeScreen(_ref2) {
|
|
32
30
|
var _Screens2, _Screens2$screensEnab;
|
|
33
31
|
|
|
32
|
+
let {
|
|
33
|
+
visible,
|
|
34
|
+
children,
|
|
35
|
+
...rest
|
|
36
|
+
} = _ref2;
|
|
37
|
+
|
|
34
38
|
if ((_Screens2 = Screens) !== null && _Screens2 !== void 0 && (_Screens2$screensEnab = _Screens2.screensEnabled) !== null && _Screens2$screensEnab !== void 0 && _Screens2$screensEnab.call(_Screens2)) {
|
|
35
39
|
return /*#__PURE__*/React.createElement(Screens.Screen, _extends({
|
|
36
40
|
activityState: visible ? 2 : 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ScreenFallback.tsx"],"names":["ResourceSavingView","React","View","Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"mappings":";;AAAA,SAASA,kBAAT,QAAmC,4BAAnC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAAoBC,IAApB,QAAsD,cAAtD;AASA,IAAIC,OAAJ;;AAEA,IAAI;AACFA,EAAAA,OAAO,GAAGC,OAAO,CAAC,sBAAD,CAAjB;AACD,CAFD,CAEE,OAAOC,CAAP,EAAU,CACV;AACD;;AAED,OAAO,MAAMC,oBAAoB,GAAG,
|
|
1
|
+
{"version":3,"sources":["ScreenFallback.tsx"],"names":["ResourceSavingView","React","View","Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"mappings":";;AAAA,SAASA,kBAAT,QAAmC,4BAAnC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAAoBC,IAApB,QAAsD,cAAtD;AASA,IAAIC,OAAJ;;AAEA,IAAI;AACFA,EAAAA,OAAO,GAAGC,OAAO,CAAC,sBAAD,CAAjB;AACD,CAFD,CAEE,OAAOC,CAAP,EAAU,CACV;AACD;;AAED,OAAO,MAAMC,oBAAoB,GAAG,QAM9B;AAAA;;AAAA,MAN+B;AACnCC,IAAAA,OADmC;AAEnC,OAAGC;AAFgC,GAM/B;;AACJ,kBAAIL,OAAJ,8DAAI,SAASM,cAAb,kDAAI,oCAAJ,EAAiC;AAC/B,wBAAO,oBAAC,OAAD,CAAS,eAAT;AAAyB,MAAA,OAAO,EAAEF;AAAlC,OAA+CC,IAA/C,EAAP;AACD;;AAED,sBAAO,oBAAC,IAAD,EAAUA,IAAV,CAAP;AACD,CAZM;AAcP,OAAO,SAASE,WAAT,QAA4D;AAAA;;AAAA,MAAvC;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqB,OAAGJ;AAAxB,GAAuC;;AACjE,mBAAIL,OAAJ,+DAAI,UAASM,cAAb,kDAAI,qCAAJ,EAAiC;AAC/B,wBACE,oBAAC,OAAD,CAAS,MAAT;AAAgB,MAAA,aAAa,EAAEE,OAAO,GAAG,CAAH,GAAO;AAA7C,OAAoDH,IAApD,GACGI,QADH,CADF;AAKD;;AAED,sBACE,oBAAC,kBAAD;AAAoB,IAAA,OAAO,EAAED;AAA7B,KAA0CH,IAA1C,GACGI,QADH,CADF;AAKD","sourcesContent":["import { ResourceSavingView } from '@react-navigation/elements';\nimport * as React from 'react';\nimport { StyleProp, View, ViewProps, ViewStyle } from 'react-native';\n\ntype Props = {\n visible: boolean;\n children: React.ReactNode;\n enabled: boolean;\n style?: StyleProp<ViewStyle>;\n};\n\nlet Screens: typeof import('react-native-screens') | undefined;\n\ntry {\n Screens = require('react-native-screens');\n} catch (e) {\n // Ignore\n}\n\nexport const MaybeScreenContainer = ({\n enabled,\n ...rest\n}: ViewProps & {\n enabled: boolean;\n children: React.ReactNode;\n}) => {\n if (Screens?.screensEnabled?.()) {\n return <Screens.ScreenContainer enabled={enabled} {...rest} />;\n }\n\n return <View {...rest} />;\n};\n\nexport function MaybeScreen({ visible, children, ...rest }: Props) {\n if (Screens?.screensEnabled?.()) {\n return (\n <Screens.Screen activityState={visible ? 2 : 0} {...rest}>\n {children}\n </Screens.Screen>\n );\n }\n\n return (\n <ResourceSavingView visible={visible} {...rest}>\n {children}\n </ResourceSavingView>\n );\n}\n"]}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import Badge from './Badge';
|
|
4
|
-
export default function TabBarIcon({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
export default function TabBarIcon(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
route: _,
|
|
7
|
+
horizontal,
|
|
8
|
+
badge,
|
|
9
|
+
badgeStyle,
|
|
10
|
+
activeOpacity,
|
|
11
|
+
inactiveOpacity,
|
|
12
|
+
activeTintColor,
|
|
13
|
+
inactiveTintColor,
|
|
14
|
+
renderIcon,
|
|
15
|
+
style
|
|
16
|
+
} = _ref;
|
|
16
17
|
const size = 25; // We render the icon twice at the same position on top of each other:
|
|
17
18
|
// active and inactive one, so we can fade between them.
|
|
18
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["TabBarIcon.tsx"],"names":["React","StyleSheet","View","Badge","TabBarIcon","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","size","styles","iconHorizontal","iconVertical","icon","opacity","focused","color","badgeHorizontal","badgeVertical","create","position","alignSelf","alignItems","justifyContent","height","width","minWidth","flex","marginTop","left","top"],"mappings":"AACA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAEEC,UAFF,EAIEC,IAJF,QAMO,cANP;AAQA,OAAOC,KAAP,MAAkB,SAAlB;AAmBA,eAAe,SAASC,UAAT,
|
|
1
|
+
{"version":3,"sources":["TabBarIcon.tsx"],"names":["React","StyleSheet","View","Badge","TabBarIcon","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","size","styles","iconHorizontal","iconVertical","icon","opacity","focused","color","badgeHorizontal","badgeVertical","create","position","alignSelf","alignItems","justifyContent","height","width","minWidth","flex","marginTop","left","top"],"mappings":"AACA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAEEC,UAFF,EAIEC,IAJF,QAMO,cANP;AAQA,OAAOC,KAAP,MAAkB,SAAlB;AAmBA,eAAe,SAASC,UAAT,OAWL;AAAA,MAXyB;AACjCC,IAAAA,KAAK,EAAEC,CAD0B;AAEjCC,IAAAA,UAFiC;AAGjCC,IAAAA,KAHiC;AAIjCC,IAAAA,UAJiC;AAKjCC,IAAAA,aALiC;AAMjCC,IAAAA,eANiC;AAOjCC,IAAAA,eAPiC;AAQjCC,IAAAA,iBARiC;AASjCC,IAAAA,UATiC;AAUjCC,IAAAA;AAViC,GAWzB;AACR,QAAMC,IAAI,GAAG,EAAb,CADQ,CAGR;AACA;;AACA,sBACE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAE,CAACT,UAAU,GAAGU,MAAM,CAACC,cAAV,GAA2BD,MAAM,CAACE,YAA7C,EAA2DJ,KAA3D;AADT,kBAGE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAE,CAACE,MAAM,CAACG,IAAR,EAAc;AAAEC,MAAAA,OAAO,EAAEX;AAAX,KAAd;AAAb,KACGI,UAAU,CAAC;AACVQ,IAAAA,OAAO,EAAE,IADC;AAEVN,IAAAA,IAFU;AAGVO,IAAAA,KAAK,EAAEX;AAHG,GAAD,CADb,CAHF,eAUE,oBA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AE;AADU;AA5Bc,CAAlB,CAAf","sourcesContent":["import type { Route } from '@react-navigation/native';\nimport React from 'react';\nimport {\n StyleProp,\n StyleSheet,\n TextStyle,\n View,\n ViewStyle,\n} from 'react-native';\n\nimport Badge from './Badge';\n\ntype Props = {\n route: Route<string>;\n horizontal: boolean;\n badge?: string | number;\n badgeStyle?: StyleProp<TextStyle>;\n activeOpacity: number;\n inactiveOpacity: number;\n activeTintColor: string;\n inactiveTintColor: string;\n renderIcon: (props: {\n focused: boolean;\n color: string;\n size: number;\n }) => React.ReactNode;\n style: StyleProp<ViewStyle>;\n};\n\nexport default function TabBarIcon({\n route: _,\n horizontal,\n badge,\n badgeStyle,\n activeOpacity,\n inactiveOpacity,\n activeTintColor,\n inactiveTintColor,\n renderIcon,\n style,\n}: Props) {\n const size = 25;\n\n // We render the icon twice at the same position on top of each other:\n // active and inactive one, so we can fade between them.\n return (\n <View\n style={[horizontal ? styles.iconHorizontal : styles.iconVertical, style]}\n >\n <View style={[styles.icon, { opacity: activeOpacity }]}>\n {renderIcon({\n focused: true,\n size,\n color: activeTintColor,\n })}\n </View>\n <View style={[styles.icon, { opacity: inactiveOpacity }]}>\n {renderIcon({\n focused: false,\n size,\n color: inactiveTintColor,\n })}\n </View>\n <Badge\n visible={badge != null}\n style={[\n styles.badge,\n horizontal ? styles.badgeHorizontal : styles.badgeVertical,\n badgeStyle,\n ]}\n size={(size * 3) / 4}\n >\n {badge}\n </Badge>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n icon: {\n // We render the icon twice at the same position on top of each other:\n // active and inactive one, so we can fade between them:\n // Cover the whole iconContainer:\n position: 'absolute',\n alignSelf: 'center',\n alignItems: 'center',\n justifyContent: 'center',\n height: '100%',\n width: '100%',\n // Workaround for react-native >= 0.54 layout bug\n minWidth: 25,\n },\n iconVertical: {\n flex: 1,\n },\n iconHorizontal: {\n height: '100%',\n marginTop: 3,\n },\n badge: {\n position: 'absolute',\n left: 3,\n },\n badgeVertical: {\n top: 3,\n },\n badgeHorizontal: {\n top: 7,\n },\n});\n"]}
|
|
@@ -15,4 +15,4 @@ export { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight'
|
|
|
15
15
|
/**
|
|
16
16
|
* Types
|
|
17
17
|
*/
|
|
18
|
-
export type { BottomTabBarButtonProps, BottomTabBarProps, BottomTabHeaderProps, BottomTabNavigationOptions, BottomTabNavigationProp, BottomTabScreenProps, } from './types';
|
|
18
|
+
export type { BottomTabBarButtonProps, BottomTabBarProps, BottomTabHeaderProps, BottomTabNavigationEventMap, BottomTabNavigationOptions, BottomTabNavigationProp, BottomTabScreenProps, } from './types';
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import { DefaultNavigatorOptions, ParamListBase, TabNavigationState, TabRouterOptions } from '@react-navigation/native';
|
|
3
3
|
import type { BottomTabNavigationConfig, BottomTabNavigationEventMap, BottomTabNavigationOptions } from '../types';
|
|
4
4
|
declare type Props = DefaultNavigatorOptions<ParamListBase, TabNavigationState<ParamListBase>, BottomTabNavigationOptions, BottomTabNavigationEventMap> & TabRouterOptions & BottomTabNavigationConfig;
|
|
5
|
-
declare function BottomTabNavigator({ initialRouteName, backBehavior, children, screenListeners, screenOptions, sceneContainerStyle,
|
|
5
|
+
declare function BottomTabNavigator({ initialRouteName, backBehavior, children, screenListeners, screenOptions, sceneContainerStyle, ...restWithDeprecated }: Props): JSX.Element;
|
|
6
6
|
declare const _default: <ParamList extends ParamListBase>() => import("@react-navigation/native").TypedNavigator<ParamList, TabNavigationState<ParamListBase>, BottomTabNavigationOptions, BottomTabNavigationEventMap, typeof BottomTabNavigator>;
|
|
7
7
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/bottom-tabs",
|
|
3
3
|
"description": "Bottom tab navigator following iOS design guidelines",
|
|
4
|
-
"version": "6.0
|
|
4
|
+
"version": "6.1.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
"clean": "del lib"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-navigation/elements": "^1.
|
|
39
|
+
"@react-navigation/elements": "^1.3.0",
|
|
40
40
|
"color": "^3.1.3",
|
|
41
41
|
"warn-once": "^0.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@react-navigation/native": "^6.0.
|
|
44
|
+
"@react-navigation/native": "^6.0.7",
|
|
45
45
|
"@testing-library/react-native": "^7.2.0",
|
|
46
46
|
"@types/color": "^3.0.1",
|
|
47
47
|
"@types/react": "^17.0.9",
|
|
48
48
|
"@types/react-native": "~0.64.9",
|
|
49
49
|
"del-cli": "^3.0.1",
|
|
50
|
-
"react": "
|
|
51
|
-
"react-native": "~0.
|
|
50
|
+
"react": "17.0.1",
|
|
51
|
+
"react-native": "~0.64.3",
|
|
52
52
|
"react-native-builder-bob": "^0.18.1",
|
|
53
|
-
"react-native-safe-area-context": "
|
|
54
|
-
"react-native-screens": "~3.
|
|
53
|
+
"react-native-safe-area-context": "3.3.2",
|
|
54
|
+
"react-native-screens": "~3.10.1",
|
|
55
55
|
"typescript": "^4.3.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
]
|
|
76
76
|
]
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "4c5805867ce946d99ba17f71b4d6086bb8751262"
|
|
79
79
|
}
|
package/src/index.tsx
CHANGED
|
@@ -34,12 +34,16 @@ function BottomTabNavigator({
|
|
|
34
34
|
screenListeners,
|
|
35
35
|
screenOptions,
|
|
36
36
|
sceneContainerStyle,
|
|
37
|
-
|
|
38
|
-
lazy,
|
|
39
|
-
// @ts-expect-error: tabBarOptions is deprecated
|
|
40
|
-
tabBarOptions,
|
|
41
|
-
...rest
|
|
37
|
+
...restWithDeprecated
|
|
42
38
|
}: Props) {
|
|
39
|
+
const {
|
|
40
|
+
// @ts-expect-error: lazy is deprecated
|
|
41
|
+
lazy,
|
|
42
|
+
// @ts-expect-error: tabBarOptions is deprecated
|
|
43
|
+
tabBarOptions,
|
|
44
|
+
...rest
|
|
45
|
+
} = restWithDeprecated;
|
|
46
|
+
|
|
43
47
|
let defaultScreenOptions: BottomTabNavigationOptions = {};
|
|
44
48
|
|
|
45
49
|
if (tabBarOptions) {
|