question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove React dependency

See original GitHub issue

Summary

Version v0.26.4
Affected OS iOS
OS Version iOS 12, RN 0.58.5

Current behavior

Pod::Spec.new do |s|
  s.name         = "RNDeviceInfo"
  s.version      = "0.21.5"
  s.summary      = "Device Information for react-native"

  s.homepage     = "https://github.com/rebeccahughes/react-native-device-info"

  s.license      = "MIT"
  s.authors      = { "Rebecca Hughes" => "rebecca@learnium.net" }
  s.ios.deployment_target = '8.0'
  s.tvos.deployment_target = '10.0'

  s.source       = { :git => "https://github.com/rebeccahughes/react-native-device-info.git" }

  s.source_files  = "ios/RNDeviceInfo/*.{h,m}"

  s.dependency 'React'
end

please remove dependency of react - still appears - is it not removed yet?

Project build is failing due multiple versions of react

Expected behavior

Please remove s.dependency 'React'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mikehardycommented, Mar 27, 2019

Okay, I’m learning through development on my own project how this whole Pod thing works. @guhungry thank you so much for the information here, it was a big help.

I believe the Pod contents @guhungry recommends are the standard and are correct, with the addition of the React (and maybe yoga) remove snippet that you frequently see. I have this working locally and it’s stable as I add/remove pods and link other modules. I think the react-native-camera doc guidance is sufficient and we could include as ios troubleshooting but with our module name:

You may need to adjust your Podfile like this if you use Cocoapods and have undefined symbols or duplicate React definitions

target 'yourTargetName' do
  # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # Needed for debugging
    'RCTAnimation', # Needed for FlatList and animations running on native UI thread
    # Add any other subspecs you want to use in your project
  ]

  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'react-native-info', path: '../node_modules/react-native-device-info'

end

# if you see errors about React duplicate definitions, this fixes it. The same works for yoga.
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

I’d like to add this to docs and close this. Can someone read through and make sure I’m not crazy? Thanks!

1reaction
guhungrycommented, Mar 19, 2019
  1. then npm install --save react-native-device-info and react-native link react-native-device-info
  2. then cd ios && pod install -> this will install react 0.11.0

It was my understanding that if you are using podfiles you should not link?

You almost always link native libraries with react-native link regardless of your project setup (pod or project). If react-native link detect pod will try to link with Podfile first or else via project file. But for pod to work properly you must install React native via Podfile too. And also remove React dependencies from project file too or else it will crash with each other.

It’s one way or another for linking if you use pod all native libraries need to link with pod.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Remove Unused Dependencies in React - Pluralsight
In general, you can uninstall any npm package or dependency by running the following command: · Let's uninstall react-bootstrap from the project ...
Read more >
Uninstalling packages and dependencies - npm Docs
To uninstall an unscoped global package, on the command line, use the uninstall command with the -g flag. Include the scope if the...
Read more >
remove unused dependencies in React - npm - Stack Overflow
In general, you can uninstall any npm package or dependency by running the following command: · used yarn-check rather than NPM-CHECK as yarn...
Read more >
Removing Effect Dependencies - React Docs
To remove a dependency, prove that it's not a dependency · function ChatRoom({ roomId }) { // This is a reactive value. useEffect(()...
Read more >
How to Clean My React.js Project from Unused Dependencies
Uninstalling Packages. You can uninstall any npm package or dependency by running the following command: npm uninstall --save <package_name>.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found