import * as React from 'react'; import { Image, StyleSheet, View, Pressable, Text, Platform, } from 'react-native'; import type { BottomTabType, Orientation } from '../navigationUtils'; import BottomTabBadge from './BottomTabBadgeWeb'; import RidgeNavigationContext from '../contexts/RidgeNavigationContext'; import { BottomTabLink } from 'react-native-ridge-navigation'; import Color from 'color'; function BottomTabWeb({ isSelected, bottomTab, count, orientation, aboveDrawerBreakingPoint, }: { orientation: Orientation; isSelected: boolean; bottomTab: BottomTabType; count?: string | number | undefined; aboveDrawerBreakingPoint: boolean; }) { const { theme } = React.useContext(RidgeNavigationContext); return ( {(linkProps) => ( {({ pressed, hovered }: any) => { return ( {!aboveDrawerBreakingPoint && ( {count} )} {aboveDrawerBreakingPoint && ( {bottomTab.title()} )} {aboveDrawerBreakingPoint && !!count && ( {count} )} {!aboveDrawerBreakingPoint && ( {bottomTab.title()} )} ); }} )} ); } const styles = StyleSheet.create({ touchable: { flex: 1, maxWidth: 140, maxHeight: 100, width: '100%', paddingTop: 12, paddingHorizontal: 12, paddingBottom: 16, // margin: 3, }, leftWrapper: { flexDirection: 'row', alignItems: 'center', flexShrink: 0, }, badgeRight: { flex: 1, alignItems: 'flex-end', justifyContent: 'center', }, touchableBig: { maxWidth: '100%', maxHeight: 64, }, spacer: { height: 4, }, iconWrapper: { borderRadius: 360, width: 64, height: 32, alignItems: 'center', justifyContent: 'center', }, iconWrapperBig: { height: 56, width: '100%', flexDirection: 'row', justifyContent: 'flex-start', paddingLeft: 6, paddingRight: 16, }, touchableHovered: { backgroundColor: 'rgba(0, 0, 0, 0.04)', }, touchablePressed: { backgroundColor: 'rgba(0, 0, 0, 0.12)', }, touchableHoveredDark: { backgroundColor: 'rgba(255, 255, 255, 0.08)', }, touchablePressedDark: { backgroundColor: 'rgba(255, 255, 255, 0.32)', }, touchableInner: { flex: 1, height: 46, padding: 6, alignItems: 'center', justifyContent: 'center', position: 'relative', }, badge: { position: 'absolute', top: -2, right: 13, zIndex: 100, }, verticalIcon: { width: 20, height: 20, margin: 6, }, horizontalIcon: { width: 24, height: 24, margin: 10, }, }); export default React.memo(BottomTabWeb);