import React, { FC } from "react"; import { Ionicons, AntDesign } from "@expo/vector-icons"; import { Text, View } from "react-native"; type name = keyof typeof Ionicons.glyphMap & keyof typeof AntDesign.glyphMap; type type = "Ionicons" | "AntDesign"; export const initIcon = ( name: name, type: type, tabBarBadge: string, isInfo: boolean ) => { switch (type) { case "Ionicons": return ({ focused, color, size }) => ( <> {!!tabBarBadge && } ); case "AntDesign": return ({ focused, color, size }) => ( <> {!!tabBarBadge && } ); } }; type BadgeProps = { tabBarBadge: string; isInfo: boolean }; export const Badge: FC = ({ tabBarBadge, isInfo }) => { return ( {tabBarBadge} ); };