Vikash
Vikash

Reputation: 223

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.

Upvotes: 1

Views: 5025

Answers (2)

iwanuschka
iwanuschka

Reputation: 455

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

Upvotes: 0

Kranthi
Kranthi

Reputation: 1070

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

Upvotes: 4

Related Questions