Call __makeNative on children before __getNativeTag #46524
Closed
+1
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
There's an interesting behavior in Animated where we effectively perform an O(N + M) traversal of the Animated graph, calling
__makeNative
on each "input", which in turn tends to call__makeNative
on each "output" (so we revisit the current node M times when calling__makeNative
on the M inputs). In practice, the behavior is still O(N), because M is small and finite (most Animated nodes have 1 or 2 inputs).All that said, some platforms (e.g., react-native-windows) rely on this revisiting behavior, where on the first visit, we recurse the node to its inputs, and on the subsequent visit, we update the
_platformConfig
value without recursion (see #32736 for the original change adding platformConfig).A recent change to AnimatedWithChildren (#46286) eagerly invokes
__getNativeTag
on AnimatedWithChildren in the initial recursion step, which forces materialization of the NativeAnimated node before it's_platformConfig
is set.There is certainly some refactoring that needs to be done to improve all this, but for now, this change reverts to delay the call to
__getNativeTag
until after at least one__makeNative
occurs on an input.Differential Revision: D62768179