Skip to content

Commit 6110a4c

Browse files
yungstersfacebook-github-bot
authored andcommitted
RN: Add Support for overflow on Android
Summary: Adds support for the `overflow` style property on React Native for Android. This switches overflowing views to be visible by default with the ability to override this at the container level using `overflow: 'hidden'`. This is the same behavior as React Native on iOS. One major caveat to this solution is that it uses `setClipChildren` which does not extend the hit target to the overflow draw regions. While this is a pitfall, the current state of React Native on Android where `overflow` is hidden by default (which is the opposite of iOS) is also a huge pitfall. But I think this moves us in the right direction because where you *don't* need the touch behavior, you are now able to leverage overflow draws. Reviewed By: himabindugadupudi Differential Revision: D8666509 fbshipit-source-id: 5e98e658e16188414016260224caa696b4fbd390
1 parent 0a3055d commit 6110a4c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ public static boolean isLayoutOnly(ReadableMap map, String prop) {
254254
return map.isNull(BORDER_RIGHT_WIDTH) || map.getDouble(BORDER_RIGHT_WIDTH) == 0d;
255255
case BORDER_BOTTOM_WIDTH:
256256
return map.isNull(BORDER_BOTTOM_WIDTH) || map.getDouble(BORDER_BOTTOM_WIDTH) == 0d;
257-
case OVERFLOW: // We do nothing with this right now.
258-
return true;
257+
case OVERFLOW:
258+
return map.isNull(OVERFLOW) || map.getString(OVERFLOW) == "visible";
259259
default:
260260
return false;
261261
}

ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public void onLayoutChange(
112112

113113
public ReactViewGroup(Context context) {
114114
super(context);
115+
setClipChildren(false);
115116
mDrawingOrderHelper = new ViewGroupDrawingOrderHelper(this);
116117
}
117118

@@ -638,6 +639,7 @@ public void setHitSlopRect(@Nullable Rect rect) {
638639
}
639640

640641
public void setOverflow(String overflow) {
642+
setClipChildren(mOverflow == "hidden");
641643
mOverflow = overflow;
642644
invalidate();
643645
}

0 commit comments

Comments
 (0)