mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 22:23:37 +00:00
BREAKING [react_native] Don't create CSSNodes for virtual shadow nodes
Summary: @public Virtual shadow nodes (e.g. text) don't use CSSNodes so we don't need to create them. This shows large savings in CSSNodes allocated, depending on the app. This could be breaking if: - You have virtual nodes that still set and get CSS properties. The setters now no-op for virtual nodes (I unfortunately couldn't remove them completely -- see the comment on LayoutShadowNode), but the getters will NPE. If you see these NPE's, you should almost definitely be using your own datastructure instead of a CSSNode as virtual nodes will not participate in the layout process (and the CSSNode is then behaving just as a POJO for you). I do not anticipate this to be breaking for anyone, but am including breaking in the commit message since this is a change in API contract. Reviewed By: emilsjolander Differential Revision: D4220204
This commit is contained in:
parent
03ac82e387
commit
29754eb95d
@ -596,7 +596,6 @@ import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
for (int i = 0, childCount = node.getChildCount(); i != childCount; ++i) {
|
||||
ReactShadowNode child = node.getChildAt(i);
|
||||
if (child.isVirtual()) {
|
||||
markLayoutSeenRecursively(child);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -617,21 +616,6 @@ import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively walks this node and child nodes, marking the layout state as UP_TO_DATE.
|
||||
*
|
||||
* @param node The node to recur down from.
|
||||
*/
|
||||
private void markLayoutSeenRecursively(ReactShadowNode node) {
|
||||
if (node.hasNewLayout()) {
|
||||
node.markLayoutSeen();
|
||||
}
|
||||
|
||||
for (int i = 0, childCount = node.getChildCount(); i != childCount; ++i) {
|
||||
markLayoutSeenRecursively(node.getChildAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects state and enqueues View boundary updates for a given node tree. Returns true if
|
||||
* this node or any of its descendants that mount to View generated any updates.
|
||||
|
Loading…
x
Reference in New Issue
Block a user