'BVLinearGradient was not found in the UIManager?

There is documentation about this, but it is for macOs only. https://github.com/react-native-community/react-native-linear-gradient.

I linked the library by running npm install react-native link react-native-linear-gradient.

I don't understand this i dont have a ios folder, i installed pod but my ios folder remained empty:

iOS For React Native >= 0.60.0 run the following command in the ios/ folder and skip the rest of the section.

pod install CocoaPods Add the following line to your Podfile:

pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient' or:

This below is only for macOs ?

Manually Open your project in Xcode, right click on Libraries and click Add Files to "Your Project Name" Look under node_modules/react-native-linear-gradient/ios and add BVLinearGradient.xcodeproj. (Screenshot 1) (Screenshot 2). Add libBVLinearGradient.a to Build Phases -> Link Binary With Libraries (Screenshot 1) (Screenshot 2). Click on BVLinearGradient.xcodeproj in Libraries and go the Build Settings tab. Double click the text to the right of Header Search Paths and verify that it has $(SRCROOT)/../react-native/React - if it isn't, then add it. This is so Xcode is able to find the headers that the BVLinearGradient source files are referring to by pointing to the header files installed within the react-native node_modules directory. (Screenshot).

How to do it in Windows and i don't have an ios map inside node_modules/react-native-linear-gradient/?

how can i make it work?

Thanks for your time

Solution 1:[1]

Check whether these two lines are in your 'package file'.

'React', :path => '../node_modules/react-native'

'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

If yes then --

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


Solution 2:[2]

use this one if you are using expo

1 . paste this in terminal window :

expo install expo-linear-gradient

2.add the import statement to the file :

import {LinearGradient} from 'expo-linear-gradient';

worked for me !

Solution 3:[3]

First, install the https://github.com/react-native-community/react-native-linear-gradient library.

then go to the cd ios and run

cd ios
pod install

now use go back using cd ..

and run (optional )

 react-native link react-native-linear-gradient

now run

react-native run-ios

Solution 4:[4]

Simply you just need to go to ios folder

cd ios
pod install

That's it

Solution 5:[5]

If using expo and this error is thrown after installing react-native-linear-gradient follow along.

error ? the expo framework still does not have "sight" of the linear gradient package .

solution ? Run the command "expo install expo-linear-gradient" from your root folder, go to the file that you had previously imported the linear gradient as "import LinearGradient from 'react-native-linear-gradient" and change the line to "import {LinerGradient} from 'expo-linear-gradient'".

Restart your server, "expo start". PS: This solution is only applicable for react-native projects being built using expo

Solution 6:[6]

if you're using windows & react-native cli (not expo):

1- in android/settings.gradle, check if

include ':react-native-linear-gradient' project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')

exist .. if not, add them

2- in android/app/build.gradle, check if

implementation project(':react-native-linear-gradient')

exists in dependecies{ ... } .. if not, add it

3- in android/app/src/main/java/com/{YOUR_APP_NAME}/MainApplication.java , find

@Override protected List getPackages() { ....}

Then replace the comment // packages.add(new MyReactNativePackage());

with => packages.add(new LinearGradientPackage());


This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Au Nguyen
Solution 2 Indika_Nuwan95
Solution 3
Solution 4 Yazan Najjar
Solution 5 bitbuoy
Solution 6 Salwa A. Soliman