From 4d25624a62d74e85d517f7e468c140f02ad18638 Mon Sep 17 00:00:00 2001 From: Ahmed El-Helw Date: Sat, 5 Mar 2016 22:40:50 -0800 Subject: [PATCH] Work around nodes touch bug for Groups Summary: This is a hack to fix the Groups dialog bug so that we can get some real data in production from using Nodes. This should be replaced with a better solution in the near future. Differential Revision: D3016859 --- .../src/main/java/com/facebook/react/flat/RCTView.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTView.java b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTView.java index 55c17e7aa..3a6da47f0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTView.java @@ -13,9 +13,9 @@ import javax.annotation.Nullable; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.uimanager.PixelUtil; +import com.facebook.react.uimanager.ViewProps; import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.annotations.ReactPropGroup; -import com.facebook.react.uimanager.ViewProps; /* package */ final class RCTView extends FlatShadowNode { @@ -59,6 +59,13 @@ import com.facebook.react.uimanager.ViewProps; @Override public void setBackgroundColor(int backgroundColor) { + // TODO t10316772 this if statement is a hack - we are mounting any transparent RCTView to an + // Android view, which is not necessary (and is inefficent). We're doing this to work around a + // bug where a non-Android view won't get touch because a View that is deeper in the hierarchy + // (i.e. will get onTouchEvent later) will handle it instead of the higher up view. + if (backgroundColor == 0) { + forceMountToView(); + } getMutableBorder().setBackgroundColor(backgroundColor); }