Skip to content
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 not working in ios #1604

Open
shubhanshubb opened this issue Mar 20, 2024 · 7 comments
Open

React-native-vector-icons not working in ios #1604

shubhanshubb opened this issue Mar 20, 2024 · 7 comments

Comments

@shubhanshubb
Copy link

"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?"

@tarangshah19
Copy link

have you found any solution for this yet?

@durandt
Copy link

durandt commented Apr 25, 2024

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)

@johnf
Copy link
Collaborator

johnf commented Apr 27, 2024

@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?

@durandt
Copy link

durandt commented Apr 27, 2024

@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)

@anastobe
Copy link

anastobe commented May 6, 2024

same issue counter any solution?

@eko9x9
Copy link

eko9x9 commented May 22, 2024

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)

tanks it's work

@emil-malmgaard-rasmussen

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants