react-native-linear-gradient: Native component for "BVLinearGradient" does not exist.

I checked both issues related to this problem, #263 and #157. But the problem is that I am still getting this error,

Native component for “BVLinearGradient” does not exist

I don’t know how to solve this. react-native-linear-gradient is linked to my project, react-native-linear-gradient added in my project. libBVLinearGradient.a added in Link Binaries with Libraries. You can check my project screenshot below,

screen shot 2018-04-05 at 4 59 34 pm

How to resolve this error?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 14
  • Comments: 17 (1 by maintainers)

Most upvoted comments

If you are still having trouble with this and have tried the all of the advice in this repo: I followed some of the steps here and managed to get it working.

1.Delete /ios and /android folders from root folder 2.Run react-native upgrade from the terminal inside your root folder 3.Run react-native link 4.Run react-native run-ios

Check whether these two lines are in your ‘podFile’ referring cocoapods section in README.MD pod 'React', :path => '../node_modules/react-native' pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

Run pod install under $project path/ios before react-native run-ios

If anyone is having the linking problem, I recommend NOT to use pod to link the library. For some reasons I just couldn’t get it work.

Here is what I did:

  1. Rename the BVLinearGradient.podspec file to something like BVLinearGradient.xxxpodspec. This is to prevent react-native link to link the library using Podfile. See: https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-2
  2. Run react-native link

no idea how I fixed, but got it working after 1 hour.

steps I did:

  1. remove node_modules
  2. npm cache clean
  3. remove from Podfile
  4. remove from libraries and link with binaries
  5. remove derived data from xcode
  6. Product => clean
  7. npm i
  8. added to libraries from node_modules
  9. when link with binaries => pay attention there are 2 libs with the same name, one for tvOS

Had same issue with iOS but manually linking resolved it.

It works with pod install!!! Just edit the ‘Podfile’ inside ios folder: pod ‘SRSRadialGradient’, :path => ‘…/node_modules/react-native-radial-gradient/’ and change the path to: pod ‘SRSRadialGradient’, :path => ‘…/node_modules/react-native-radial-gradient/ios’

Then run pod install again.

I could not get mine to work with the manual instructions from the readme either. I struggled for ages and got it to work by doing the following:

  • In xcode, click on the project, under TARGETS click on your main target, under build settings->search paths->header search paths I add the following:

$(SRCROOT)/../node_modules/react-native-linear-gradient

  • Then I rebuilt the project, then compiled the app to simulator within xcode.

After that I could compile the app using react-native run-ios again.

That somehow sorted it out for me.