import { useTheme } from '@emotion/react';
import type { ReactNode } from 'react';
import React from 'react';
import { View } from 'react-native';
import Badge from '../Badge';
import { StyledBadgeWrapper } from './StyledTabs';
type StatusBadgeType = {
type: 'status';
};
type CounterBadgeType = {
type: 'counter';
value: number;
max?: number;
};
export type BadgeConfigType = StatusBadgeType | CounterBadgeType;
interface TabWithBadgeProps {
config?: BadgeConfigType;
tabItem: ReactNode;
}
const TabWithBadge = ({ config, tabItem }: TabWithBadgeProps) => {
const theme = useTheme();
if (!config) return {tabItem};
if (config.type === 'status') {
return (
{tabItem}
);
}
if (config.type === 'counter') {
return (
{tabItem}
);
}
return {tabItem};
};
export default TabWithBadge;