How to run React native program - javascript

I am trying to create a simple react native program on android. I am using this link but how can I use simulator to run any program? I am using react-native run-android but how can I proceed further ?

The command react-native run-android does not install or launch any emulator by it's own.
To use an emulator you must first install one.
Examples are Android Studio and Genymotion.
React-native has it's own instructions on how to install and run react-native on a emulator. You can find it here: Link
Follow the instructions under "Building Projects with Native Code".

Related

how to run cloned/github remote react native app, err msg no android

NOTES: Im new in react native and i see there are so many approaches and with this error i thought the developer who built this app build it differently from what i learn so i don't understand why he didn't put the android folder
so i just joined a project and im going to run the apps in my pc by cloning it from github but when i try to npx react-native run-android it failed to run and the log is like this
error Android project not found. Are you sure this is a React Native project?
If your Android files are located in a non-standard location (e.g. not inside 'android' folder),
consider setting project.android.sourceDir option to point to a new location.
info Run CLI with --verbose flag for more details.
the folder structure is like this
The files show that the project is created with Expo. Specifically, you have a managed expo project.
npx react-native run-android would compile an android app from source, with Expo's managed workflow that's not needed. You will need the Expo Go App.
Expo also comes with its own commands to start the bundler. Instead of running npx react-native ... make use of the expo-cli running: npx expo start
However, in the package.json there is very likely a script called start. In that case, it's easier for you to run npm start.
After running this command the expo console opens. Here you can press a to open the app using expo go (or instructions on how to do so).
Alternatively, you can run npx expo run:android to start the expo go app on android yourself.
you are using an expo, there is a folder named .expo-shared, after
npm install
Try to run
npm start
or
expo start
or
npx expo start
something like this will appear:
https://imgur.com/U9I7Gf4
after that go to the terminal, open the emulator in you computer and click on the terminal and press 'a',

Issue with the ios folder, after expo ejecting

I'm trying to integrate paypal payments into my expo app, but as expo not yet supports paypal i was trying the react-native-paypal package. This requires to add some extra dependencies into the ios/android folders so i was trying to eject from expo using expo eject. Note that im running this command from a windows operating system and i also did find a way to install cocoapods. But the thing is that after running expo eject it warns me that i should do this procedure from macOS or linux to get the ios folder. How else can i get this? Thanks in advance.

React-native application not opening after yarn eject

I started my small React-Native Project, by using create-react-native-app "appName", so this file will gave some boilerplate, and i used this with expo, after i completed my small app, now i need native code, So i googled and i found to make this create-react-native-app into react-native init project style, we need to use yarn eject. So i did that, but after doing this i got addition two folders in my project called "android" and "ios" its fine, But if i run my project now from my terminal.
react-native run-android
The app doesnot load into my mobile device, nor showing any error.

Steps to run a react native project in android studio after eject from create react native

What are the steps to run a react native project in android studio after eject from create react native. I didn't find a helpful step by step description online for this. I am pretty new to android development, facing different problems related to gradle versions and other stuffs in android. Do I need to run it from android studio, or just need to run the command npm run android
Install React Native using Mac OS
Please check React Native Document before start.
https://facebook.github.io/react-native/docs/getting-started.html
If you don’t have install brew in your computer then must hit that command line.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then Follow the Command step to step
brew install node
Once Complete node step up then you must Create React Native Directory in your Computer to do this follow the Following Steps:
Open Terminal and hit…
cd
cd Documents
mkdir react-native
cd react-native/
Now You create your React Native Directory now once it’s done.
Node comes with npm, which lets you install the React Native command line interface.
Run the following command in a Terminal:
npm i react-native-cli - g
it need some time to complete install once it’s done make sure you check it’s npm version to do that hit the following command line.
npm -v
So you get your version code if you are using 4.6.1 above then maybe you are using some of the problems so remove above version and use this of a version using this command line.
npm I -g npm#4.6.1
Hit enter and you start with that npm version. So it’s Done now Follow the React Native Document if you are using Android and iOS then you can follow the Steps but skip installation node step because we set up all those steps and once you are using Setup Android or Xcode in your pc Follow the Command to run React Native app.
Using your React Native Folder that you create in a directory like this
cd
cd Documents
mkdir react-native
cd react-native/
react-native init HelloWorld
Here we are Create our HelloWorld Programme Using Android Studio and React Native.
Once you have ejected you need to run below commands
exp run
react-native run-android
Make sure exp is installed. exp run will serve the js bundle locally which will be accessed when your android app runs via react-native run-android command on simulator or connected device.

JS and React Native: node.js doesn't accept 'import' keyword

I'm a beginner in using JavaScript and the framework React Native.
I have the task to program a mobile web app with React Native with another student from my class. He started to build an app, which is build without any problems on his Android Emulator. He sent me his App and node.js (my editor is JetBrains WebStorm, my partner uses the same editor) does not recognize my import react.
But when I start the app in my command line with react-native run-android everything function and I can see the app, but my problem is
that I can't run it from my editor.
I have already install those in my command line:
C:\Users\Hang>npm install -g yarn
C:\Users\Hang>npm install -g react-native-cli
What did I forget to install ?
Here is a screenshot of the message that I get when I try to run the App:
You are using Node.js Run configuration to start your application, but Node.js doesn't support ES6 modules natively (thus the Syntax erroron import), and, of course, it doesn't support react-native cli options, so running node index.android.js as you do won't start your app in android emulator. You should have used React Native run configuration instead. Please see https://blog.jetbrains.com/webstorm/2016/12/developing-mobile-apps-with-react-native-in-webstorm/, Running and debugging the app section
You have to install the react Native CLI for your IDE (webstorm)
you will find It here

Categories

Resources