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
Related
I have been having some trouble finding some straight answers in generating android and ios packages in a pre-existing react-native project.
yarn start works for me to view my project in on the web browser but I am trying to create an ios and android native project from this pre-existing website. Right now I have an empty template project that can be made using these commands on Mac Os after installing yarn:
yarn create react-app website
Now here is what my directory looks like. It is missing the android and ios directories that I will use and then run the command
yarn ios
or
yarn android
Thanks I really appreciate the help. I have never worked with react-native so if the answer is obvious please explain anyways.
yarn create react-app website
It will create website only, if you want to create react native app use
expo init AwesomeProject
or
npx create-react-app my-app
or
npx react-native init AwesomeProject
If you want to give support of web inside your react-native app, you can use react-native-web
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.
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.
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.
I need to initialize a new react native project. Recommended method to create a react native project is by using a tool called create-react-app.
But this tool comes with built in 'expo' tool-chain which omit creating ./android directory within my application root directory.
Is there a way to tell while create-react-app command to create the app without integrating "Expo" ?
Why I need this is that i want to use some external native Java libraries integrated with my react-native app.
If you want to use the new archictecure with Hermes (RN version 0.70 or later), you can run:
npx react-native#latest init AwesomeProject
Where the name of your project can replace AwesomeProject.
As they note, first make sure to remove react-native-cli if you have it installed globally.
npm uninstall -g react-native-cli #react-native-community/cli
Read more from the official docs here.