From 94052261d1e88432754aff6c36e904e94cd1bf3b Mon Sep 17 00:00:00 2001 From: Denis Koroskin Date: Thu, 17 Dec 2015 11:24:12 -0800 Subject: [PATCH] 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 --- .../main/java/com/facebook/react/flat/RCTImageView.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTImageView.java b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTImageView.java index a50d3032f..df0f0885f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTImageView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTImageView.java @@ -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); } }