Skip to content

Commit

Permalink
RN: Add Overflow Visible Kill Switch (Android)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yungsters authored and facebook-github-bot committed Jul 3, 2018
1 parent c1831d5 commit bbdc12e
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit bbdc12e

Please sign in to comment.