我收到一个奇怪的错误,仅仅将样式从内联复制并粘贴到StyleSheet.create方法以清除内容并没有任何意义。它说“ bottomBorderStyle”不是有效的样式属性。在内联时它起作用了,所以这没有任何意义。如果我使用内联样式设置但还保留StyleSheet,则错误甚至仍然存在,然后如果删除StyleSheet,该错误就会消失。
我已经尝试了所有可以想到的事情,以确保我没有对语法做任何愚蠢的事情,因为我刚开始对本机做出反应,而且我只是想不出该错误有意义的方法。当然,我可以离开行内样式,但是我真的想了解为什么会发生这种情况以及我可能做错了什么。我在下面显示的两点之间遗漏了一些代码。如果相关的话,我可以发表。 更新:如果我从边框属性中删除“底部”部分,该错误也将消失。
render() {
return(
<View style={{alignItems: 'center'}}>
<View style={{
backgroundColor: 'white',
borderBottomWidth: 1,
borderBottomStyle: 'dashed',
borderBottomRadius: 10,
width: '90%',
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
</View>
);
}
}
//Error goes away if I delete from here down
const styles = StyleSheet.create( {
FlexContainer: {
backgroundColor: 'white',
borderBottomWidth: 1,
borderBottomStyle: 'dashed',
borderBottomRadius: 10,
width: '90%',
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'flex-start'
},
});
答案 0 :(得分:0)
使用以下样式
<View style={styles.FlexContainer}></View>