在剛剛結束的Facebook f8開發者大會不久。FB開源了本身的f8 App。react
界面和體驗都是至關精美的。android
項目用的本身啊的React Native,能夠同時build iOS和 Android.相信很多學習react native的人也但願看看FB團隊本身怎樣去寫App的吧。正如介紹中同樣,咱們能夠看到他們所用到的一些關鍵詞:React Native
, Redux
, Relay
, GraphQL
。ios
環境須要React Native,CocoaPods 1.0+ (only for iOS),MongoDb(服務端使用)git
git clone項目github
$ git clone https://github.com/fbsamples/f8app.git $ cd f8app
安裝依賴 (npm v3+):mongodb
$ npm install $ (cd ios; pod install) # only for iOS version
打開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
啓動 Parse/GraphQL servers:app
$ npm start
倒入數據tcp
$ npm run import-data
Make sure everything works by visiting:
Parse Dashboard: http://localhost:8080/dashboard
GraphiQL: http://localhost:8080/graphql
運行 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
運行 iOS:
$ react-native run-ios
項目地址: https://github.com/fbsamples/f8app
更多教程: http://makeitopen.com/