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
This commit is contained in:
Tim Yung 2018-06-28 01:16:43 -07:00 committed by Facebook Github Bot
parent 0a3055d98a
commit 6110a4cc75
2 changed files with 4 additions and 2 deletions

View File

@ -254,8 +254,8 @@ public class ViewProps {
return map.isNull(BORDER_RIGHT_WIDTH) || map.getDouble(BORDER_RIGHT_WIDTH) == 0d;
case BORDER_BOTTOM_WIDTH:
return map.isNull(BORDER_BOTTOM_WIDTH) || map.getDouble(BORDER_BOTTOM_WIDTH) == 0d;
case OVERFLOW: // We do nothing with this right now.
return true;
case OVERFLOW:
return map.isNull(OVERFLOW) || map.getString(OVERFLOW) == "visible";
default:
return false;
}

View File

@ -112,6 +112,7 @@ public class ReactViewGroup extends ViewGroup implements
public ReactViewGroup(Context context) {
super(context);
setClipChildren(false);
mDrawingOrderHelper = new ViewGroupDrawingOrderHelper(this);
}
@ -638,6 +639,7 @@ public class ReactViewGroup extends ViewGroup implements
}
public void setOverflow(String overflow) {
setClipChildren(mOverflow == "hidden");
mOverflow = overflow;
invalidate();
}