引用Style
三種方法引用Style
1.內部引用
render() {
return (
<View style={{flex: 1, top: 0, right: 0, left: 0, position: 'absolute', alignSelf: 'stretch' }}>
</View>
);
}
2.外部引用
render() {
return (
<View style={navBarStyles.header}>
</View>
);
}
/..
const navBarStyles = StyleSheet.create({
header:{
flex: 1,
top: 0,
right: 0,
left: 0,
position: 'absolute',
alignSelf: 'stretch',
},
});
3.混合引用
render() {
return (
<View style={[navBarStyles.header,{flex: 1, position: 'absolute', top: 0, }]}>
</View>
);
}
/..
const navBarStyles = StyleSheet.create({
header:{
right: 0,
left: 0,
alignSelf: 'stretch',
},
});