From bbdc12eda7dec135799b7f4c41fe678180970dd2 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Tue, 3 Jul 2018 00:24:18 -0700 Subject: [PATCH] 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 --- .../com/facebook/react/views/view/ReactViewGroup.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java index bdd522bd2a60ad..e8afaa93574538 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java @@ -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 void onLayoutChange( 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); }