fix radio onchange bug

Signed-off-by: yaoyuchi <yaoyuchi@huawei.com>
This commit is contained in:
yaoyuchi
2022-03-21 15:15:56 +08:00
parent 352a08ced4
commit 0b2f4ae822
2 changed files with 7 additions and 4 deletions
@@ -65,8 +65,11 @@ private:
if (refPtr) {
if (isDeclarative_) {
if (counts > 1) {
bool isChecked = refPtr->GetGroupValue() == refPtr->GetValue();
refPtr->SetGroupValue(newValue);
refPtr->UpdateGroupValue(newValue);
if (isChecked != (refPtr->GetValue() == newValue)) {
refPtr->UpdateGroupValue(newValue);
}
} else {
if (refPtr->GetOriginChecked()) {
refPtr->SetGroupValue(newValue);
@@ -147,6 +147,9 @@ bool RenderRadio::UpdateGroupValue(const std::string& groupValue)
if (valueChangeEvent_) {
valueChangeEvent_(groupValue_);
}
if (onChange_) {
onChange_(checked_);
}
return needRender;
}
@@ -175,9 +178,6 @@ void RenderRadio::HandleClick()
if (onClick_) {
onClick_();
}
if (onChange_) {
onChange_(checked_);
}
}
void RenderRadio::OffAnimationEnd()