The quickest way to learn any technology is to learn basic syntax and then imitate open source projects. React Native is no exception. React Native has been around for over a year, and there are so many open source projects, let’s take one as an example. Show you how to run open source projects (if you already have React Native installed).

Download open Source projects

First you need to find open source projects, such as this one. Address: https://github.com/Bob1993/react-native-gank

Log in to Github and clone to the local computer or download it directly to the local computer. According to our previous experience of running our own projects, we would directly enter the project directory on the console and type the react-native run-ios or react-native run-Android. Then we found that there was no react-native command. The reason is that most open source projects are not complete projects without project dependencies, just as we run Java without a JDK environment.

Here is a complete project:

In order to reduce space, the open source project did not submit the node_mudules directory, so we had to install it ourselves

NPM install node_modules

Node_modules is a dependency of the entire project. What does it contain? The included files are all written in package.json. This file is essential. We need to follow this list to download.

The React Native project is built using NodeJS, so all nodeJS projects require package.json files. See nodeJS for details. Learn Nodejs in seven days

Node_modules installation is very simple, go to the project directory and run the command NPM install to automatically download the dependencies according to package.json. But here’s the problem: The following errors often occur:

Most of them are due to speed problems, and some rely on or even climb the wall to download. The best way is to change the NPM download source to the domestic image, there are three ways to modify, as follows:

1. Through the config command NPM config set registry https://registry.npm.taobao.org NPM info the underscore (if there could be strings configured properly this command response)

2. The command line specifies NPM – registry https://registry.npm.taobao.org info the underscore

3. Edit the ~ /. NPMRC registry = https://registry.npm.taobao.org to join the following content

If NPM install is installed, the following message will appear:

All that’s left is to run the project.

Open Source Project Summary

https://github.com/liuhongjun719/react-native-DaidaiHelperNew lending assistant https://github.com/liuhongjun719/react-native-BabyHealth- imitation healthy baby https://github.com/nihgwu/react-native-sudoku sudoku https://github.com/CoderGLM/ReactNativeLeaning https://github.com/attentiveness/reading reading github.com/eesc88/prog… Translation of cloud client https://github.com/jiangqqlmj/GaGaMall gaga mall github.com/879479119/B… Imitation B client github.com/Shuijwan/ma… Marvel Movie Client github.com/talentjiang… Company mobile OA office client github.com/yohnz/maoya… Cat eye movie client github.com/soliury/nod… CNode Forum client github.com/Kennytian/L… Copy pull hook client github.com/SFantasy/We… IOS Sina Weibo client github.com/kailuo99/to… IOS News headlines APP github.com/xiekw2010/r… Github client github.com/iSimar/Hack… Hacker News client github.com/starzhy/The… Code farming client github.com/tabalt/Reac… News client github.com/vczero/Reac… Douban search client github.com/race604/Zhi… Zhihu Daily app

Please follow the likeDev public account on wechat for more highlights