Implement RemoveClippedSubviews for Nodes

Summary:
RN has an optimization in which a ScrollView (or similar ViewGroups)
can ask to remove clipped subviews from the View hierarchy. This patch
implements this optimization for Nodes, but instead of adding and removing the
Views, it attaches and detaches Views instead.

Note that this patch does not handle overflow: visible. This is addressed in a
stacked patch on top of this patch (to simplify the review process).

Reviewed By: astreet

Differential Revision: D3235050
This commit is contained in:
Ahmed El-Helw
2016-05-13 17:49:34 -07:00
parent 96cb8165c8
commit 5f162ca119
5 changed files with 185 additions and 12 deletions

View File

@@ -13,6 +13,7 @@ import javax.annotation.Nullable;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.NoSuchNativeViewException;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.UIViewOperationQueue;
@@ -180,8 +181,15 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
@Override
public void execute() {
// Measure native View
mNativeViewHierarchyManager.measure(mReactTag, MEASURE_BUFFER);
try {
// Measure native View
mNativeViewHierarchyManager.measure(mReactTag, MEASURE_BUFFER);
} catch (NoSuchNativeViewException noSuchNativeViewException) {
// Invoke with no args to signal failure and to allow JS to clean up the callback
// handle.
mCallback.invoke();
return;
}
float nativeViewX = MEASURE_BUFFER[0];
float nativeViewY = MEASURE_BUFFER[1];