【发布时间】:2018-07-27 04:31:45
【问题描述】:
我想在 react native.like 中覆盖样式的一些子组件 -
我创建了一个样式CircleShapeView
const styles = StyleSheet.create({
CircleShapeView: {
width: 50,
height: 50,
borderRadius: 50/2,
backgroundColor: '#000'
},
});
我想改变backgroundColor,当我使用这种风格时。像这样的东西。
<Image
style={backgroundColor: "#fff", styles.CircleShapeView}
...
/>
什么是正确的方法?
【问题讨论】:
-
你试过
<Image style={{ ...styles.CircleShapeView, backgroundColor: "#fff" }} ... /> -
@Adolfo 这不起作用,下面的答案有效。
标签: css reactjs react-native stylesheet