Closed
Description
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
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
- Try the sample code
- 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>
);
}