mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-15 07:28:31 +08:00
Implement hit slop.
Summary: Hitslop on RTCView both virtual and non-virtual. Reviewed By: ahmedre Differential Revision: D3693412
This commit is contained in:
committed by
Ahmed El-Helw
parent
497b02ad30
commit
c3b4286915
@@ -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"))
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user