viewStyle 没有得到应用。我做错了什么?我正在学习一门课程,我一行一行地写,但我的只是应用了textStyle。
我会感谢任何想法
const Header = (props) => {
const { viewStyle, textStyle } = styles;
return (
<View style={viewStyle}>
<Text style={textStyle}>{props.headerText}</Text>
</View>
);
};
const styles = {
viewStyle: {
backgroundColor: '#F8F8F8',
justifyContent: 'center',
alignItems: 'center',
height: 60,
paddingTop: 15,
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
elevation: 0.2,
position: 'relative'
},
textStyle: {
fontSize: 20
}
}
export default Header;
import {StyleSheet,View,Text} from 'react-native';
const Header = (props) => {
return (
<View style={styles.viewStyle}>
<Text style={styles.textStyle}>{props.headerText}</Text>
</View>
);
};
const styles = StyleSheet.create({
viewStyle: {
backgroundColor: '#F8F8F8',
justifyContent: 'center',
alignItems: 'center',
height: 60,
paddingTop: 15,
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
elevation: 0.2,
position: 'relative'
},
textStyle: {
fontSize: 20
}
})