tsxのFC宣言をProviderに追加
This commit is contained in:
@@ -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 }}>
|
||||
|
Reference in New Issue
Block a user