mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add support for setChildren
Summary: This adds support for UIManager.setChildren on Android like D2757388 added for iOS. Reviewed By: andreicoman11 Differential Revision: D3235369 fb-gh-sync-id: b538556ec4abdb606f9be26d1b74734046bca0cd fbshipit-source-id: b538556ec4abdb606f9be26d1b74734046bca0cd
This commit is contained in:
committed by
Facebook Github Bot 1
parent
3f0207d7b5
commit
3a5457cd7c
+22
@@ -14,6 +14,7 @@ import javax.annotation.Nullable;
|
||||
import android.util.SparseBooleanArray;
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
|
||||
/**
|
||||
@@ -171,6 +172,27 @@ public class NativeViewHierarchyOptimizer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a setChildren call. This is a simplification of handleManagerChildren that only adds
|
||||
* children in index order of the childrenTags array
|
||||
*/
|
||||
public void handleSetChildren(
|
||||
ReactShadowNode nodeToManage,
|
||||
ReadableArray childrenTags
|
||||
) {
|
||||
if (!ENABLED) {
|
||||
mUIViewOperationQueue.enqueueSetChildren(
|
||||
nodeToManage.getReactTag(),
|
||||
childrenTags);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < childrenTags.size(); i++) {
|
||||
ReactShadowNode nodeToAdd = mShadowNodeRegistry.getNode(childrenTags.getInt(i));
|
||||
addNodeToNode(nodeToManage, nodeToAdd, i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an updateLayout call. All updateLayout calls are collected and dispatched at the end
|
||||
* of a batch because updateLayout calls to layout-only nodes can necessitate multiple
|
||||
|
||||
Reference in New Issue
Block a user