Introducing "collapsable" prop as part of ViewProps

Summary: This diff introduces the collapsable props in the viewProps. This prop is used in product code to prevent specific Views to be removed from the view hierarchy

Reviewed By: shergin

Differential Revision: D10254679

fbshipit-source-id: 637665b8998a86e29e839eb6d405a0fac354c8d3
This commit is contained in:
David Vacca 2018-10-09 16:30:07 -07:00 committed by Facebook Github Bot
parent 04fbdd347b
commit 95afdd8bb3
3 changed files with 10 additions and 3 deletions

View File

@ -177,7 +177,7 @@ public class TouchTargetHelper {
if (child instanceof ReactHitSlopView && ((ReactHitSlopView) child).getHitSlopRect() != null) {
Rect hitSlopRect = ((ReactHitSlopView) child).getHitSlopRect();
if ((localX >= -hitSlopRect.left && localX < (child.getRight() - child.getLeft()) + hitSlopRect.right)
&& (localY >= -hitSlopRect.top && localY < (child.getBottom() - child.getTop()) + hitSlopRect.bottom)) {
&& (localY >= -hitSlopRect.top && localY < (child.getBottom() - child.getTop()) + hitSlopRect.bottom)) {
outLocalPoint.set(localX, localY);
return true;
}
@ -185,7 +185,7 @@ public class TouchTargetHelper {
return false;
} else {
if ((localX >= 0 && localX < (child.getRight() - child.getLeft()))
&& (localY >= 0 && localY < (child.getBottom() - child.getTop()))) {
&& (localY >= 0 && localY < (child.getBottom() - child.getTop()))) {
outLocalPoint.set(localX, localY);
return true;
}

View File

@ -67,7 +67,12 @@ ViewProps::ViewProps(const ViewProps &sourceProps, const RawProps &rawProps)
pointerEvents(
convertRawProp(rawProps, "pointerEvents", sourceProps.pointerEvents)),
hitSlop(convertRawProp(rawProps, "hitSlop", sourceProps.hitSlop)),
onLayout(convertRawProp(rawProps, "onLayout", sourceProps.onLayout)){};
onLayout(convertRawProp(rawProps, "onLayout", sourceProps.onLayout)),
collapsable(convertRawProp(
rawProps,
"collapsable",
sourceProps.collapsable,
true)){};
#pragma mark - Convenience Methods

View File

@ -58,6 +58,8 @@ class ViewProps : public Props,
const EdgeInsets hitSlop{};
const bool onLayout{};
const bool collapsable{true};
#pragma mark - Convenience Methods
BorderMetrics resolveBorderMetrics(bool isRTL) const;