0

I'm trying to find a type for Icon component in the below code. I'm using react Navigation and importing

import { Ionicons, FontAwesome } from "@expo/vector-icons";

Ionicons and FontAwesome is showing the following typescript error.

JSX element type 'Icon' does not have any construct or call signatures

When I look up the type for Ionicons or FontAwesome its saying Icons<> but i'm not able to find where to import that type from.

<Tab.Navigator
  screenOptions={({ route }) => ({
    tabBarIcon: ({ focused, color, size }) => {
      let iconName;
      let Icon;

      if (route.name === "Home") {
        iconName = "home";
        Icon = Ionicons;
      } else if (route.name === "Editor") {
        iconName = "edit";
        Icon = FontAwesome;
      }

      return <Icon name={iconName} size={size} color={color} />;
    },
    tabBarActiveTintColor: "tomato",
    tabBarInactiveTintColor: "gray",
    headerShown: false,
  })}
>
  <Tab.Screen name="Home" component={Home} />
  <Tab.Screen name="Editor" component={Editor} />
</Tab.Navigator>
4

0 回答 0