RN: Revert D8666509

Summary:
Reverts D8666509. Unfortunately, I misunderstood `setClipChildren` on Android.

When set on a `ViewGroup`, `setClipChildren` configures whether its //children// — not itself — are clipped to their bounds. This is unlike `overflow` (as it behaves on iOS) which configures whether the view itself is clipped to its bounds.

But they are definitely related. In theory, I think we could implement `overflow` using `setClipChildren` by:

- Setting `setClipChildren(false)` by default. (This part, I got right.)
- When `overflow` is set to `hidden` on a `View`, we create an extra `ViewGroup` (child) within the normal `ViewGroup` (parent). Then, we can set `setClipChildren(true)` on the parent `ViewGroup` which will cause the child `ViewGroup` to be clipped to its bounds.

However, I think the tricky thing will be to create the child `ViewGroup` without incurring unintentional side effects.

I need to decide whether or not this is worth trying. The alternative is to add a new `clipChildren` boolean prop that is Android-only, but I really hate further bifurcating the platform. But for now, I am reverting my mistake.

Reviewed By: achen1

Differential Revision: D8690551

fbshipit-source-id: 1ba3bbcc5458ffbd5c475430ea0382b3fd0916b2
This commit is contained in:
Tim Yung 2018-06-29 12:06:54 -07:00 committed by Facebook Github Bot
parent d9fa1d70dc
commit f090840f45
2 changed files with 2 additions and 4 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:
return map.isNull(OVERFLOW) || map.getString(OVERFLOW) == "visible";
case OVERFLOW: // We do nothing with this right now.
return true;
default:
return false;
}

View File

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