【发布时间】:2020-02-02 18:25:26
【问题描述】:
如何将我的样式作为道具传递下去?使用以下代码不显示样式道具:
容器:
<StyledText
text="Episode Overview"
backgroundStyle={[styles.opacityBackground, { margin: 0 }]}
/>
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: "column"
},
opacityBackground: { opacity: 0.8, backgroundColor: "#003333" },
});
组件
const StyledText = props => {
let { text, backgroundStyle } = props;
return (
<View style={[styles.container, { ...backgroundStyle }]}>
...
</View>
);
};
【问题讨论】:
标签: reactjs