反应本机NativeBase CheckBox不起作用

时间:2019-06-26 06:30:55

标签: react-native native-base

我正在使用:     “ native-base”:“ ^ 2.12.1”,     “ react-native”:“ 0.59.5”,

我使用了checkbox并创建了一个自定义的checkboxGroup,它正在运行。现在我想创建一个customCheckBox,但是它什么也没做,没有被检查,甚至无法更改它的颜色。

我试图按照文档所述以最简单的方式使用它,但它仍然无法使用蓝色。

这是https://pasteboard.co/Ila4cfR.png

的样子
    const CustomChBx = ({label, onPress, disabled, checked, textStyle}) => {
        const {_chbx, _label, _wrapper} = styles;
        return (
            <View style={_wrapper}>
                <Text style={[_label, textStyle]}>{label}</Text>
                <CheckBox>
                    style={_chbx}
                    checked={checked}
                    disabled={disabled}
                    onPress={onPress}
                    color={Colors.accentColor}
                </CheckBox>
            </View>
        );
    };

1 个答案:

答案 0 :(得分:0)

我复制并粘贴了此代码,然后对其进行了编辑,它可以正常工作!!

<ListItem>
    CheckBox checked={true} />
    <Body>
        <Text>Daily Stand Up</Text>
    </Body>
</ListItem>