Implement hit slop.

Summary: Hitslop on RTCView both virtual and non-virtual.

Reviewed By: ahmedre

Differential Revision: D3693412
This commit is contained in:
Seth Kirby
2016-08-11 17:40:38 -07:00
committed by Ahmed El-Helw
parent 497b02ad30
commit c3b4286915
4 changed files with 77 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ import javax.annotation.Nullable;
import java.util.Map;
import android.graphics.Rect;
import android.os.Build;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
@@ -124,4 +125,18 @@ import com.facebook.react.views.view.ReactDrawableHelper;
// default or invalid
return PointerEvents.AUTO;
}
@ReactProp(name = "hitSlop")
public void setHitSlop(FlatViewGroup view, @Nullable ReadableMap hitSlop) {
if (hitSlop == null) {
view.setHitSlopRect(null);
} else {
view.setHitSlopRect(new Rect(
(int) PixelUtil.toPixelFromDIP(hitSlop.getDouble("left")),
(int) PixelUtil.toPixelFromDIP(hitSlop.getDouble("top")),
(int) PixelUtil.toPixelFromDIP(hitSlop.getDouble("right")),
(int) PixelUtil.toPixelFromDIP(hitSlop.getDouble("bottom"))
));
}
}
}