over 2 years ago

最近討論度很高,練習一下順便紀錄

如果你沒有brew請先裝在你的Mac上

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install libraries

brew install node
brew install watchman
npm install -g react-native-cli

Create Project

react-native init ExampleReactNative

執行結果

This will walk you through creating a new React Native project in /Users/samzhu/ExampleReactNative
巴拉巴拉....略
Next steps:

   Open /Users/samzhu/ExampleReactNative/ExampleReactNative.xcodeproj in Xcode
   Hit Run button

可以用CXode開啟剛建立的專案
/Users/samzhu/ExampleReactNative/ExampleReactNative.xcodeproj

理論上你可以透過npm來啟動模擬器,但是我試不出來

cd ExampleReactNative

npm start

主要程式會在這邊
/Users/samzhu/ExampleReactNative/index.ios.js

直接修改之後你再模擬器中按CMD + R 立即刷新就可以知道效果了

Links
How to setup React Native
How to setup React Native YouTube
http://facebook.github.io/
Introducing React Native: Building Apps with JavaScript

← Spring中取得session,request等對象 Use Gradle Create New WebApp →
 
comments powered by Disqus