React Native最佳學習模版- F8 App開源了

圖片描述

在剛剛結束的Facebook f8開發者大會不久。FB開源了本身的f8 App。react

圖片描述

界面和體驗都是至關精美的。android

React Native

項目用的本身啊的React Native,能夠同時build iOS和 Android.相信很多學習react native的人也但願看看FB團隊本身怎樣去寫App的吧。正如介紹中同樣,咱們能夠看到他們所用到的一些關鍵詞:React Native, Redux, Relay, GraphQLios

開始構建

環境須要React Native,CocoaPods 1.0+ (only for iOS),MongoDb(服務端使用)git

  1. git clone項目github

    $ git clone https://github.com/fbsamples/f8app.git
    $ cd f8app
  2. 安裝依賴 (npm v3+):mongodb

    $ npm install
    $ (cd ios; pod install)        # only for iOS version
  3. 打開mongodb 確保運行起來:npm

    $ lsof -iTCP:27017 -sTCP:LISTEN

或者使用mongo server, set DATABASE_URI:react-native

$ export DATABASE_URI=mongodb://example-mongo-hosting.com:1337/my-awesome-database
  1. 啓動 Parse/GraphQL servers:app

    $ npm start
  2. 倒入數據tcp

    $ npm run import-data

Make sure everything works by visiting:

圖片描述

  1. 運行 Android:

    $ react-native run-android
    $ adb reverse tcp:8081 tcp:8081   # required to ensure the Android app can
    $ adb reverse tcp:8080 tcp:8080   # access the Packager and GraphQL server
  1. 運行 iOS:

    $ react-native run-ios

項目地址: https://github.com/fbsamples/f8app

更多教程: http://makeitopen.com/

相關文章
相關標籤/搜索