Skip to content

Commit

Permalink
feat(ohos): c api - image mode fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tandyyan committed Jun 24, 2024
1 parent 9d77155 commit 95c9480
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,17 @@ bool ImageView::SetProp(const std::string &propKey, const HippyValue &propValue)
}
return true;
} else if (propKey == "resizeMode") {
auto value = HRValueUtils::GetInt32(propValue);
const HRImageResizeMode mode = (HRImageResizeMode)value;
HRImageResizeMode mode = HRImageResizeMode::Contain;
auto value = HRValueUtils::GetString(propValue);
if (value == "center") {
mode = HRImageResizeMode::Center;
} else if (value == "contain") {
mode = HRImageResizeMode::Contain;
} else if (value == "cover") {
mode = HRImageResizeMode::Cover;
} else if (value == "stretch") {
mode = HRImageResizeMode::FitXY;
}
GetLocalRootArkUINode().SetResizeMode(mode);
return true;
} else if (propKey == "defaultSource") {
Expand Down

0 comments on commit 95c9480

Please sign in to comment.