Skip to content

Commit

Permalink
Fix overflow issue in root view
Browse files Browse the repository at this point in the history
Summary:
Set clipChildren to false by default in ReactRootView.java so that Overflow: visible/hidden will work for the root view.

Moved sDefaultOverflowHidden from ReactViewGroup.java to ViewProps.java so that it can be used in both ReactViewGroup.java and ReactRootView.java.

Reviewed By: mdvacca

Differential Revision: D8727140

fbshipit-source-id: b593bed63e479cdbd22e4a025b936e6aeb28fc8c
  • Loading branch information
Jiaqi Wu authored and facebook-github-bot committed Jul 20, 2018
1 parent d5465a9 commit 9c71952
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
10 changes: 10 additions & 0 deletions ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.facebook.react.uimanager.RootView;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.common.MeasureSpecProvider;
import com.facebook.react.uimanager.common.SizeMonitoringFrameLayout;
import com.facebook.react.uimanager.common.UIManagerType;
Expand Down Expand Up @@ -97,14 +98,23 @@ public interface ReactRootViewEventListener {

public ReactRootView(Context context) {
super(context);
init();
}

public ReactRootView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}

public ReactRootView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}

private void init() {
if (!ViewProps.sDefaultOverflowHidden) {
setClipChildren(false);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
*/
public class ViewProps {

/**
* Kill switch to make overflow hidden by default. This flag will eventually be removed.
*/
public static boolean sDefaultOverflowHidden;

public static final String VIEW_CLASS_NAME = "RCTView";

// Layout only (only affect positions of children, causes no drawing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ 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 @@ -119,7 +114,7 @@ public void onLayoutChange(
public ReactViewGroup(Context context) {
super(context);
// TODO: Remove this check after a couple public releases.
if (!sDefaultOverflowHidden) {
if (!ViewProps.sDefaultOverflowHidden) {
setClipChildren(false);
}
mDrawingOrderHelper = new ViewGroupDrawingOrderHelper(this);
Expand Down

0 comments on commit 9c71952

Please sign in to comment.