rilyu / teaset

A UI library for react native, provides 20+ pure JS(ES6) components, focusing on content display and action control.
MIT License
2.94k stars 481 forks source link

checkBox 状态更改无效 #389

Closed s349856186 closed 4 years ago

s349856186 commented 4 years ago
                       <View >
                            <Checkbox
                                Style={{backgroundColor:'black',width:width/2}}
                                title='Meter'
                                size='lg'
                                titleStyle={{color:'white'}}
                                checked={this.state.flag}
                                onChange={(checked) =>{ this.setState({flag:true});}}
                            />
                        </View>

                        <View >
                            <Checkbox
                                Style={{backgroundColor:'black',width:width/2}}
                                title='CT'
                                size='lg'
                                titleStyle={{color:'white'}}
                                checked={!this.state.flag}
                                onChange={(checked) =>{ this.setState({flag:false});}}
                            />
                        </View>

我有两个CheckBox,想做成单选的效果,有办法吗?而且上面的代码选中的状态展示的也不对

s349856186 commented 4 years ago

搞错了,是上层组件问题