React-native-vector-icons not working in ios
shubhanshubb opened this issue · 19 comments
"I'm currently working on a React Native project (version 0.73.2) and encountering an issue with react-native-vector-icons integration. Despite following the installation steps (npm install --save react-native-vector-icons followed by pod install), the RNVectorIcons library does not seem to be added to my Podfile.lock or properly linked in my Xcode project. Auto-linking should work with my React Native version, but it appears to be missing. Is there a known issue or step I'm overlooking for React Native 0.73.2?"
have you found any solution for this yet?
Similar issues reported on this older issue #1317 (though I think it is better that you created a new issue).
I am working on a fresh new react-native app and icons were working just fine. I just stumbled upon this problem after i ran pod install
and the output contained:
Removing RNVectorIcons
My package.json
"dependencies": {
"react": "18.2.0",
"react-native": "0.73.6",
"react-native-vector-icons": "^10.0.3"
},
The project was created by my Android-colleague. Then I cloned our project on my mac and went though the installation steps for react-native-vector-icons (adding the Fonts to the iOS project file) and the icons were working fine.
Until now when I ran pod install
and it removed RNVectorIcons.
I added RNVectorIcons to my ios/Podfile
and re-ran pod install
and it is working again.
target 'MyApp' do
config = use_native_modules!
use_react_native!(
# ....
)
target 'MyAppTests' do
# ....
end
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
post_install do |installer|
# ....
end
end
I cannot see that it would have been there in my git history.
I wonder:
- Is
npm install react-native-vector-icons
supposed to add RNVectorIcons to the Podfile? - Or is the pod added another way?
- How is cocoapods supposed to know it should add RNVectorIcons?
- May XCode or something else have added RNVectorIcons to the Podfile on the first build (which would explain why it worked to begin with) but somehow did not save the file?
- I could also have inadvertently removed the changes to the Podfile after install (though I don't think I did)
@durandt You should not need to add anything to the Podfile. cocapods should detect the podspec
in the node_modules package.
Are using able to share your entire Podfile?
@johnf sure:
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, min_ios_version_supported
prepare_react_native_project!
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
# dependencies: {
# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
target 'MyApp' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => flipper_config,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'MyAppTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false
)
end
end
Git history says file hasn't changed since it was created with npx react-native@latest init MyApp
around April 11th. (react native version would have been 0.73.6)
same issue counter any solution?
Similar issues reported on this older issue #1317 (though I think it is better that you created a new issue).
I am working on a fresh new react-native app and icons were working just fine. I just stumbled upon this problem after i ran
pod install
and the output contained:Removing RNVectorIcons
My package.json
"dependencies": { "react": "18.2.0", "react-native": "0.73.6", "react-native-vector-icons": "^10.0.3" },The project was created by my Android-colleague. Then I cloned our project on my mac and went though the installation steps for react-native-vector-icons (adding the Fonts to the iOS project file) and the icons were working fine. Until now when I ran
pod install
and it removed RNVectorIcons.I added RNVectorIcons to my
ios/Podfile
and re-ranpod install
and it is working again.target 'MyApp' do config = use_native_modules! use_react_native!( # .... ) target 'MyAppTests' do # .... end pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' post_install do |installer| # .... end end
I cannot see that it would have been there in my git history.
I wonder:
- Is
npm install react-native-vector-icons
supposed to add RNVectorIcons to the Podfile?- Or is the pod added another way?
- How is cocoapods supposed to know it should add RNVectorIcons?
- May XCode or something else have added RNVectorIcons to the Podfile on the first build (which would explain why it worked to begin with) but somehow did not save the file?
- I could also have inadvertently removed the changes to the Podfile after install (though I don't think I did)
tanks it's work
I have the same Issue.
Tried installing React-Native-Vector-Icons 10.0.3 in my RN 0.72 project. worked fine, but when I run the same version in RN version 0.73.6, it tells me the same as @durandt:
Downloading dependencies Removing RNVectorIcons
I also tried newest version: 10.1.0 - Also no luck with RN version 0.73.6
Unfortuntely I'm unable to replicate this. If someone can share a git repo or send me something privately I'll be happy to debug
Same issue with latest react-native-vector-icon and RN 0.74.2
Confirm @durandt 's manual update to Podfile fixes it: #1604 (comment)
Same issue with latest react-native-vector-icon and RN 0.74.2
Confirm @durandt 's manual update to Podfile fixes it: #1604 (comment)
By adding that line to the Podfile, it's installed, but then when building the App, I get the error: 'error: Multiple commands produce '/path/of/the/project/ios/build/NameOfTheProject/Build/Products/Debug-iphonesimulator/NameOfTheProject.app/Zocial.ttf':'.
What's the correct way to configure it?
I'm using these versions:
"react": "18.2.0",
"react-native": "0.74.5",
"react-native-vector-icons": "^10.1.0"
getting the same issue
"react": "18.3.1",
"react-native": "^0.75.1",
"react-native-vector-icons": "^10.1.0"