crazycodeboy / react-native-check-box

Checkbox component for react native, it works on iOS and Android.
MIT License
518 stars 184 forks source link

不支持联动单选 #23

Closed Notdefind closed 6 years ago

Notdefind commented 7 years ago

isChecked 绑定状态无效

Liqiankun commented 7 years ago

我现在不能实现单选 可能是同一个问题

Liqiankun commented 7 years ago
    onClick() {
        // this.setState({
        //     isChecked: !this.state.isChecked
        // })
        this.props.onClick();
    }

在react-native-check-box/index.js下修改就能显示单选了

Notdefind commented 7 years ago

此问题已解决 ,新增一个自定义属性进行判断

static defaultProps = { isChecked: false, isChanged: true, leftTextStyle: {}, rightTextStyle: {}, key: true, }

onClick() { if (this.props.isChanged) { this.setState({ isChecked: !this.state.isChecked }) } this.props.onClick(); }

Liqiankun commented 7 years ago

只要能解决都行!