问题描述
我使用组件radio-react-native
在我的应用中创建RadioGroup
。这项工作完美,但我要当一个积极的选择{1} {},这个检查要取消选择,其实我想取消全部RedioButton
。
我将RadioButton
用于带有4个项目答案的“显示问题”。当用户决定取消选择答案时,我该如何处理并取消选择RadioGroup
所有项目。
我的代码:
导入组件
RadioButton
RodioButton代码:
import { Radio,RadioGroup,RadioButton } from "radio-react-native";
用于自定义无线电UI的ThumpsUp代码:
<RadioButton
style={{
flexGrow: 1,width: '95%',flex: 1,flexDirection: "row",marginTop: 10,padding: 5,borderBottomColor: "#f2f2f2",borderBottomWidth: 2,// backgroundColor:"red",}}
indexofq={this.getIndex(row.label,item.QuizItem,"label")}
key={row.value}
value={item.ExamQuestionId + '@' + row.value}
isFirstChecked={row.ischecked}
count_v={count_v}
>
<Radio
CustomComponent={ThumpsUp}
style={{
backgroundColor: "#000",marginTop: 30,width: responsiveWidth(16),height: responsiveWidth(16)
}}
/>
和class ThumpsUp extends Component<Props> {
constructor(props) {
super(props);
this.state = {
};
};
render() {
const { checked,} = this.props;
if (checked) {
console.log("yes-checked"+"\n");
return (
<View style={{
marginTop: 10,width: responsiveWidth(10),backgroundColor: "#49BF1E",height: responsiveWidth(10),justifyContent: "center",alignItems: "center",borderRadius: 25
}}>
<Text style={{
color: "#fff",fontFamily: font.font_black,fontSize: responsiveFontSize(2.5)
}}>
</Text>
</View>
)
}
else {
console.log("no-checked"+"\n");
return (
<View style={{
marginTop: 10,backgroundColor: "#6dcdff",fontSize: responsiveFontSize(2.5)
}}>
</Text>
</View>
)
}
}
}
部分:
RadioGroup
任何人都建议我该如何处理,谢谢您的关心
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)