Skip to content

react-native-vector-icons does not seem to be working with iOS #370

Closed
@niteshbalusu11

Description

@niteshbalusu11

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

https://github.com/callstackincubator/react-native-bottom-tabs/blob/main/docs/docs/docs/guides/usage-with-vector-icons.md

I don't think vector-icons works with iOS. I think apple doesn't like any icon source? I am having to do a conditional check if it's iOS i need to use sfSymbol and for android we can use getImageSourceSync from vector-icons

I am not sure if i am missing something or the docs need to be updated.

Library version

0.9.2

Environment info

"expo": "~53.0.12"
"react-native": "0.79.4",

Steps to reproduce

  1. Try the sample code
  2. on iOS you will run into:
ERROR  Warning: Error: VectorIcons.getImageForFontSync raised an exception: No font found for font name "Ionicons". Make sure the font is included in info.plist.

Reproducible sample code

import "./global.css";

import { NavigationContainer } from "@react-navigation/native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import HomeScreen from "./src/screens/HomeScreen";
import SettingsScreen from "./src/screens/SettingsScreen";
import { createNativeBottomTabNavigator } from "@bottom-tabs/react-navigation";
import Icon from "@react-native-vector-icons/ionicons";
import { Platform } from "react-native";

const Tab = createNativeBottomTabNavigator();

export default function App() {
  return (
    <SafeAreaProvider>
      <NavigationContainer>
        <Tab.Navigator>
          <Tab.Screen
            name="Home"
            component={HomeScreen}
            options={{
              tabBarIcon: () => {
                return Platform.OS === "ios"
                  ? { sfSymbol: "book" }
                  : Icon.getImageSourceSync("home", 24)!;
              },
            }}
          />
          <Tab.Screen
            name="Settings"
            component={SettingsScreen}
            options={{
              tabBarIcon: () => {
                return Platform.OS === "ios"
                  ? { sfSymbol: "gear" }
                  : Icon.getImageSourceSync("settings", 24)!;
              },
            }}
          />
        </Tab.Navigator>
      </NavigationContainer>
    </SafeAreaProvider>
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions