Fix overflow issue in root view

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
This commit is contained in:
Jiaqi Wu 2018-07-19 17:41:41 -07:00 committed by Facebook Github Bot
parent d5465a9a0a
commit 9c71952f20
3 changed files with 16 additions and 6 deletions

View File

@ -48,6 +48,7 @@ import com.facebook.react.uimanager.PixelUtil;
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;
@ -97,14 +98,23 @@ public class ReactRootView extends SizeMonitoringFrameLayout
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

View File

@ -17,6 +17,11 @@ import java.util.HashSet;
*/
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)

View File

@ -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);
@ -119,7 +114,7 @@ public class ReactViewGroup extends ViewGroup implements
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);