我得到了一个奇怪的错误,简单地从内联复制和粘贴样式到StyleSheet.create方法来清理东西是没有任何意义的。它说明"bottomBorderStyle“不是有效的样式属性。它工作时,它是内联,所以这是没有意义的。如果我使用内联样式但同时保留StyleSheet,错误仍然存在,然后如果我删除StyleSheet,错误就会消失。
我已经尝试了我能想到的所有方法,以确保我没有在语法上做任何愚蠢的事情,因为我对原生反应非常陌生,我就是想不出一种方法来解释这个错误。当然,我可以只保留有效的内联样式,但我真的很想知道为什么会发生这种情况,以及我可能做错了什么。在我下面显示的几点之间,有一些代码被遗漏了。如果是相关的,我可以把剩下的内容贴出来。更新:如果我从边框属性中删除'Bottom‘部分,这个错误也会消失。
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'
},
});发布于 2019-08-31 12:49:07
按如下方式使用样式
<View style={styles.FlexContainer}></View>https://stackoverflow.com/questions/57733663
复制相似问题