React Native英文详细学习教程

    
banq 16-11-29

这是一篇英文的React Native学习教程,英文比较简单,主要以代码演示为主,从ES6到Redux非常全面,每一篇聚焦学习一个方面知识。

该教程以HelloWorld案例开始,而不是一下列出很多目录与知识,让初学者感觉难以下手,该HelloWorld代码如下:


/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/


import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';

export default class Project extends Component {
render() {
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>
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

AppRegistry.registerComponent('Project', () => Project);


上述代码在手机上显示如下内容:


Welcome to React Native!To get started, edit index.ios.jsPress Cmd+R to reload, Cmd+D or shake for dev menu


英文教程地址:
React Native Express