一個樣式表是一個類似于CSS樣式表的抽象體
創(chuàng)建一個新的樣式表:
var styles = StyleSheet.create({
container: {
borderRadius: 4,
borderWidth: 0.5,
borderColor: '#d6d7da',
},
title: {
fontSize: 19,
fontWeight: 'bold',
},
activeTitle: {
color: 'red',
},
});
使用樣式表:
<View style={styles.container}>
<Text style={[styles.title, this.props.isActive && styles.activeTitle]} />
</View>
代碼質(zhì)量:
性能:
static create(obj: {[key: string]: any})