@react-navigation/bottom-tabs 6.0.7 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +23 -20
- 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 +11 -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 +23 -20
- 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 +11 -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/lib/typescript/src/views/Badge.d.ts +1 -1
- package/lib/typescript/src/views/ScreenFallback.d.ts +1 -0
- package/package.json +8 -8
- package/src/index.tsx +1 -0
- package/src/navigators/createBottomTabNavigator.tsx +9 -5
- package/src/views/Badge.tsx +12 -12
- package/src/views/BottomTabView.tsx +1 -0
- package/src/views/ScreenFallback.tsx +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BottomTabItem.tsx"],"names":["BottomTabBarItem","focused","route","label","icon","badge","badgeStyle","to","button","children","style","onPress","accessibilityRole","rest","Platform","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","StyleSheet","create","flex","alignItems","justifyContent","flexDirection","textAlign","fontSize","marginLeft","marginTop","display"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAYA;;;;;;AA0Ge,SAASA,gBAAT,CAA0B;AACvCC,EAAAA,OADuC;AAEvCC,EAAAA,KAFuC;AAGvCC,EAAAA,KAHuC;AAIvCC,EAAAA,IAJuC;AAKvCC,EAAAA,KALuC;AAMvCC,EAAAA,UANuC;AAOvCC,EAAAA,EAPuC;AAQvCC,EAAAA,MAAM,GAAG,CAAC;AACRC,IAAAA,QADQ;AAERC,IAAAA,KAFQ;AAGRC,IAAAA,OAHQ;AAIRJ,IAAAA,EAJQ;AAKRK,IAAAA,iBALQ;AAMR,OAAGC;AANK,GAAD,KAOsB;AAC7B,QAAIC,sBAASC,EAAT,KAAgB,KAAhB,IAAyBR,EAA7B,EAAiC;AAC/B;AACA;AACA,0BACE,6BAAC,YAAD,eACMM,IADN;AAEE,QAAA,EAAE,EAAEN,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E;AACHK,IAAAA,IAAI,EAAE,CADH;AAEHC,IAAAA,UAAU,EAAE;AAFT,GAD0B;AAK/BJ,EAAAA,WAAW,EAAE;AACXK,IAAAA,cAAc,EAAE,UADL;AAEXC,IAAAA,aAAa,EAAE;AAFJ,GALkB;AAS/BP,EAAAA,YAAY,EAAE;AACZM,IAAAA,cAAc,EAAE,QADJ;AAEZC,IAAAA,aAAa,EAAE;AAFH,GATiB;AAa/BjE,EAAAA,KAAK,EAAE;AACLkE,IAAAA,SAAS,EAAE,QADN;AAELhB,IAAAA,eAAe,EAAE;AAFZ,GAbwB;AAiB/BN,EAAAA,YAAY,EAAE;AACZuB,IAAAA,QAAQ,EAAE;AADE,GAjBiB;AAoB/BxB,EAAAA,WAAW,EAAE;AACXwB,IAAAA,QAAQ,EAAE,EADC;AAEXC,IAAAA,UAAU,EAAE,EAFD;AAGXC,IAAAA,SAAS,EAAE;AAHA,GApBkB;AAyB/BhE,EAAAA,MAAM,EAAE;AACNiE,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":["BottomTabBarItem","focused","route","label","icon","badge","badgeStyle","to","button","children","style","onPress","accessibilityRole","rest","Platform","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","StyleSheet","create","flex","alignItems","justifyContent","flexDirection","textAlign","fontSize","marginLeft","marginTop","display"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAYA;;;;;;AA0Ge,SAASA,gBAAT,OAgEL;AAAA,MAhE+B;AACvCC,IAAAA,OADuC;AAEvCC,IAAAA,KAFuC;A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D,OAAO,GAAG,CAAC,UAAD,CAAH,GAAkB,EAVlC;AAWZS,IAAAA,KAAK,EAAE,CACLM,MAAM,CAAC4C,GADF,EAEL;AAAEP,MAAAA;AAAF,KAFK,EAGL3B,UAAU,GAAGV,MAAM,CAAC6C,YAAV,GAAyB7C,MAAM,CAAC8C,WAHrC,EAILpD,KAJK,CAXK;AAiBZD,IAAAA,QAAQ,eACN,6BAAC,cAAD,CAAO,QAAP,QACGwC,UAAU,CAACG,KAAD,CADb,EAEGR,WAAW,CAACQ,KAAD,CAFd;AAlBU,GAAD,CAAb;AAwBD;;AAED,MAAMpC,MAAM,GAAG+C,wBAAWC,MAAX,CAAkB;AAC/BJ,EAAAA,GAAG,EAAE;AACHK,IAAAA,IAAI,EAAE,CADH;AAEHC,IAAAA,UAAU,EAAE;AAFT,GAD0B;AAK/BJ,EAAAA,WAAW,EAAE;AACXK,IAAAA,cAAc,EAAE,UADL;AAEXC,IAAAA,aAAa,EAAE;AAFJ,GALkB;AAS/BP,EAAAA,YAAY,EAAE;AACZM,IAAAA,cAAc,EAAE,QADJ;AAEZC,IAAAA,aAAa,EAAE;AAFH,GATiB;AAa/BjE,EAAAA,KAAK,EAAE;AACLkE,IAAAA,SAAS,EAAE,QADN;AAELhB,IAAAA,eAAe,EAAE;AAFZ,GAbwB;AAiB/BN,EAAAA,YAAY,EAAE;AACZuB,IAAAA,QAAQ,EAAE;AADE,GAjBiB;AAoB/BxB,EAAAA,WAAW,EAAE;AACXwB,IAAAA,QAAQ,EAAE,EADC;AAEXC,IAAAA,UAAU,EAAE,EAFD;AAGXC,IAAAA,SAAS,EAAE;AAHA,GApBkB;AAyB/BhE,EAAAA,MAAM,EAAE;AACNiE,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"]}
|
|
@@ -84,6 +84,7 @@ function BottomTabView(props) {
|
|
|
84
84
|
} = state;
|
|
85
85
|
return /*#__PURE__*/React.createElement(_elements.SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreenContainer, {
|
|
86
86
|
enabled: detachInactiveScreens,
|
|
87
|
+
hasTwoStates: true,
|
|
87
88
|
style: styles.container
|
|
88
89
|
}, routes.map((route, index) => {
|
|
89
90
|
const descriptor = descriptors[route.key];
|
|
@@ -103,13 +104,16 @@ function BottomTabView(props) {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
const {
|
|
106
|
-
header =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
header = _ref5 => {
|
|
108
|
+
let {
|
|
109
|
+
layout,
|
|
110
|
+
options
|
|
111
|
+
} = _ref5;
|
|
112
|
+
return /*#__PURE__*/React.createElement(_elements.Header, _extends({}, options, {
|
|
113
|
+
layout: layout,
|
|
114
|
+
title: (0, _elements.getHeaderTitle)(options, route.name)
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
113
117
|
} = descriptor.options;
|
|
114
118
|
return /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreen, {
|
|
115
119
|
key: route.key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["BottomTabView.tsx"],"names":["BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","Platform","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","React","useState","includes","dimensions","SafeAreaProviderCompat","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","StyleSheet","absoluteFill","zIndex","headerShown","headerTransparent","headerStatusBarHeight","render","create","flex","overflow"],"mappings":";;;;;;;AAAA;;AAUA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;;;;;;;;;AAQe,SAASA,aAAT,CAAuBC,KAAvB,EAAqC;AAClD,QAAM;AACJC,IAAAA,MAAM,GAAID,KAAD,iBAA8B,oBAAC,qBAAD,EAAkBA,KAAlB,CADnC;AAEJE,IAAAA,KA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AAM,EAAEN,UADK;AAEbqB,QAAAA,KAAK,EAAEC,UAAU,CAACD,KAFL;AAGbrC,QAAAA,UAAU,EACRsC,UAAU,CAACtC,UAJA;AAKb2B,QAAAA,OAAO,EAAEW,UAAU,CAACX;AALP,OAAD,CAThB;AAgBE,MAAA,KAAK,EAAErB;AAhBT,OAkBGgC,UAAU,CAACY,MAAX,EAlBH,CADF,CANF,CADF;AA+BD,GAvDA,CAJH,CADF,eA8DE,oBAAC,0CAAD,CAAmC,QAAnC;AAA4C,IAAA,KAAK,EAAE7B;AAAnD,KACGQ,YAAY,EADf,CA9DF,CADF;AAoED;;AAED,MAAMK,MAAM,GAAGU,wBAAWO,MAAX,CAAkB;AAC/BhB,EAAAA,SAAS,EAAE;AACTiB,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":["BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","Platform","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","React","useState","includes","dimensions","SafeAreaProviderCompat","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","StyleSheet","absoluteFill","zIndex","headerShown","headerTransparent","headerStatusBarHeight","render","create","flex","overflow"],"mappings":";;;;;;;AAAA;;AAUA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;;;;;;;;;AAQe,SAASA,aAAT,CAAuBC,KAAvB,EAAqC;AAClD,QAAM;AACJC,IAAAA,MAAM,GAAID,KAAD,iBAA8B,oBAAC,qBAAD,EAAkBA,KAAlB,CADnC;AAEJE,IAAAA,KAFI;AAGJC,IAAAA,UAHI;AAIJC,IAAAA,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AAAA,MAAM,EAAEN,UADK;AAEbqB,QAAAA,KAAK,EAAEC,UAAU,CAACD,KAFL;AAGbrC,QAAAA,UAAU,EACRsC,UAAU,CAACtC,UAJA;AAKb2B,QAAAA,OAAO,EAAEW,UAAU,CAACX;AALP,OAAD,CAThB;AAgBE,MAAA,KAAK,EAAErB;AAhBT,OAkBGgC,UAAU,CAACY,MAAX,EAlBH,CADF,CANF,CADF;AA+BD,GAvDA,CALH,CADF,eA+DE,oBAAC,0CAAD,CAAmC,QAAnC;AAA4C,IAAA,KAAK,EAAE7B;AAAnD,KACGQ,YAAY,EADf,CA/DF,CADF;AAqED;;AAED,MAAMK,MAAM,GAAGU,wBAAWO,MAAX,CAAkB;AAC/BhB,EAAAA,SAAS,EAAE;AACTiB,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 hasTwoStates\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"]}
|
|
@@ -25,12 +25,14 @@ try {
|
|
|
25
25
|
} catch (e) {// Ignore
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const MaybeScreenContainer =
|
|
29
|
-
enabled,
|
|
30
|
-
...rest
|
|
31
|
-
}) => {
|
|
28
|
+
const MaybeScreenContainer = _ref => {
|
|
32
29
|
var _Screens, _Screens$screensEnabl;
|
|
33
30
|
|
|
31
|
+
let {
|
|
32
|
+
enabled,
|
|
33
|
+
...rest
|
|
34
|
+
} = _ref;
|
|
35
|
+
|
|
34
36
|
if ((_Screens = Screens) !== null && _Screens !== void 0 && (_Screens$screensEnabl = _Screens.screensEnabled) !== null && _Screens$screensEnabl !== void 0 && _Screens$screensEnabl.call(_Screens)) {
|
|
35
37
|
return /*#__PURE__*/React.createElement(Screens.ScreenContainer, _extends({
|
|
36
38
|
enabled: enabled
|
|
@@ -42,13 +44,15 @@ const MaybeScreenContainer = ({
|
|
|
42
44
|
|
|
43
45
|
exports.MaybeScreenContainer = MaybeScreenContainer;
|
|
44
46
|
|
|
45
|
-
function MaybeScreen({
|
|
46
|
-
visible,
|
|
47
|
-
children,
|
|
48
|
-
...rest
|
|
49
|
-
}) {
|
|
47
|
+
function MaybeScreen(_ref2) {
|
|
50
48
|
var _Screens2, _Screens2$screensEnab;
|
|
51
49
|
|
|
50
|
+
let {
|
|
51
|
+
visible,
|
|
52
|
+
children,
|
|
53
|
+
...rest
|
|
54
|
+
} = _ref2;
|
|
55
|
+
|
|
52
56
|
if ((_Screens2 = Screens) !== null && _Screens2 !== void 0 && (_Screens2$screensEnab = _Screens2.screensEnabled) !== null && _Screens2$screensEnab !== void 0 && _Screens2$screensEnab.call(_Screens2)) {
|
|
53
57
|
return /*#__PURE__*/React.createElement(Screens.Screen, _extends({
|
|
54
58
|
activityState: visible ? 2 : 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ScreenFallback.tsx"],"names":["Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;;;;;;;AASA,IAAIA,OAAJ;;AAEA,IAAI;AACFA,EAAAA,OAAO,GAAGC,OAAO,CAAC,sBAAD,CAAjB;AACD,CAFD,CAEE,OAAOC,CAAP,EAAU,CACV;AACD;;AAEM,MAAMC,oBAAoB,GAAG,
|
|
1
|
+
{"version":3,"sources":["ScreenFallback.tsx"],"names":["Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;;;;;;;AASA,IAAIA,OAAJ;;AAEA,IAAI;AACFA,EAAAA,OAAO,GAAGC,OAAO,CAAC,sBAAD,CAAjB;AACD,CAFD,CAEE,OAAOC,CAAP,EAAU,CACV;AACD;;AAEM,MAAMC,oBAAoB,GAAG,QAO9B;AAAA;;AAAA,MAP+B;AACnCC,IAAAA,OADmC;AAEnC,OAAGC;AAFgC,GAO/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,iBAAD,EAAUA,IAAV,CAAP;AACD,CAbM;;;;AAeA,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,4BAAD;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 hasTwoStates: 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"]}
|
|
@@ -13,18 +13,19 @@ var _Badge = _interopRequireDefault(require("./Badge"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
function TabBarIcon({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
function TabBarIcon(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
route: _,
|
|
19
|
+
horizontal,
|
|
20
|
+
badge,
|
|
21
|
+
badgeStyle,
|
|
22
|
+
activeOpacity,
|
|
23
|
+
inactiveOpacity,
|
|
24
|
+
activeTintColor,
|
|
25
|
+
inactiveTintColor,
|
|
26
|
+
renderIcon,
|
|
27
|
+
style
|
|
28
|
+
} = _ref;
|
|
28
29
|
const size = 25; // We render the icon twice at the same position on top of each other:
|
|
29
30
|
// active and inactive one, so we can fade between them.
|
|
30
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["TabBarIcon.tsx"],"names":["TabBarIcon","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","size","styles","iconHorizontal","iconVertical","icon","opacity","focused","color","badgeHorizontal","badgeVertical","StyleSheet","create","position","alignSelf","alignItems","justifyContent","height","width","minWidth","flex","marginTop","left","top"],"mappings":";;;;;;;AACA;;AACA;;AAQA;;;;AAmBe,SAASA,UAAT,
|
|
1
|
+
{"version":3,"sources":["TabBarIcon.tsx"],"names":["TabBarIcon","route","_","horizontal","badge","badgeStyle","activeOpacity","inactiveOpacity","activeTintColor","inactiveTintColor","renderIcon","style","size","styles","iconHorizontal","iconVertical","icon","opacity","focused","color","badgeHorizontal","badgeVertical","StyleSheet","create","position","alignSelf","alignItems","justifyContent","height","width","minWidth","flex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R,GAAa;AAPrB,KASGR,KATH,CAjBF,CADF;AA+BD;;AAED,MAAMS,MAAM,GAAGS,wBAAWC,MAAX,CAAkB;AAC/BP,EAAAA,IAAI,EAAE;AACJ;AACA;AACA;AACAQ,IAAAA,QAAQ,EAAE,UAJN;AAKJC,IAAAA,SAAS,EAAE,QALP;AAMJC,IAAAA,UAAU,EAAE,QANR;AAOJC,IAAAA,cAAc,EAAE,QAPZ;AAQJC,IAAAA,MAAM,EAAE,MARJ;AASJC,IAAAA,KAAK,EAAE,MATH;AAUJ;AACAC,IAAAA,QAAQ,EAAE;AAXN,GADyB;AAc/Bf,EAAAA,YAAY,EAAE;AACZgB,IAAAA,IAAI,EAAE;AADM,GAdiB;AAiB/BjB,EAAAA,cAAc,EAAE;AACdc,IAAAA,MAAM,EAAE,MADM;AAEdI,IAAAA,SAAS,EAAE;AAFG,GAjBe;AAqB/B5B,EAAAA,KAAK,EAAE;AACLoB,IAAAA,QAAQ,EAAE,UADL;AAELS,IAAAA,IAAI,EAAE;AAFD,GArBwB;AAyB/BZ,EAAAA,aAAa,EAAE;AACba,IAAAA,GAAG,EAAE;AADQ,GAzBgB;AA4B/Bd,EAAAA,eAAe,EAAE;AACfc,IAAAA,GAAG,EAAE;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"]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["default","createBottomTabNavigator","BottomTabBar","BottomTabView","BottomTabBarHeightContext","useBottomTabBarHeight"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,wBAApB,QAAoD,uCAApD;AAEA;AACA;AACA;;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,sBAAxC;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,uBAAzC;AAEA;AACA;AACA;;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mCAArD;AACA,SAASJ,OAAO,IAAIK,qBAApB,QAAiD,+BAAjD;AAEA;AACA;AACA","sourcesContent":["/**\n * Navigators\n */\nexport { default as createBottomTabNavigator } from './navigators/createBottomTabNavigator';\n\n/**\n * Views\n */\nexport { default as BottomTabBar } from './views/BottomTabBar';\nexport { default as BottomTabView } from './views/BottomTabView';\n\n/**\n * Utilities\n */\nexport { default as BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';\nexport { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight';\n\n/**\n * Types\n */\nexport type {\n BottomTabBarButtonProps,\n BottomTabBarProps,\n BottomTabHeaderProps,\n BottomTabNavigationOptions,\n BottomTabNavigationProp,\n BottomTabScreenProps,\n} from './types';\n"]}
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["default","createBottomTabNavigator","BottomTabBar","BottomTabView","BottomTabBarHeightContext","useBottomTabBarHeight"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,wBAApB,QAAoD,uCAApD;AAEA;AACA;AACA;;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,sBAAxC;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,uBAAzC;AAEA;AACA;AACA;;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mCAArD;AACA,SAASJ,OAAO,IAAIK,qBAApB,QAAiD,+BAAjD;AAEA;AACA;AACA","sourcesContent":["/**\n * Navigators\n */\nexport { default as createBottomTabNavigator } from './navigators/createBottomTabNavigator';\n\n/**\n * Views\n */\nexport { default as BottomTabBar } from './views/BottomTabBar';\nexport { default as BottomTabView } from './views/BottomTabView';\n\n/**\n * Utilities\n */\nexport { default as BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';\nexport { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight';\n\n/**\n * Types\n */\nexport type {\n BottomTabBarButtonProps,\n BottomTabBarProps,\n BottomTabHeaderProps,\n BottomTabNavigationEventMap,\n BottomTabNavigationOptions,\n BottomTabNavigationProp,\n BottomTabScreenProps,\n} from './types';\n"]}
|
|
@@ -5,19 +5,23 @@ import * as React from 'react';
|
|
|
5
5
|
import warnOnce from 'warn-once';
|
|
6
6
|
import BottomTabView from '../views/BottomTabView';
|
|
7
7
|
|
|
8
|
-
function BottomTabNavigator({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
function BottomTabNavigator(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
initialRouteName,
|
|
11
|
+
backBehavior,
|
|
12
|
+
children,
|
|
13
|
+
screenListeners,
|
|
14
|
+
screenOptions,
|
|
15
|
+
sceneContainerStyle,
|
|
16
|
+
...restWithDeprecated
|
|
17
|
+
} = _ref;
|
|
18
|
+
const {
|
|
19
|
+
// @ts-expect-error: lazy is deprecated
|
|
20
|
+
lazy,
|
|
21
|
+
// @ts-expect-error: tabBarOptions is deprecated
|
|
22
|
+
tabBarOptions,
|
|
23
|
+
...rest
|
|
24
|
+
} = restWithDeprecated;
|
|
21
25
|
let defaultScreenOptions = {};
|
|
22
26
|
|
|
23
27
|
if (tabBarOptions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["createBottomTabNavigator.tsx"],"names":["createNavigatorFactory","TabRouter","useNavigationBuilder","React","warnOnce","BottomTabView","BottomTabNavigator","initialRouteName","backBehavior","children","screenListeners","screenOptions","sceneContainerStyle","lazy","tabBarOptions","rest","defaultScreenOptions","Object","assign","tabBarHideOnKeyboard","keyboardHidesTabBar","tabBarActiveTintColor","activeTintColor","tabBarInactiveTintColor","inactiveTintColor","tabBarActiveBackgroundColor","activeBackgroundColor","tabBarInactiveBackgroundColor","inactiveBackgroundColor","tabBarAllowFontScaling","allowFontScaling","tabBarShowLabel","showLabel","tabBarLabelStyle","labelStyle","tabBarIconStyle","iconStyle","tabBarItemStyle","tabStyle","tabBarLabelPosition","labelPosition","adaptive","undefined","tabBarStyle","display","tabBarVisible","keys","forEach","key","JSON","stringify","state","descriptors","navigation","NavigationContent"],"mappings":";;AAAA,SACEA,sBADF,EAMEC,SANF,EAQEC,oBARF,QASO,0BATP;AAUA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,QAAP,MAAqB,WAArB;AAOA,OAAOC,aAAP,MAA0B,wBAA1B;;AAWA,SAASC,kBAAT,
|
|
1
|
+
{"version":3,"sources":["createBottomTabNavigator.tsx"],"names":["createNavigatorFactory","TabRouter","useNavigationBuilder","React","warnOnce","BottomTabView","BottomTabNavigator","initialRouteName","backBehavior","children","screenListeners","screenOptions","sceneContainerStyle","restWithDeprecated","lazy","tabBarOptions","rest","defaultScreenOptions","Object","assign","tabBarHideOnKeyboard","keyboardHidesTabBar","tabBarActiveTintColor","activeTintColor","tabBarInactiveTintColor","inactiveTintColor","tabBarActiveBackgroundColor","activeBackgroundColor","tabBarInactiveBackgroundColor","inactiveBackgroundColor","tabBarAllowFontScaling","allowFontScaling","tabBarShowLabel","showLabel","tabBarLabelStyle","labelStyle","tabBarIconStyle","iconStyle","tabBarItemStyle","tabStyle","tabBarLabelPosition","labelPosition","adaptive","undefined","tabBarStyle","display","tabBarVisible","keys","forEach","key","JSON","stringify","state","descriptors","navigation","NavigationContent"],"mappings":";;AAAA,SACEA,sBADF,EAMEC,SANF,EAQEC,oBARF,QASO,0BATP;AAUA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,QAAP,MAAqB,WAArB;AAOA,OAAOC,aAAP,MAA0B,wBAA1B;;AAWA,SAASC,kBAAT,OAQU;AAAA,MARkB;AAC1BC,IAAAA,gBAD0B;AAE1BC,IAAAA,YAF0B;AAG1BC,IAAAA,QAH0B;AAI1BC,IAAAA,eAJ0B;AAK1BC,IAAAA,aAL0B;AAM1BC,IAAAA,mBAN0B;AAO1B,OAAGC;AAPuB,GAQlB;AACR,QAAM;AACJ;AACAC,IAAAA,IAFI;AAGJ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AAI,CAACC,SAAL,CAC1LlC,oBAD0L,EAE1L,IAF0L,EAG1L,CAH0L,CAI1L,yFANI,CAAR;AAQD;;AAED,MAAI,OAAOH,IAAP,KAAgB,SAApB,EAA+B;AAC7BG,IAAAA,oBAAoB,CAACH,IAArB,GAA4BA,IAA5B;AAEAV,IAAAA,QAAQ,CACN,IADM,EAEL,+KAFK,CAAR;AAID;;AAED,QAAM;AAAEgD,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA,UAAtB;AAAkCC,IAAAA;AAAlC,MACJrD,oBAAoB,CAMlBD,SANkB,EAMP;AACXM,IAAAA,gBADW;AAEXC,IAAAA,YAFW;AAGXC,IAAAA,QAHW;AAIXC,IAAAA,eAJW;AAKXC,IAAAA,aALW;AAMXM,IAAAA;AANW,GANO,CADtB;AAgBA,sBACE,oBAAC,iBAAD,qBACE,oBAAC,aAAD,eACMD,IADN;AAEE,IAAA,KAAK,EAAEoC,KAFT;AAGE,IAAA,UAAU,EAAEE,UAHd;AAIE,IAAA,WAAW,EAAED,WAJf;AAKE,IAAA,mBAAmB,EAAEzC;AALvB,KADF,CADF;AAWD;;AAED,eAAeZ,sBAAsB,CAKnCM,kBALmC,CAArC","sourcesContent":["import {\n createNavigatorFactory,\n DefaultNavigatorOptions,\n ParamListBase,\n TabActionHelpers,\n TabNavigationState,\n TabRouter,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport warnOnce from 'warn-once';\n\nimport type {\n BottomTabNavigationConfig,\n BottomTabNavigationEventMap,\n BottomTabNavigationOptions,\n} from '../types';\nimport BottomTabView from '../views/BottomTabView';\n\ntype Props = DefaultNavigatorOptions<\n ParamListBase,\n TabNavigationState<ParamListBase>,\n BottomTabNavigationOptions,\n BottomTabNavigationEventMap\n> &\n TabRouterOptions &\n BottomTabNavigationConfig;\n\nfunction BottomTabNavigator({\n initialRouteName,\n backBehavior,\n children,\n screenListeners,\n screenOptions,\n sceneContainerStyle,\n ...restWithDeprecated\n}: Props) {\n const {\n // @ts-expect-error: lazy is deprecated\n lazy,\n // @ts-expect-error: tabBarOptions is deprecated\n tabBarOptions,\n ...rest\n } = restWithDeprecated;\n\n let defaultScreenOptions: BottomTabNavigationOptions = {};\n\n if (tabBarOptions) {\n Object.assign(defaultScreenOptions, {\n tabBarHideOnKeyboard: tabBarOptions.keyboardHidesTabBar,\n tabBarActiveTintColor: tabBarOptions.activeTintColor,\n tabBarInactiveTintColor: tabBarOptions.inactiveTintColor,\n tabBarActiveBackgroundColor: tabBarOptions.activeBackgroundColor,\n tabBarInactiveBackgroundColor: tabBarOptions.inactiveBackgroundColor,\n tabBarAllowFontScaling: tabBarOptions.allowFontScaling,\n tabBarShowLabel: tabBarOptions.showLabel,\n tabBarLabelStyle: tabBarOptions.labelStyle,\n tabBarIconStyle: tabBarOptions.iconStyle,\n tabBarItemStyle: tabBarOptions.tabStyle,\n tabBarLabelPosition:\n tabBarOptions.labelPosition ??\n (tabBarOptions.adaptive === false ? 'below-icon' : undefined),\n tabBarStyle: [\n { display: tabBarOptions.tabBarVisible ? 'none' : 'flex' },\n defaultScreenOptions.tabBarStyle,\n ],\n });\n\n (\n Object.keys(defaultScreenOptions) as (keyof BottomTabNavigationOptions)[]\n ).forEach((key) => {\n if (defaultScreenOptions[key] === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete defaultScreenOptions[key];\n }\n });\n\n warnOnce(\n tabBarOptions,\n `Bottom Tab Navigator: 'tabBarOptions' is deprecated. Migrate the options to 'screenOptions' instead.\\n\\nPlace the following in 'screenOptions' in your code to keep current behavior:\\n\\n${JSON.stringify(\n defaultScreenOptions,\n null,\n 2\n )}\\n\\nSee https://reactnavigation.org/docs/bottom-tab-navigator#options for more details.`\n );\n }\n\n if (typeof lazy === 'boolean') {\n defaultScreenOptions.lazy = lazy;\n\n warnOnce(\n true,\n `Bottom Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.\\n\\nSee https://reactnavigation.org/docs/bottom-tab-navigator/#lazy for more details.`\n );\n }\n\n const { state, descriptors, navigation, NavigationContent } =\n useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n TabActionHelpers<ParamListBase>,\n BottomTabNavigationOptions,\n BottomTabNavigationEventMap\n >(TabRouter, {\n initialRouteName,\n backBehavior,\n children,\n screenListeners,\n screenOptions,\n defaultScreenOptions,\n });\n\n return (\n <NavigationContent>\n <BottomTabView\n {...rest}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n sceneContainerStyle={sceneContainerStyle}\n />\n </NavigationContent>\n );\n}\n\nexport default createNavigatorFactory<\n TabNavigationState<ParamListBase>,\n BottomTabNavigationOptions,\n BottomTabNavigationEventMap,\n typeof BottomTabNavigator\n>(BottomTabNavigator);\n"]}
|
|
@@ -4,15 +4,16 @@ import { useTheme } from '@react-navigation/native';
|
|
|
4
4
|
import color from 'color';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { Animated, StyleSheet } from 'react-native';
|
|
7
|
-
export default function Badge({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
export default function Badge(_ref) {
|
|
8
|
+
let {
|
|
9
|
+
children,
|
|
10
|
+
style,
|
|
11
|
+
visible = true,
|
|
12
|
+
size = 18,
|
|
13
|
+
...rest
|
|
14
|
+
} = _ref;
|
|
14
15
|
const [opacity] = React.useState(() => new Animated.Value(visible ? 1 : 0));
|
|
15
|
-
const [rendered, setRendered] = React.useState(visible
|
|
16
|
+
const [rendered, setRendered] = React.useState(visible);
|
|
16
17
|
const theme = useTheme();
|
|
17
18
|
React.useEffect(() => {
|
|
18
19
|
if (!rendered) {
|
|
@@ -23,9 +24,11 @@ export default function Badge({
|
|
|
23
24
|
toValue: visible ? 1 : 0,
|
|
24
25
|
duration: 150,
|
|
25
26
|
useNativeDriver: true
|
|
26
|
-
}).start(
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
}).start(_ref2 => {
|
|
28
|
+
let {
|
|
29
|
+
finished
|
|
30
|
+
} = _ref2;
|
|
31
|
+
|
|
29
32
|
if (finished && !visible) {
|
|
30
33
|
setRendered(false);
|
|
31
34
|
}
|
|
@@ -33,12 +36,12 @@ export default function Badge({
|
|
|
33
36
|
return () => opacity.stopAnimation();
|
|
34
37
|
}, [opacity, rendered, visible]);
|
|
35
38
|
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if (!rendered) {
|
|
40
|
+
if (visible) {
|
|
41
|
+
setRendered(true);
|
|
42
|
+
} else {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
42
45
|
} // @ts-expect-error: backgroundColor definitely exists
|
|
43
46
|
|
|
44
47
|
|
|
@@ -52,19 +55,19 @@ export default function Badge({
|
|
|
52
55
|
return /*#__PURE__*/React.createElement(Animated.Text, _extends({
|
|
53
56
|
numberOfLines: 1,
|
|
54
57
|
style: [{
|
|
55
|
-
opacity,
|
|
56
58
|
transform: [{
|
|
57
59
|
scale: opacity.interpolate({
|
|
58
60
|
inputRange: [0, 1],
|
|
59
61
|
outputRange: [0.5, 1]
|
|
60
62
|
})
|
|
61
63
|
}],
|
|
62
|
-
backgroundColor,
|
|
63
64
|
color: textColor,
|
|
64
|
-
fontSize,
|
|
65
65
|
lineHeight: size - 1,
|
|
66
66
|
height: size,
|
|
67
67
|
minWidth: size,
|
|
68
|
+
opacity,
|
|
69
|
+
backgroundColor,
|
|
70
|
+
fontSize,
|
|
68
71
|
borderRadius
|
|
69
72
|
}, styles.container, restStyle]
|
|
70
73
|
}, rest), children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Badge.tsx"],"names":["useTheme","color","React","Animated","StyleSheet","Badge","
|
|
1
|
+
{"version":3,"sources":["Badge.tsx"],"names":["useTheme","color","React","Animated","StyleSheet","Badge","children","style","visible","size","rest","opacity","useState","Value","rendered","setRendered","theme","useEffect","timing","toValue","duration","useNativeDriver","start","finished","stopAnimation","backgroundColor","colors","notification","restStyle","flatten","textColor","isLight","borderRadius","fontSize","Math","floor","transform","scale","interpolate","inputRange","outputRange","lineHeight","height","minWidth","styles","container","create","alignSelf","textAlign","paddingHorizontal","overflow"],"mappings":";;AAAA,SAASA,QAAT,QAAyB,0BAAzB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAA8BC,UAA9B,QAA2D,cAA3D;AAqBA,eAAe,SAASC,KAAT,OAML;AAAA,MANoB;AAC5BC,IAAAA,QAD4B;AAE5BC,IAAAA,KAF4B;AAG5BC,IAAAA,OAAO,GAAG,IAHkB;AAI5BC,IAAAA,IAAI,GAAG,EAJqB;AAK5B,OAAGC;AALyB,GAMpB;AACR,QAAM,CAACC,OAAD,IAAYT,KAAK,CAACU,QAAN,CAAe,MAAM,IAAIT,QAAQ,CAACU,KAAb,CAAmBL,OAAO,GAAG,CAAH,GAAO,CAAjC,CAArB,CAAlB;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0Bb,KAAK,CAACU,QAAN,CAAeJ,OAAf,CAAhC;AAEA,QAAMQ,KAAK,GAAGhB,QAAQ,EAAtB;AAEAE,EAAAA,KAAK,CAACe,SAAN,CAAgB,MAAM;AACpB,QAAI,CAACH,QAAL,EAAe;AACb;AACD;;AAEDX,IAAAA,QAAQ,CAACe,MAAT,CAAgBP,OAAhB,EAAyB;AACvBQ,MAAAA,OAAO,EAAEX,OAAO,GAAG,CAAH,GAAO,CADA;AAEvBY,MAAAA,QAAQ,EAAE,GAFa;AAGvBC,MAAAA,eAAe,EAAE;AAHM,KAAzB,EAIGC,KAJH,CAIS,SAAkB;AAAA,UAAjB;AAAEC,QAAAA;AAAF,OAAiB;;AACzB,UAAIA,QAAQ,IAAI,CAACf,OAAjB,EAA0B;AACxBO,QAAAA,WAAW,CAAC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AhBF,KADK,EAmBLY,MAAM,CAACC,SAnBF,EAoBLjB,SApBK;AAFT,KAwBMlB,IAxBN,GA0BGJ,QA1BH,CADF;AA8BD;AAED,MAAMsC,MAAM,GAAGxC,UAAU,CAAC0C,MAAX,CAAkB;AAC/BD,EAAAA,SAAS,EAAE;AACTE,IAAAA,SAAS,EAAE,UADF;AAETC,IAAAA,SAAS,EAAE,QAFF;AAGTC,IAAAA,iBAAiB,EAAE,CAHV;AAITC,IAAAA,QAAQ,EAAE;AAJD;AADoB,CAAlB,CAAf","sourcesContent":["import { useTheme } from '@react-navigation/native';\nimport color from 'color';\nimport * as React from 'react';\nimport { Animated, StyleProp, StyleSheet, TextStyle } from 'react-native';\n\ntype Props = {\n /**\n * Whether the badge is visible\n */\n visible: boolean;\n /**\n * Content of the `Badge`.\n */\n children?: string | number;\n /**\n * Size of the `Badge`.\n */\n size?: number;\n /**\n * Style object for the tab bar container.\n */\n style?: Animated.WithAnimatedValue<StyleProp<TextStyle>>;\n};\n\nexport default function Badge({\n children,\n style,\n visible = true,\n size = 18,\n ...rest\n}: Props) {\n const [opacity] = React.useState(() => new Animated.Value(visible ? 1 : 0));\n const [rendered, setRendered] = React.useState(visible);\n\n const theme = useTheme();\n\n React.useEffect(() => {\n if (!rendered) {\n return;\n }\n\n Animated.timing(opacity, {\n toValue: visible ? 1 : 0,\n duration: 150,\n useNativeDriver: true,\n }).start(({ finished }) => {\n if (finished && !visible) {\n setRendered(false);\n }\n });\n\n return () => opacity.stopAnimation();\n }, [opacity, rendered, visible]);\n\n if (!rendered) {\n if (visible) {\n setRendered(true);\n } else {\n return null;\n }\n }\n\n // @ts-expect-error: backgroundColor definitely exists\n const { backgroundColor = theme.colors.notification, ...restStyle } =\n StyleSheet.flatten(style) || {};\n const textColor = color(backgroundColor).isLight() ? 'black' : 'white';\n\n const borderRadius = size / 2;\n const fontSize = Math.floor((size * 3) / 4);\n\n return (\n <Animated.Text\n numberOfLines={1}\n style={[\n {\n transform: [\n {\n scale: opacity.interpolate({\n inputRange: [0, 1],\n outputRange: [0.5, 1],\n }),\n },\n ],\n color: textColor,\n lineHeight: size - 1,\n height: size,\n minWidth: size,\n opacity,\n backgroundColor,\n fontSize,\n borderRadius,\n },\n styles.container,\n restStyle,\n ]}\n {...rest}\n >\n {children}\n </Animated.Text>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: 'flex-end',\n textAlign: 'center',\n paddingHorizontal: 4,\n overflow: 'hidden',\n },\n});\n"]}
|
|
@@ -11,12 +11,13 @@ const COMPACT_TABBAR_HEIGHT = 32;
|
|
|
11
11
|
const DEFAULT_MAX_TAB_ITEM_WIDTH = 125;
|
|
12
12
|
const useNativeDriver = Platform.OS !== 'web';
|
|
13
13
|
|
|
14
|
-
const shouldUseHorizontalLabels =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const shouldUseHorizontalLabels = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
state,
|
|
17
|
+
descriptors,
|
|
18
|
+
layout,
|
|
19
|
+
dimensions
|
|
20
|
+
} = _ref;
|
|
20
21
|
const {
|
|
21
22
|
tabBarLabelPosition
|
|
22
23
|
} = descriptors[state.routes[state.index].key].options;
|
|
@@ -60,16 +61,17 @@ const getPaddingBottom = insets => Math.max(insets.bottom - Platform.select({
|
|
|
60
61
|
default: 0
|
|
61
62
|
}), 0);
|
|
62
63
|
|
|
63
|
-
export const getTabBarHeight =
|
|
64
|
-
state,
|
|
65
|
-
descriptors,
|
|
66
|
-
dimensions,
|
|
67
|
-
insets,
|
|
68
|
-
style,
|
|
69
|
-
...rest
|
|
70
|
-
}) => {
|
|
64
|
+
export const getTabBarHeight = _ref2 => {
|
|
71
65
|
var _StyleSheet$flatten;
|
|
72
66
|
|
|
67
|
+
let {
|
|
68
|
+
state,
|
|
69
|
+
descriptors,
|
|
70
|
+
dimensions,
|
|
71
|
+
insets,
|
|
72
|
+
style,
|
|
73
|
+
...rest
|
|
74
|
+
} = _ref2;
|
|
73
75
|
// @ts-ignore
|
|
74
76
|
const customHeight = (_StyleSheet$flatten = StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.height;
|
|
75
77
|
|
|
@@ -92,13 +94,14 @@ export const getTabBarHeight = ({
|
|
|
92
94
|
|
|
93
95
|
return DEFAULT_TABBAR_HEIGHT + paddingBottom;
|
|
94
96
|
};
|
|
95
|
-
export default function BottomTabBar({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
export default function BottomTabBar(_ref3) {
|
|
98
|
+
let {
|
|
99
|
+
state,
|
|
100
|
+
navigation,
|
|
101
|
+
descriptors,
|
|
102
|
+
insets,
|
|
103
|
+
style
|
|
104
|
+
} = _ref3;
|
|
102
105
|
const {
|
|
103
106
|
colors
|
|
104
107
|
} = useTheme();
|
|
@@ -139,9 +142,11 @@ export default function BottomTabBar({
|
|
|
139
142
|
useNativeDriver,
|
|
140
143
|
duration: 250,
|
|
141
144
|
...(visibilityAnimationConfig === null || visibilityAnimationConfig === void 0 ? void 0 : (_visibilityAnimationC2 = visibilityAnimationConfig.show) === null || _visibilityAnimationC2 === void 0 ? void 0 : _visibilityAnimationC2.config)
|
|
142
|
-
}).start(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
}).start(_ref4 => {
|
|
146
|
+
let {
|
|
147
|
+
finished
|
|
148
|
+
} = _ref4;
|
|
149
|
+
|
|
145
150
|
if (finished) {
|
|
146
151
|
setIsTabBarHidden(false);
|
|
147
152
|
}
|
|
@@ -284,13 +289,16 @@ export default function BottomTabBar({
|
|
|
284
289
|
activeBackgroundColor: tabBarActiveBackgroundColor,
|
|
285
290
|
inactiveBackgroundColor: tabBarInactiveBackgroundColor,
|
|
286
291
|
button: options.tabBarButton,
|
|
287
|
-
icon: (_options$tabBarIcon = options.tabBarIcon) !== null && _options$tabBarIcon !== void 0 ? _options$tabBarIcon :
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
icon: (_options$tabBarIcon = options.tabBarIcon) !== null && _options$tabBarIcon !== void 0 ? _options$tabBarIcon : _ref5 => {
|
|
293
|
+
let {
|
|
294
|
+
color,
|
|
295
|
+
size
|
|
296
|
+
} = _ref5;
|
|
297
|
+
return /*#__PURE__*/React.createElement(MissingIcon, {
|
|
298
|
+
color: color,
|
|
299
|
+
size: size
|
|
300
|
+
});
|
|
301
|
+
},
|
|
294
302
|
badge: options.tabBarBadge,
|
|
295
303
|
badgeStyle: options.tabBarBadgeStyle,
|
|
296
304
|
label: label,
|