New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-native-vector-icons v.10.0.3 doesn't work properly in iOS. #1616
Comments
same here on react-native 0.74.1, vector icons If I kill the app everything is fine but after a while after navigating around in the app I start seeing question marks. |
same issue. checked everything. checked linking, info.plist, target config for copy bundle resources. do you have the message `unrecognized font family 'font-name' in XCode? |
@tststs I'm developing on Windows, but I don't have any kind of error in console anyway |
Hello, I have the same issue since the bump to Expo v51. It seems like the problem is only with icons that exist in FontAwesome 5 and not in FontAwesome 6. I import the package like this: I tried to import it like this: So, some icons have been removed from the free version of FontAwesome 6 that were present in FontAwesome 5. You can check here : https://icons.expo.fyi/Index |
Same issue here. I am using
Each icon is always returned as a a question mark on my end as well. |
interlinking with expo issue: |
I found out that caching the .ttf with function cacheFonts(fonts: any[]) {
return fonts.map((font) => Font.loadAsync(font));
} everything works fine. |
reverting this PR fixes the issue:
diff --git a/node_modules/expo-font/ios/FontFamilyAliasManager.swift b/node_modules/expo-font/ios/FontFamilyAliasManager.swift
index 126d577..c86c1fa 100644
--- a/node_modules/expo-font/ios/FontFamilyAliasManager.swift
+++ b/node_modules/expo-font/ios/FontFamilyAliasManager.swift
@@ -53,21 +53,13 @@ private func maybeSwizzleUIFont() {
if hasSwizzled {
return
}
- let originalFontNamesMethod = class_getClassMethod(UIFont.self, #selector(UIFont.fontNames(forFamilyName:)))
- let newFontNamesMethod = class_getClassMethod(UIFont.self, #selector(UIFont._expo_fontNames(forFamilyName:)))
+ let originalMethod = class_getClassMethod(UIFont.self, #selector(UIFont.fontNames(forFamilyName:)))
+ let newMethod = class_getClassMethod(UIFont.self, #selector(UIFont._expo_fontNames(forFamilyName:)))
- if let originalFontNamesMethod, let newFontNamesMethod {
- method_exchangeImplementations(originalFontNamesMethod, newFontNamesMethod)
+ if let originalMethod, let newMethod {
+ method_exchangeImplementations(originalMethod, newMethod)
} else {
log.error("expo-font is unable to swizzle `UIFont.fontNames(forFamilyName:)`")
}
- let originalInitMethod = class_getClassMethod(UIFont.self, #selector(UIFont.init(name:size:)))
- let newInitMethod = class_getClassMethod(UIFont.self, #selector(UIFont._expo_init(name:size:)))
-
- if let originalInitMethod, let newInitMethod {
- method_exchangeImplementations(originalInitMethod, newInitMethod)
- } else {
- log.error("expo-font is unable to swizzle `UIFont.init(name:size:)`")
- }
hasSwizzled = true
}
diff --git a/node_modules/expo-font/ios/UIFont+FontFamilyAlias.swift b/node_modules/expo-font/ios/UIFont+FontFamilyAlias.swift
index 5d3f077..c70e108 100644
--- a/node_modules/expo-font/ios/UIFont+FontFamilyAlias.swift
+++ b/node_modules/expo-font/ios/UIFont+FontFamilyAlias.swift
@@ -15,13 +15,4 @@ public extension UIFont {
}
return fontNames
}
- @objc
- static dynamic func _expo_init(name fontName: String, size fontSize: CGFloat) -> UIFont? {
- let font = UIFont._expo_init(name: fontName, size: fontSize)
-
- if let aliasedFamilyName = FontFamilyAliasManager.familyName(forAlias: fontName) {
- return UIFont._expo_init(name: aliasedFamilyName, size: fontSize)
- }
- return font
- }
} |
To provide more information for my previous comment, I built my app using the
|
same here on react-native 0.74.1, vector icons 10.1.0 |
i follow this article and is working for me on CLI. https://aboutreact.com/react-native-vector-icons/ " import Icon from 'react-native-vector-icons/FontAwesome' " i added to with "npm i --save-dev @types/react-native-vector-icons " and is working as expected hope it helps to u! |
Thank you @doug3d it's working fine now |
it has same result with simple react native project not expo i am referring to. |
In my case,
|
Currently having same problems, here is my package.json: I got following code: All icons has been added to info.plist, but it's still not working at my end, not sure what im doing wrong |
Description
Hi everyone,
I'm having a problem with the latest version of react-native-vector-icons which is 10.0.3.
I had to upgrade the SDK to version 51 this morning to continue developing an application on Android/Apple.
Before using SDK version 51 everything worked fine on both devices.
Now it happens to me that when I rebuild the App the icons disappear showing me the question mark only and exclusively on iOS.
Anyone have any idea how to fix the problem?
I can't let you test any demo but I can show you some photos of the problem I'm having:
IPHONE 12 PRO with iOS 17.4.1
SAMSUNG GALAXY A23 with Android 14
The text was updated successfully, but these errors were encountered: