首页 > 其他 > 详细

[React Native] Up and Running

时间:2016-07-21 06:23:38      阅读:238      评论:0      收藏:0      [点我收藏+]

We‘ll download the requirements for getting started with React Native, refactor our app to ES6, walk through debugging, and talk about the philosophy behind React and React Native.

 

Install:

brew install --HEAD watchman
brew install flow

npm install -g react-native-cli

 

Create a project:

react-native init githubnotepicker

 

Run the project:

cd githubnotepicker
react-native run-ios

The simulator will pop up.

 

Enable the hot reload:

cmd + D -->  enable hot reload

After that, once you change the code, the app will reload automatically.

 

Debugger:

class githubnotetaker extends Component {
  render() {
    name="zhentian";
    debugger;
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{‘\n‘}
          Cmd+D or shake for dev menu
        </Text>
      </View>
    );
  }
}

We add a ‘debugger‘ there. "cmd + D" --> Enable remote JS debugging. 

Then refresh the page, you will see a page pop up, then open the debug tool. Then you can debug as you do on the web.

 

[React Native] Up and Running

原文:http://www.cnblogs.com/Answer1215/p/5690269.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!