21 lines
631 B
TypeScript
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"}
|
|
/>
|
|
);
|
|
}
|
|
};
|