React Native Video - react-native

i'm trying to use 'react-native-video' in my application, i have used the following lines to get it:
npm install --save react-native-video
react-native link react-native-video (since my react native version is 0.59)
after doing so and using "Video" component from 'react-native-vide' i got an error like below:
what is the problem? what can i do? any ideas?

You did not link the library properly.
After having installed the library through npm i --save react-native-video, you'll need to run react-native link react-native-video in order to link it. This may or may not work - if it does not, you'll need to link manually according to the installation instructions of the library.
You might be using CocoaPods in which case you'll need to run these commands as well: cd ios && pod install
If you receive an error, you're most likely not using CocoaPods and this is the wrong approach.
Please note that you'll need to reinstall the app on the phone / simulator afterwards since you've changed the native dependencies. You'll also need to do this if you're using (ejected) Expo or anything alike. If you're using Expo with the managed workflow (= not ejected) you're not able to use libraries that depend on native linking.

Related

Can i use native base without installing `react-native link`?

I want to use native-base but i do not want to install react-native link. How can i do this?
The reason i do not want to install react-native link is because react-native doc suggest us to delete react-native CLI globally.
I guess you have misunderstanding of what react-native link does. react-native link is an automatic way for installing native dependencies. read more here
In case of Native Base. This library is consist of other npm packages, so you need to install them in order to work properly with Native Base.
Native Base Docs states
Install Peer Dependencies
The peer dependencies included from any npm packages does not automatically get installed. Your application will not depend on it explicitly. read more here
If your react-native version is 0.60+ you do not need to link dependencies. All you need to do is install dependencies and you are good to do.

is it necessary to rebuild react-native project after linking

I would like to know if it's necessary to rebuild react native project after installing and linking libraries that includes native codes.
Yes, as react-native-link updates some native files that are under the ios/android folder, that won't be checked during a reload/hot-reload/live-reload. All those files aren't checked in your jsBundle and are compiled during a run-android or run-ios.
Of course, if you added a new dependecy to the project and linked it, and you haven't used it anywhere in your code yet, you don't need it. If you are using that dependecy, your project instance will, most likely, die.
if your react native version is below 0.60 then you have to run react-native-link after you install any react-native module. However after react-native version 0.60 and above, this is done automatically using the new "autolinking" feature added.
Read the changelog here:
https://facebook.github.io/react-native/blog/2019/07/03/version-60
However you still need to rebuild your project after you install a native module but you dont need to run the react-native-link command anymore after installing every library after react-native#0.60 and above. Just type react-native run-android

Problem with new upgraded version(0.60) of react native when we linking any third party module

In my cases when i link third party module in react native like..
npm install react-native-vector-icons --save.
react-native link
It gives message for me....
React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:-
react-native-vector-icons (to unlink run: "react-native unlink react-native-vector-icons")
but if i am not link the module it will not work for me
this problem occurs only in react-native new upgraded version(0.60) not for older version.
please suggest me any solution for the given problem.
Always make sure to install any third party library manually rather than doing react-native link.
Follow the detailed manual installation https://github.com/oblador/react-native-vector-icons from here.
Firstly run this command react-native unlink react-native-vector-icons
After unlink is successful, follow the manual installation steps.
Also it's better to use yarn (https://yarnpkg.com/en/) over npm while installing a package.
Hope this helps!
Since react native 0.60 auto-linking is avaliable so that means that future libraries release won't need to run the "link" command. If you're using vector-icons you'll need to wait until the upgrade. You can use the vector icons linked to you project normally, but be careful because that will not be compatible in the next major release in react native. I also tried to upgrade to react native 0.60.3, but this is not the great idea if your using a lot of dependencies.

How can I insert expo module in a React-native project?

I tried to use react-native-admob but It gives me a lot of problems. So I want to install with npm the expo module to use expoadmob that I'm sure works fine. I created a project with react native and tried to use "npm install expo --save" to add the expo module, but it didn't work. Anyone have a solution?
Not sure to understand.
You have 2 ways to create RN application expo-cli and react-native-cli.
You can't use expo for your module because you need to have a access to the native part (created with react-native-cli)
yarn add react-native-admob#next
AND don't forget to link the dependencies with
react-native link

Still cannot use `react-native link` after ejecting a Create React Native App

I started with a create-react-native app. Then, I wanted to add a dependency. So, I ran react-native link:
`react-native link` can not be used in Create React Native App projects. If you need to include a library that relies on custom native code, you might have to eject first. See https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md for more information.
So, I ran npm run eject and it successfully ejected. There are many changes to the package.json and some scripts have been added.
But, if I now run react-native link, I still get the same error!! How can I successfully run this command? How does it determine that I'm still using create-react-native?
I'm guessing there's some flag somewhere that still says it's using create-react-native, but I don't know where it is. Any help is appreciated.
react-native link
only works when you have added any new package eg:- npm i react-native-vector-icons. then you need to import package name to various class manually but if you dont want to do it you can directly run the command
react-native link react-native-vector-icons OR react-native link
this will automatically add import the package to your ios and android files.
Try these steps it will work.