jrshikoku/lib/initIcon.tsx
harukin-expo-dev-env 294b95967f 6.0 update init
2025-01-22 11:34:05 +00:00

21 lines
631 B
TypeScript

import React from "react";
import { Ionicons, AntDesign } from "@expo/vector-icons";
type name = keyof typeof Ionicons.glyphMap & keyof typeof AntDesign.glyphMap;
type type = "Ionicons" | "AntDesign";
export const initIcon = (name: name, type:type) => {
switch (type) {
case "Ionicons":
return ({ focused, color, size }) => (
<Ionicons name={name} size={30} color={focused ? "#0099CC" : "black"} />
);
case "AntDesign":
return ({ focused, color, size }) => (
<AntDesign
name={name}
size={30}
color={focused ? "#0099CC" : "black"}
/>
);
}
};