Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RootShadowNode::Unshared ReanimatedCommitHook::shadowTreeWillCommit(
// ShadowTree not commited by Reanimated, apply updates from PropsRegistry

auto rootNode = newRootShadowNode->ShadowNode::clone(ShadowNodeFragment{});
PropsMap propsMap;
PropsMap<FollyDynamicPropsWrapper> propsMap;

{
auto lock = propsRegistry_->createLock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

namespace reanimated {

template<Derived T>
ShadowNode::Unshared cloneShadowTreeWithNewPropsRecursive(
const ChildrenMap &childrenMap,
const ShadowNode::Shared &shadowNode,
const PropsMap &propsMap) {
const PropsMap<T> &propsMap) {
const auto family = &shadowNode->getFamily();
const auto affectedChildrenIt = childrenMap.find(family);
const auto propsIt = propsMap.find(family);
Expand Down Expand Up @@ -42,9 +43,10 @@ ShadowNode::Unshared cloneShadowTreeWithNewPropsRecursive(
return result;
}

template<Derived T>
ShadowNode::Unshared cloneShadowTreeWithNewProps(
const ShadowNode::Shared &oldRootNode,
const PropsMap &propsMap) {
const PropsMap<T> &propsMap) {
ChildrenMap childrenMap;

for (auto &[family, _] : propsMap) {
Expand All @@ -68,6 +70,14 @@ ShadowNode::Unshared cloneShadowTreeWithNewProps(
childrenMap, oldRootNode, propsMap);
}

template ShadowNode::Unshared cloneShadowTreeWithNewProps(
const ShadowNode::Shared &oldRootNode,
const PropsMap<JsiValuePropsWrapper> &propsMap);

template ShadowNode::Unshared cloneShadowTreeWithNewProps(
const ShadowNode::Shared &oldRootNode,
const PropsMap<FollyDynamicPropsWrapper> &propsMap);

} // namespace reanimated

#endif // RCT_NEW_ARCH_ENABLED
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/uimanager/UIManager.h>

#include <type_traits>
#include <memory>
#include <unordered_map>
#include <vector>
Expand All @@ -15,12 +16,18 @@ using namespace react;

namespace reanimated {

using PropsMap = std::unordered_map<const ShadowNodeFamily *, std::vector<std::unique_ptr<PropsWrapper>>>;
template<class T>
concept Derived = std::is_base_of_v<PropsWrapper, T>;

template<Derived T>
using PropsMap = std::unordered_map<const ShadowNodeFamily *, std::vector<std::unique_ptr<T>>>;
Comment thread
bartlomiejbloniarz marked this conversation as resolved.
Outdated

using ChildrenMap = std::unordered_map<const ShadowNodeFamily *, std::vector<int>>;

template<Derived T>
ShadowNode::Unshared cloneShadowTreeWithNewProps(
const ShadowNode::Shared &oldRootNode,
const PropsMap &propsMap);
const PropsMap<T> &propsMap);

} // namespace reanimated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ void NativeReanimatedModule::performOperations() {
shadowTree.commit(
[&](RootShadowNode const &oldRootShadowNode)
-> RootShadowNode::Unshared {
PropsMap propsMap;
PropsMap<JsiValuePropsWrapper> propsMap;
auto rootNode =
oldRootShadowNode.ShadowNode::clone(ShadowNodeFragment{});
for (auto &[shadowNode, props] : copiedOperationsQueue) {
Expand Down