首页 > 解决方案 > 如果多次使用,反应原生色轮不起作用

问题描述

我在常规安装时遇到了Invariant Violation问题,因此我将脚本作为组件导入并像下面这样使用它

import ColorWheel from '../../components/ColorWheel';

<View style={{flexDirection:'row', justifyContent: 'center'}}>
    <View style={{width:'50%', paddingHorizontal: 5}}>
        <Label style={{fontSize: 14, fontWeight: 'bold', paddingVertical: 5, textAlign: 'center'}}>COLOR (IF Any)</Label>
        <ColorWheel
            initialColor="#ffffff"
            onColorChange={color => this.onColorChange(color)}
            thumbStyle={{ height: 30, width: 30, borderRadius: 30}}
            style={{ height: 180, width: 180, elevation: 100000}}
        />
    </View>
</View>

<View style={{flexDirection:'row', justifyContent: 'center'}}>
    <View style={{width:'50%', paddingHorizontal: 5}}>
        <Label style={{fontSize: 14, fontWeight: 'bold', paddingVertical: 5, textAlign: 'center'}}>COLOR (IF Any)</Label>
        <ColorWheel
            initialColor="#ffffff"
            onColorChange={color => this.onColorChange1(color)}
            thumbStyle={{ height: 30, width: 30, borderRadius: 30}}
            style={{ height: 180, width: 180, elevation: 100000}}
        />
    </View>
</View>

如果单次使用效果很好,但我需要多次使用(5 种不同颜色使用 5 次)。然后它停止工作,如果单击图像或尝试拖动拇指,则不会发生任何事情。

提前致谢。

标签: react-nativereact-native-android

解决方案


推荐阅读