Skip to content

Commit 95afdd8

Browse files
mdvaccafacebook-github-bot
authored andcommitted
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
1 parent 04fbdd3 commit 95afdd8

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,15 @@ private static boolean isTransformedTouchPointInView(
177177
if (child instanceof ReactHitSlopView && ((ReactHitSlopView) child).getHitSlopRect() != null) {
178178
Rect hitSlopRect = ((ReactHitSlopView) child).getHitSlopRect();
179179
if ((localX >= -hitSlopRect.left && localX < (child.getRight() - child.getLeft()) + hitSlopRect.right)
180-
&& (localY >= -hitSlopRect.top && localY < (child.getBottom() - child.getTop()) + hitSlopRect.bottom)) {
180+
&& (localY >= -hitSlopRect.top && localY < (child.getBottom() - child.getTop()) + hitSlopRect.bottom)) {
181181
outLocalPoint.set(localX, localY);
182182
return true;
183183
}
184184

185185
return false;
186186
} else {
187187
if ((localX >= 0 && localX < (child.getRight() - child.getLeft()))
188-
&& (localY >= 0 && localY < (child.getBottom() - child.getTop()))) {
188+
&& (localY >= 0 && localY < (child.getBottom() - child.getTop()))) {
189189
outLocalPoint.set(localX, localY);
190190
return true;
191191
}

ReactCommon/fabric/components/view/ViewProps.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ ViewProps::ViewProps(const ViewProps &sourceProps, const RawProps &rawProps)
6767
pointerEvents(
6868
convertRawProp(rawProps, "pointerEvents", sourceProps.pointerEvents)),
6969
hitSlop(convertRawProp(rawProps, "hitSlop", sourceProps.hitSlop)),
70-
onLayout(convertRawProp(rawProps, "onLayout", sourceProps.onLayout)){};
70+
onLayout(convertRawProp(rawProps, "onLayout", sourceProps.onLayout)),
71+
collapsable(convertRawProp(
72+
rawProps,
73+
"collapsable",
74+
sourceProps.collapsable,
75+
true)){};
7176

7277
#pragma mark - Convenience Methods
7378

ReactCommon/fabric/components/view/ViewProps.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class ViewProps : public Props,
5858
const EdgeInsets hitSlop{};
5959
const bool onLayout{};
6060

61+
const bool collapsable{true};
62+
6163
#pragma mark - Convenience Methods
6264

6365
BorderMetrics resolveBorderMetrics(bool isRTL) const;

0 commit comments

Comments
 (0)