Fix RCTImageView.setBorderWidth() shadowing ShadowLayoutNode.setBorderWidths()

Summary: RCTImageView.setBorderWidth() is shadowing ShadowLayoutNode.setBorderWidths() because both are annotated with `ReactProp borderWidth`. To fix the issue, override setBorder instead (which is what LayoutShadowNode.setBorderWidths delegates to).

Reviewed By: ahmedre

Differential Revision: D2763938
This commit is contained in:
Denis Koroskin 2015-12-17 11:24:12 -08:00 committed by Ahmed El-Helw
parent 529390b87c
commit 94052261d1
1 changed files with 5 additions and 4 deletions

View File

@ -15,6 +15,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import com.facebook.csslayout.Spacing;
import com.facebook.drawee.drawable.ScalingUtils.ScaleType;
import com.facebook.imagepipeline.request.ImageRequestBuilder;
import com.facebook.react.uimanager.PixelUtil;
@ -110,11 +111,11 @@ import com.facebook.react.views.image.ImageResizeMode;
}
}
@ReactProp(name = "borderWidth")
public void setBorderWidth(float borderWidth) {
borderWidth = PixelUtil.toPixelFromDIP(borderWidth);
@Override
public void setBorder(int spacingType, float borderWidth) {
super.setBorder(spacingType, borderWidth);
if (mDrawImage.getBorderWidth() != borderWidth) {
if (spacingType == Spacing.ALL && mDrawImage.getBorderWidth() != borderWidth) {
getMutableDrawImage().setBorderWidth(borderWidth);
}
}