最佳答案
假设我有一个这样的渲染组件:
<View style={jewelStyle}></View>
在哪里
{
borderRadius: 10,
backgroundColor: '#FFEFCC',
width: 20,
height: 20,
},
我怎样才能使背景颜色动态和随机分配? 我试过了吗
{
borderRadius: 10,
backgroundColor: getRandomColor(),
width: 20,
height: 20,
},
但是这使得所有的视图实例都有相同的颜色,我希望每一个都是独一无二的。
有什么建议吗?