Building and running a finished project on iOS - react-native

I have a project downloaded from GIT in React-Native
What steps should I take to run the application in Debug mode on iOS:
on Emulator
on my Device

Firstly, install the node_modules using npm or yarn as per the git project readme.
If your react native version is above 60, it get default cocoapods support. Move to ios folder and run pod install from commandline.
Now you have 2 options to run the project:
1. Navigate to ios folder and run the command 'react-native run-ios'.
2. Open Xcode,Navigate to ios folder and open projecname.xcworkspace file. You can see the run command on top-left of the IDE.

Related

How do i convert a React Native template into a project and run it?

This is the template i am trying to use,
https://www.instamobile.io/app-templates/food-app-template
https://github.com/instamobile/recipes-app-react-native
I have downloaded it into a folder named FoodApp and ran npm install.
Then i run npx react-native start. After that I open another command prompt and run npx react-native run-android. It shows error
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. Run CLI
with --verbose flag for more details.
This app uses the Expo toolset and requires expo-cli to be installed before it can be ran. You can install it with npm install -g expo-cli followed by expo start to run the app.

How to fix React/RCTBridgeDelegate.h' file not found

I created new project by react-native init.
but I can not run it.
gave me error React/RCTBridgeDelegate.h file not found.
react-native run-ios at terminal in mac
You are getting this error because the necessary cocoapods are not installed in the Xcode project
This is how you fix it
Navigate into your ios file in your terminal (cd > ios)
Run the command: Pod install
Navigate back to the root of your project and run it.
It should run just fine now. :)

React-native -run-ios error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65

good time.
run ios error Failed
run code
react-native run-ios
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening reactapp.xcodeproj
** BUILD FAILED **
I've got the same error when run
$ react-native run-ios
My workaround steps:
open project by Xcode and choose the signature information as the attached image.
clear build folder: 'Your Project'/ios/build
re-run:
$ react-native run-ios
Hope this help.
That's because there is a new version of Flipper and React Native might not come with the right one so best is to go in your podfile and add this use_flipper!({ 'Flipper' => '0.74.0' }) then run pod install
If you don't have cocoa pods installed you need to by command sudo gem install cocoapods and run following commands from your project main directory
cd ios
pod install
cd ..
delete build folder from ios
react-native run-ios
if error persists, 1. delete build folder again 2. open the /ios folder in x-code 3. navigate File -> Project Settings -> Build System -> change (Shared workspace settings and Per-User workspace settings): Build System -> Legacy Build System
cd ios
rm -rf build/
cd ..
react-native run-ios

react-native run-android not working on ubuntu 16.04

i have a problem with react native in ubuntu, i have installed,
java jdk 8 (both javac --version) as well as echo $JAVA_HOME gives the proper output.
I have also installed android studio and set the android environment variables as well as the tools and echo $ANDROID_HOME gives output of the sdk location.
I have also installed gradle version 4.4.
I am unable to start the android app using react-native run-android. can any one let me know if i have missed something during installation.
And react-native as well as android studio works fine as I am currently using react-native start to start the metro builder as well as the other react-native cli commands. also android studio and gradle is also able to generate debug as well as release apks with no problems.
The error i get,
Scanning folders for symlinks in /home/igate-naveed/Documents/ReactNative/mobile-app-android/node_modules (16ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
First of all you need to create a project like this:
react-native init myProjectName
Then, start an emulator from Android Studio... Afterwards:
npm install && npm start
in your project directory, and from another terminal, inside your project directory, run :
react-native run-android
Is this working?
Instead of using the npm install manager, I used yarn and it worked for me. In your project directory, just do:
(project-directory)$ yarn
Update the gradle version.
Create new project:
react-native init projectname
Uninstall the npm pack.
Reinstall the npm pack again.
npm start
react-native start
react-native run-android

Setup a cloned react-native project created via react-native init command

I have created a react-native project XYZApp using react-native init which is pushed in GitHub repo.
Now when I am cloning the project on a different system. following is the directory structure
app/XYZApp
Following is the set of commands and steps I am using.
cd app
brew install node
brew install watchman
#
npm install -g react-native-cli
#
install android studio and required SDKs
#
install X-Code
#
react-native init MyApp
prompt: Directory MyApp already exists. Continue?: (no)
I am typing - yes
npm install [all dependencies]
react-native link
Through all the above steps, some new default files are getting created which runs a default app, with some minor changes in those files I am able to run the app. But I know this is not the correct way of doing this.
I tried several other methods also,
like npm start
I checked several links but could not find the correct method for the setup after cloning.
Most of them are mentioned for create-react-native-app method.
It will be great if someone can help me regarding this.
after cloning
Don't do this
react-native init MyApp
prompt: Directory MyApp already exists. Continue?: (no)
I am typing - yes
npm install [all dependencies]
react-native link
just go to cloned app directory XYZApp and do
npm install
and all set to run the app using
react-native run-android
Update 2019 React Native 0.60.0+:
First you need to install all the node modules by running
npm install
If you're using libraries with native dependencies like react-native-gesture-handler these libraries need to be linked correctly. To do so run
react-native link
For setting up the iOS project correctly you need to install the CocoaPods dependencies:
cd ios && pod install