tsxのFC宣言をProviderに追加

This commit is contained in:
harukin-expo-dev-env
2025-09-11 16:55:05 +00:00
parent 9ac36216b9
commit 58df77ae49
8 changed files with 107 additions and 89 deletions

View File

@@ -9,30 +9,13 @@ export const initIcon = (
tabBarBadge: string,
isInfo: boolean
) => {
switch (type) {
case "Ionicons":
return ({ focused, color, size }) => (
<>
{!!tabBarBadge && <Badge tabBarBadge={tabBarBadge} isInfo={isInfo} />}
<Ionicons
name={name}
size={30}
color={focused ? "#0099CC" : "black"}
/>
</>
);
case "AntDesign":
return ({ focused, color, size }) => (
<>
{!!tabBarBadge && <Badge tabBarBadge={tabBarBadge} isInfo={isInfo} />}
<AntDesign
name={name}
size={30}
color={focused ? "#0099CC" : "black"}
/>
</>
);
}
const IconComponent = type == "Ionicons" ? Ionicons : AntDesign;
return ({ focused, color, size }) => (
<>
{!!tabBarBadge && <Badge tabBarBadge={tabBarBadge} isInfo={isInfo} />}
<IconComponent name={name} size={30} color={focused ? "#0099CC" : "black"} />
</>
);
};
type BadgeProps = { tabBarBadge: string; isInfo: boolean };
@@ -60,7 +43,7 @@ export const Badge: FC<BadgeProps> = ({ tabBarBadge, isInfo }) => {
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.5,
shadowRadius: 4,
elevation: 2
elevation: 2,
}}
>
<Text style={{ color: "white", paddingHorizontal: 4 }}>