mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-05 17:30:38 +08:00
Improve removeClippedSubviews for overflowing views
Summary: Historically, removeClippedSubviews for Nodes would not clip views that overflowed their parent. This patch changes that, so that Nodes can properly clip views when they are off screen (even if they have descendants that overflow the bounds of their parent). This is done by calculating a set of offsets from the actual width and height of the view, and using those in the clipping calculations. Reviewed By: sriramramani Differential Revision: D3409859
This commit is contained in:
@@ -11,6 +11,8 @@ package com.facebook.react.flat;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.NoSuchNativeViewException;
|
||||
@@ -44,19 +46,19 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
|
||||
private final @Nullable DrawCommand[] mDrawCommands;
|
||||
private final @Nullable AttachDetachListener[] mAttachDetachListeners;
|
||||
private final @Nullable NodeRegion[] mNodeRegions;
|
||||
private final boolean mHasOverflowingElements;
|
||||
private final Rect mLogicalAdjustment;
|
||||
|
||||
private UpdateMountState(
|
||||
int reactTag,
|
||||
@Nullable DrawCommand[] drawCommands,
|
||||
@Nullable AttachDetachListener[] listeners,
|
||||
@Nullable NodeRegion[] nodeRegions,
|
||||
boolean hasOverflowingElements) {
|
||||
Rect logicalAdjustment) {
|
||||
mReactTag = reactTag;
|
||||
mDrawCommands = drawCommands;
|
||||
mAttachDetachListeners = listeners;
|
||||
mNodeRegions = nodeRegions;
|
||||
mHasOverflowingElements = hasOverflowingElements;
|
||||
mLogicalAdjustment = logicalAdjustment;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +68,7 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
|
||||
mDrawCommands,
|
||||
mAttachDetachListeners,
|
||||
mNodeRegions,
|
||||
mHasOverflowingElements);
|
||||
mLogicalAdjustment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,13 +241,13 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
|
||||
@Nullable DrawCommand[] drawCommands,
|
||||
@Nullable AttachDetachListener[] listeners,
|
||||
@Nullable NodeRegion[] nodeRegions,
|
||||
boolean hasOverflowingElements) {
|
||||
Rect logicalOffset) {
|
||||
enqueueUIOperation(new UpdateMountState(
|
||||
reactTag,
|
||||
drawCommands,
|
||||
listeners,
|
||||
nodeRegions,
|
||||
hasOverflowingElements));
|
||||
logicalOffset));
|
||||
}
|
||||
|
||||
public void enqueueUpdateViewGroup(int reactTag, int[] viewsToAdd, int[] viewsToDetach) {
|
||||
|
||||
Reference in New Issue
Block a user