0 is introduced

  1. Supports ios and Android platforms
  2. Git Clone github.com/liumingmusi…
  3. CD install –> NPM install –> react-native run-ios(run-android)
  4. Server: See the instructions below for details

1.1 NPM Environment Settings

  1. Install the Node software: nodejs.org/en
  2. NPM install -g CNPM –registry = registry.npm.taobao.org
  3. Set global NPM to download resources from domestic, NPMRC to add configuration. MAC address below for/Users/liumingming /. NPMRC, modify the strict – SSL = true and registry=registry.npm.taobao.org

1.3 Organization of project files and directories

Service bin WWW // node_modules // node_modules // lib // node_modules // node_modules // App.js file has been set CSS // all ejS templates in the project CSS file data // the project does not use the database, Json // Happy Moment data JSON it. Json //IT query JSON manager.json // Manage JSON prose Lib // Third-party lib package, including common jquery, bootstrap login.js // Home page login JS file... // routes // back-end route data.js // data interaction back-end route index.js // home views // front-end page view EJS Error 404.ejs login.ejs index.ejs tuijian.ejs Edit.ejs app.js // Front main entry file package.json // configuration information, the dependency configuration part is equivalent to Java pom.xml fileCopy the code

1.6 Data Storage Port Design

Write data is a POST request (/data/write), and the parameters are passed as follows: Delete data is a POST request (/data/delete), and the parameters are passed as follows:

{new type:   type,  //Modify the resource category
        title:  title, //The article title
        url:    url,   //The article path
        img:    img    //Image path
    }Copy the code

Delete {type:   type,  //Modify the resource category
        id:     id,    //A unique id
    }Copy the code

1.8 Debugging Express Code

  1. Sudo CNPM install -g node-inspector
  2. Terminal Enter supervisor — debug. /bin/ WWW
  3. Open a new Terminal type: Node-inspector &
  4. Enter the address shown in step 3 and develop the browser access input (http://127.0.0.1:8080/? Port =5858), which is the same as debugging javascript
  5. If you do not want to use port 8080, you can modify: node-inspector & -p 8888

2. App development

2.2 File and Directory Organization

Toilet __tests__ // test file android // android compiled file common // utility class utils. Ios //ios compiled file iOS_views //ios development use components, In order to distinguish and andriod read // read module all involved components cateagory. Js // classification component list.js // list component recommend component search.js // search component topic.js // top component Setting // set componentabout.js // about componentdetail.js // details component tips.js // help.js // readPage.js // read module settingPage.js // Set the module toiletPage.js // toilet module twebview.js //webview component weatherPage.js // weather module node_modules // jar index.ios.js dependent on the third party //ios development main program entry package.json // configuration fileCopy the code

2.4 App running display


2.5 Optimized Loading

React-native bundle –entey-file index.ios.js –platform ios –dev false –bndle-output main.ios.jsbundle