Android:imageview support maxWidth and maxHeight

This commit is contained in:
pengfei.zhou 2020-04-11 13:01:42 +08:00 committed by osborn
parent 71154ad640
commit f66b6161b2

View File

@ -68,6 +68,19 @@ public class ImageNode extends ViewNode<ImageView> {
super(doricContext);
}
@Override
protected void blendLayoutConfig(JSObject jsObject) {
super.blendLayoutConfig(jsObject);
JSValue maxWidth = jsObject.getProperty("maxWidth");
if (maxWidth.isNumber()) {
mView.setMaxWidth(DoricUtils.dp2px(maxWidth.asNumber().toFloat()));
}
JSValue maxHeight = jsObject.getProperty("maxHeight");
if (maxHeight.isNumber()) {
mView.setMaxHeight(DoricUtils.dp2px(maxWidth.asNumber().toFloat()));
}
}
@Override
protected ImageView build() {
ImageView imageView = new ImageView(getContext());