mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Split families by surfaceId
Differential Revision: D84055753
This commit is contained in:
committed by
meta-codesync[bot]
parent
ca5a0cc765
commit
5c94283be3
+30
-20
@@ -137,26 +137,36 @@ void AnimationBackend::stop() {
|
||||
void AnimationBackend::commitUpdatesWithFamilies(
|
||||
const std::unordered_set<const ShadowNodeFamily*>& families,
|
||||
std::unordered_map<Tag, AnimatedProps>& updates) {
|
||||
uiManager_->getShadowTreeRegistry().enumerate(
|
||||
[families, &updates](const ShadowTree& shadowTree, bool& /*stop*/) {
|
||||
shadowTree.commit(
|
||||
[families, &updates](const RootShadowNode& oldRootShadowNode) {
|
||||
return std::static_pointer_cast<RootShadowNode>(
|
||||
oldRootShadowNode.cloneMultiple(
|
||||
families,
|
||||
[families, &updates](
|
||||
const ShadowNode& shadowNode,
|
||||
const ShadowNodeFragment& fragment) {
|
||||
auto& animatedProps = updates.at(shadowNode.getTag());
|
||||
auto newProps = cloneProps(animatedProps, shadowNode);
|
||||
return shadowNode.clone(
|
||||
{newProps,
|
||||
fragment.children,
|
||||
shadowNode.getState()});
|
||||
}));
|
||||
},
|
||||
{.mountSynchronously = true});
|
||||
});
|
||||
std::unordered_map<SurfaceId, std::unordered_set<const ShadowNodeFamily*>>
|
||||
surfaceToFamilies;
|
||||
for (auto& family : families) {
|
||||
surfaceToFamilies[family->getSurfaceId()].insert(family);
|
||||
}
|
||||
for (const auto& [surfaceId, surfaceFamilies] : surfaceToFamilies) {
|
||||
uiManager_->getShadowTreeRegistry().visit(
|
||||
surfaceId,
|
||||
[surfaceFamilies = std::move(surfaceFamilies),
|
||||
&updates](const ShadowTree& shadowTree) {
|
||||
shadowTree.commit(
|
||||
[surfaceFamilies = std::move(surfaceFamilies),
|
||||
&updates](const RootShadowNode& oldRootShadowNode) {
|
||||
return std::static_pointer_cast<RootShadowNode>(
|
||||
oldRootShadowNode.cloneMultiple(
|
||||
surfaceFamilies,
|
||||
[&updates](
|
||||
const ShadowNode& shadowNode,
|
||||
const ShadowNodeFragment& fragment) {
|
||||
auto& animatedProps = updates.at(shadowNode.getTag());
|
||||
auto newProps = cloneProps(animatedProps, shadowNode);
|
||||
return shadowNode.clone(
|
||||
{newProps,
|
||||
fragment.children,
|
||||
shadowNode.getState()});
|
||||
}));
|
||||
},
|
||||
{.mountSynchronously = true});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationBackend::synchronouslyUpdateProps(
|
||||
|
||||
Reference in New Issue
Block a user