React Native之樣式
阿新 • • 發佈:2019-01-27
import React, {Component} from 'react';
import {AppRegistry, StyleSheet, Text, View} from 'react-native';
class HelloAndroid extends Component {
render() {
return (
<View>
<Text style={styles.red}>計算機原理</Text>
<Text style={styles.blue}>計算機系統結構</Text>
<Text style={styles.yellow}>計算機圖形學</Text>
<Text style={styles.black}>計算機網路通訊</Text>
</View>
);
}
}
const styles = StyleSheet.create(
{
blue: {
color: 'blue',
fontWeight: 'bold',
fontSize: 30,
},
red: {
color: 'red',
fontSize: 30,
fontWeight: 'bold',
},
black: {
color: 'black',
fontSize: 30 ,
fontWeight: 'bold',
},
yellow: {
color: 'yellow',
fontSize: 30,
fontWeight: 'bold',
},
}
);
AppRegistry.registerComponent('HelloAndroid', () => HelloAndroid);
執行結果: