mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-15 23:03:58 +08:00
RN: Add Support for overflow on Android
Summary: Adds support for the `overflow` style property on React Native for Android. This switches overflowing views to be visible by default with the ability to override this at the container level using `overflow: 'hidden'`. This is the same behavior as React Native on iOS. One major caveat to this solution is that it uses `setClipChildren` which does not extend the hit target to the overflow draw regions. While this is a pitfall, the current state of React Native on Android where `overflow` is hidden by default (which is the opposite of iOS) is also a huge pitfall. But I think this moves us in the right direction because where you *don't* need the touch behavior, you are now able to leverage overflow draws. Reviewed By: himabindugadupudi Differential Revision: D8666509 fbshipit-source-id: 5e98e658e16188414016260224caa696b4fbd390
This commit is contained in:
committed by
Facebook Github Bot
parent
0a3055d98a
commit
6110a4cc75
@@ -254,8 +254,8 @@ public class ViewProps {
|
||||
return map.isNull(BORDER_RIGHT_WIDTH) || map.getDouble(BORDER_RIGHT_WIDTH) == 0d;
|
||||
case BORDER_BOTTOM_WIDTH:
|
||||
return map.isNull(BORDER_BOTTOM_WIDTH) || map.getDouble(BORDER_BOTTOM_WIDTH) == 0d;
|
||||
case OVERFLOW: // We do nothing with this right now.
|
||||
return true;
|
||||
case OVERFLOW:
|
||||
return map.isNull(OVERFLOW) || map.getString(OVERFLOW) == "visible";
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ public class ReactViewGroup extends ViewGroup implements
|
||||
|
||||
public ReactViewGroup(Context context) {
|
||||
super(context);
|
||||
setClipChildren(false);
|
||||
mDrawingOrderHelper = new ViewGroupDrawingOrderHelper(this);
|
||||
}
|
||||
|
||||
@@ -638,6 +639,7 @@ public class ReactViewGroup extends ViewGroup implements
|
||||
}
|
||||
|
||||
public void setOverflow(String overflow) {
|
||||
setClipChildren(mOverflow == "hidden");
|
||||
mOverflow = overflow;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user