RN: Add Overflow Visible Kill Switch (Android)

Summary:
Adds a kill switch that reverts the default behavior of `overflow` to be hidden again. The intent of this kill switch is to give applications more time to migrate if necessary (e.g. if they are depending on third party packages with native components that are not compatible with `overflow` being visible by default).

To use the flag, simply set:

  import com.facebook.react.views.view.ReactViewGroup;

  // Somewhere in the initialization of your application.
  ReactViewGroup.sDefaultOverflowHidden = true;

Reviewed By: achen1

Differential Revision: D8718963

fbshipit-source-id: 0eb9aee45dfe04e9ae34d86e3bedcd30a185ef82
This commit is contained in:
Tim Yung
2018-07-03 00:24:18 -07:00
committed by Facebook Github Bot
parent c1831d50cf
commit bbdc12eda7

View File

@@ -49,6 +49,11 @@ public class ReactViewGroup extends ViewGroup implements
ReactInterceptingViewGroup, ReactClippingViewGroup, ReactPointerEventsView, ReactHitSlopView,
ReactZIndexedViewGroup {
/**
* Kill switch to make overflow hidden by default. This flag will eventually be removed.
*/
public static boolean sDefaultOverflowHidden;
private static final int ARRAY_CAPACITY_INCREMENT = 12;
private static final int DEFAULT_BACKGROUND_COLOR = Color.TRANSPARENT;
private static final LayoutParams sDefaultLayoutParam = new ViewGroup.LayoutParams(0, 0);
@@ -113,7 +118,10 @@ public class ReactViewGroup extends ViewGroup implements
public ReactViewGroup(Context context) {
super(context);
setClipChildren(false);
// TODO: Remove this check after a couple public releases.
if (!sDefaultOverflowHidden) {
setClipChildren(false);
}
mDrawingOrderHelper = new ViewGroupDrawingOrderHelper(this);
}