@react-native-ohos/react-native-reanimated 3.18.1-rc.5 → 3.18.2-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.OpenSource +10 -10
- package/README.md +10 -10
- package/harmony/reanimated/BuildProfile.ets +16 -16
- package/harmony/reanimated/build-profile.json5 +11 -11
- package/harmony/reanimated/oh-package.json5 +11 -11
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +1 -1
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +86 -86
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +47 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +68 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +68 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +101 -101
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +51 -51
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +49 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +96 -87
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +33 -33
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +95 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +29 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +9 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +232 -232
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +90 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.cpp +870 -870
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +147 -147
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +91 -91
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +176 -176
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +971 -971
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +252 -252
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +231 -231
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +109 -109
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +56 -56
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +70 -70
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +35 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +14 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +5 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +98 -98
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +135 -135
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +47 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +59 -59
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +27 -27
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +25 -25
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +94 -94
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +49 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +8 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +39 -39
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +326 -326
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +345 -345
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +52 -52
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +35 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +10 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +342 -342
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +47 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +16 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +29 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +16 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +26 -26
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +199 -199
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +95 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.h +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +72 -72
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +22 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +29 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +41 -41
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +16 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +112 -112
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +127 -127
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +53 -53
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +22 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +191 -191
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +173 -155
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +90 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +189 -182
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +22 -22
- package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +60 -60
- package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +89 -89
- package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +7 -0
- package/harmony/reanimated/src/main/module.json5 +12 -12
- package/harmony/reanimated/src/main/resources/base/element/color.json +7 -7
- package/harmony/reanimated/src/main/resources/base/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/reanimated/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/reanimated/ts.ts +6 -6
- package/harmony/reanimated.har +0 -0
- package/package.json +50 -50
package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp
CHANGED
|
@@ -1,87 +1,96 @@
|
|
|
1
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
-
|
|
3
|
-
#include <
|
|
4
|
-
#include <reanimated/Fabric/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const std::shared_ptr<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
propsRegistry_->
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#include <glog/logging.h>
|
|
4
|
+
#include <reanimated/Fabric/ReanimatedCommitShadowNode.h>
|
|
5
|
+
#include <reanimated/Fabric/ReanimatedMountHook.h>
|
|
6
|
+
|
|
7
|
+
namespace reanimated {
|
|
8
|
+
|
|
9
|
+
ReanimatedMountHook::ReanimatedMountHook(
|
|
10
|
+
const std::shared_ptr<PropsRegistry> &propsRegistry,
|
|
11
|
+
const std::shared_ptr<UIManager> &uiManager)
|
|
12
|
+
: propsRegistry_(propsRegistry), uiManager_(uiManager) {
|
|
13
|
+
uiManager_->registerMountHook(*this);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
ReanimatedMountHook::~ReanimatedMountHook() noexcept {
|
|
17
|
+
uiManager_->unregisterMountHook(*this);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void ReanimatedMountHook::shadowTreeDidMount(
|
|
21
|
+
const RootShadowNode::Shared &rootShadowNode,
|
|
22
|
+
double) noexcept {
|
|
23
|
+
auto reaShadowNode =
|
|
24
|
+
std::reinterpret_pointer_cast<ReanimatedCommitShadowNode>(
|
|
25
|
+
std::const_pointer_cast<RootShadowNode>(rootShadowNode));
|
|
26
|
+
|
|
27
|
+
if (reaShadowNode->hasReanimatedMountTrait()) {
|
|
28
|
+
// We mark reanimated commits with ReanimatedMountTrait. We don't want other
|
|
29
|
+
// shadow nodes to use this trait, but since this rootShadowNode is Shared,
|
|
30
|
+
// we don't have that guarantee. That's why we also unset this trait in the
|
|
31
|
+
// commit hook. We remove it here mainly for the sake of cleanliness.
|
|
32
|
+
reaShadowNode->unsetReanimatedMountTrait();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
{
|
|
37
|
+
auto lock = propsRegistry_->createLock();
|
|
38
|
+
propsRegistry_->handleNodeRemovals(*rootShadowNode);
|
|
39
|
+
|
|
40
|
+
// When commit from React Native has finished, we reset the skip commit flag
|
|
41
|
+
// in order to allow Reanimated to commit its tree
|
|
42
|
+
propsRegistry_->unpauseReanimatedCommits();
|
|
43
|
+
if (!propsRegistry_->shouldCommitAfterPause()) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const auto &shadowTreeRegistry = uiManager_->getShadowTreeRegistry();
|
|
50
|
+
shadowTreeRegistry.visit(
|
|
51
|
+
rootShadowNode->getSurfaceId(), [=](ShadowTree const &shadowTree) {
|
|
52
|
+
shadowTree.commit(
|
|
53
|
+
[=](RootShadowNode const &oldRootShadowNode)
|
|
54
|
+
-> RootShadowNode::Unshared {
|
|
55
|
+
PropsMap propsMap;
|
|
56
|
+
|
|
57
|
+
RootShadowNode::Unshared rootNode =
|
|
58
|
+
std::static_pointer_cast<RootShadowNode>(
|
|
59
|
+
oldRootShadowNode.ShadowNode::clone({}));
|
|
60
|
+
|
|
61
|
+
if (rootNode) {
|
|
62
|
+
auto lock = propsRegistry_->createLock();
|
|
63
|
+
|
|
64
|
+
if (!propsRegistry_->isEmpty()) {
|
|
65
|
+
propsRegistry_->for_each([&](const ShadowNodeFamily &family,
|
|
66
|
+
const folly::dynamic &props) {
|
|
67
|
+
propsMap[&family].emplace_back(props);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
rootNode = cloneShadowTreeWithNewProps(oldRootShadowNode, propsMap);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (rootNode) {
|
|
75
|
+
auto reaShadowNode =
|
|
76
|
+
std::reinterpret_pointer_cast<ReanimatedCommitShadowNode>(
|
|
77
|
+
rootNode);
|
|
78
|
+
reaShadowNode->setReanimatedCommitTrait();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return rootNode;
|
|
82
|
+
},
|
|
83
|
+
{/* .enableStateReconciliation = */
|
|
84
|
+
false,
|
|
85
|
+
/* .mountSynchronously = */ true});
|
|
86
|
+
});
|
|
87
|
+
} catch (const std::exception &e) {
|
|
88
|
+
LOG(ERROR) << "ReanimatedMountHook::shadowTreeDidMount error: " << e.what();
|
|
89
|
+
} catch (...) {
|
|
90
|
+
LOG(ERROR) << "ReanimatedMountHook::shadowTreeDidMount unknown error";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
} // namespace reanimated
|
|
95
|
+
|
|
96
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
|
-
|
|
4
|
-
#include <reanimated/Fabric/PropsRegistry.h>
|
|
5
|
-
#include <reanimated/Fabric/ShadowTreeCloner.h>
|
|
6
|
-
|
|
7
|
-
#include <react/renderer/uimanager/UIManagerMountHook.h>
|
|
8
|
-
|
|
9
|
-
#include <memory>
|
|
10
|
-
|
|
11
|
-
namespace reanimated {
|
|
12
|
-
|
|
13
|
-
using namespace facebook::react;
|
|
14
|
-
|
|
15
|
-
class ReanimatedMountHook : public UIManagerMountHook {
|
|
16
|
-
public:
|
|
17
|
-
ReanimatedMountHook(
|
|
18
|
-
const std::shared_ptr<PropsRegistry> &propsRegistry,
|
|
19
|
-
const std::shared_ptr<UIManager> &uiManager);
|
|
20
|
-
~ReanimatedMountHook() noexcept override;
|
|
21
|
-
|
|
22
|
-
void shadowTreeDidMount(
|
|
23
|
-
RootShadowNode::Shared const &rootShadowNode,
|
|
24
|
-
double mountTime) noexcept override;
|
|
25
|
-
|
|
26
|
-
private:
|
|
27
|
-
const std::shared_ptr<PropsRegistry> propsRegistry_;
|
|
28
|
-
const std::shared_ptr<UIManager> uiManager_;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
} // namespace reanimated
|
|
32
|
-
|
|
33
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
1
|
+
#pragma once
|
|
2
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
|
+
|
|
4
|
+
#include <reanimated/Fabric/PropsRegistry.h>
|
|
5
|
+
#include <reanimated/Fabric/ShadowTreeCloner.h>
|
|
6
|
+
|
|
7
|
+
#include <react/renderer/uimanager/UIManagerMountHook.h>
|
|
8
|
+
|
|
9
|
+
#include <memory>
|
|
10
|
+
|
|
11
|
+
namespace reanimated {
|
|
12
|
+
|
|
13
|
+
using namespace facebook::react;
|
|
14
|
+
|
|
15
|
+
class ReanimatedMountHook : public UIManagerMountHook {
|
|
16
|
+
public:
|
|
17
|
+
ReanimatedMountHook(
|
|
18
|
+
const std::shared_ptr<PropsRegistry> &propsRegistry,
|
|
19
|
+
const std::shared_ptr<UIManager> &uiManager);
|
|
20
|
+
~ReanimatedMountHook() noexcept override;
|
|
21
|
+
|
|
22
|
+
void shadowTreeDidMount(
|
|
23
|
+
RootShadowNode::Shared const &rootShadowNode,
|
|
24
|
+
double mountTime) noexcept override;
|
|
25
|
+
|
|
26
|
+
private:
|
|
27
|
+
const std::shared_ptr<PropsRegistry> propsRegistry_;
|
|
28
|
+
const std::shared_ptr<UIManager> uiManager_;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
} // namespace reanimated
|
|
32
|
+
|
|
33
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
-
|
|
3
|
-
#include <reanimated/Fabric/ShadowTreeCloner.h>
|
|
4
|
-
|
|
5
|
-
#include <ranges>
|
|
6
|
-
#include <utility>
|
|
7
|
-
|
|
8
|
-
namespace reanimated {
|
|
9
|
-
|
|
10
|
-
Props::Shared mergeProps(
|
|
11
|
-
const ShadowNode &shadowNode,
|
|
12
|
-
const PropsMap &propsMap,
|
|
13
|
-
const ShadowNodeFamily &family) {
|
|
14
|
-
const auto it = propsMap.find(&family);
|
|
15
|
-
|
|
16
|
-
if (it == propsMap.end()) {
|
|
17
|
-
return ShadowNodeFragment::propsPlaceholder();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
PropsParserContext propsParserContext{
|
|
21
|
-
shadowNode.getSurfaceId(), *shadowNode.getContextContainer()};
|
|
22
|
-
const auto &propsVector = it->second;
|
|
23
|
-
auto newProps = shadowNode.getProps();
|
|
24
|
-
|
|
25
|
-
#ifdef ANDROID
|
|
26
|
-
if (propsVector.size() > 1) {
|
|
27
|
-
folly::dynamic newPropsDynamic = folly::dynamic::object;
|
|
28
|
-
for (const auto &props : propsVector) {
|
|
29
|
-
newPropsDynamic = folly::dynamic::merge(
|
|
30
|
-
props.operator folly::dynamic(), newPropsDynamic);
|
|
31
|
-
}
|
|
32
|
-
return shadowNode.getComponentDescriptor().cloneProps(
|
|
33
|
-
propsParserContext, newProps, RawProps(newPropsDynamic));
|
|
34
|
-
}
|
|
35
|
-
#endif
|
|
36
|
-
|
|
37
|
-
for (const auto &props : propsVector) {
|
|
38
|
-
newProps = shadowNode.getComponentDescriptor().cloneProps(
|
|
39
|
-
propsParserContext, newProps, RawProps(props));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return newProps;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
ShadowNode::Unshared cloneShadowTreeWithNewPropsRecursive(
|
|
46
|
-
const ShadowNode &shadowNode,
|
|
47
|
-
const ChildrenMap &childrenMap,
|
|
48
|
-
const PropsMap &propsMap) {
|
|
49
|
-
const auto family = &shadowNode.getFamily();
|
|
50
|
-
const auto affectedChildrenIt = childrenMap.find(family);
|
|
51
|
-
auto children = shadowNode.getChildren();
|
|
52
|
-
|
|
53
|
-
if (affectedChildrenIt != childrenMap.end()) {
|
|
54
|
-
for (const auto index : affectedChildrenIt->second) {
|
|
55
|
-
children[index] = cloneShadowTreeWithNewPropsRecursive(
|
|
56
|
-
*children[index], childrenMap, propsMap);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return shadowNode.clone(
|
|
61
|
-
{mergeProps(shadowNode, propsMap, *family),
|
|
62
|
-
std::make_shared<ShadowNode::ListOfShared>(children),
|
|
63
|
-
shadowNode.getState()});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
RootShadowNode::Unshared cloneShadowTreeWithNewProps(
|
|
67
|
-
const RootShadowNode &oldRootNode,
|
|
68
|
-
const PropsMap &propsMap) {
|
|
69
|
-
ChildrenMap childrenMap;
|
|
70
|
-
|
|
71
|
-
for (auto &[family, _] : propsMap) {
|
|
72
|
-
const auto ancestors = family->getAncestors(oldRootNode);
|
|
73
|
-
|
|
74
|
-
for (const auto &[parentNode, index] :
|
|
75
|
-
std::ranges::reverse_view(ancestors)) {
|
|
76
|
-
const auto parentFamily = &parentNode.get().getFamily();
|
|
77
|
-
auto &affectedChildren = childrenMap[parentFamily];
|
|
78
|
-
|
|
79
|
-
if (affectedChildren.contains(index)) {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
affectedChildren.insert(index);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// This cast is safe, because this function returns a clone
|
|
88
|
-
// of the oldRootNode, which is an instance of RootShadowNode
|
|
89
|
-
return std::static_pointer_cast<RootShadowNode>(
|
|
90
|
-
cloneShadowTreeWithNewPropsRecursive(oldRootNode, childrenMap, propsMap));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
} // namespace reanimated
|
|
94
|
-
|
|
95
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#include <reanimated/Fabric/ShadowTreeCloner.h>
|
|
4
|
+
|
|
5
|
+
#include <ranges>
|
|
6
|
+
#include <utility>
|
|
7
|
+
|
|
8
|
+
namespace reanimated {
|
|
9
|
+
|
|
10
|
+
Props::Shared mergeProps(
|
|
11
|
+
const ShadowNode &shadowNode,
|
|
12
|
+
const PropsMap &propsMap,
|
|
13
|
+
const ShadowNodeFamily &family) {
|
|
14
|
+
const auto it = propsMap.find(&family);
|
|
15
|
+
|
|
16
|
+
if (it == propsMap.end()) {
|
|
17
|
+
return ShadowNodeFragment::propsPlaceholder();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
PropsParserContext propsParserContext{
|
|
21
|
+
shadowNode.getSurfaceId(), *shadowNode.getContextContainer()};
|
|
22
|
+
const auto &propsVector = it->second;
|
|
23
|
+
auto newProps = shadowNode.getProps();
|
|
24
|
+
|
|
25
|
+
#ifdef ANDROID
|
|
26
|
+
if (propsVector.size() > 1) {
|
|
27
|
+
folly::dynamic newPropsDynamic = folly::dynamic::object;
|
|
28
|
+
for (const auto &props : propsVector) {
|
|
29
|
+
newPropsDynamic = folly::dynamic::merge(
|
|
30
|
+
props.operator folly::dynamic(), newPropsDynamic);
|
|
31
|
+
}
|
|
32
|
+
return shadowNode.getComponentDescriptor().cloneProps(
|
|
33
|
+
propsParserContext, newProps, RawProps(newPropsDynamic));
|
|
34
|
+
}
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
for (const auto &props : propsVector) {
|
|
38
|
+
newProps = shadowNode.getComponentDescriptor().cloneProps(
|
|
39
|
+
propsParserContext, newProps, RawProps(props));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return newProps;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ShadowNode::Unshared cloneShadowTreeWithNewPropsRecursive(
|
|
46
|
+
const ShadowNode &shadowNode,
|
|
47
|
+
const ChildrenMap &childrenMap,
|
|
48
|
+
const PropsMap &propsMap) {
|
|
49
|
+
const auto family = &shadowNode.getFamily();
|
|
50
|
+
const auto affectedChildrenIt = childrenMap.find(family);
|
|
51
|
+
auto children = shadowNode.getChildren();
|
|
52
|
+
|
|
53
|
+
if (affectedChildrenIt != childrenMap.end()) {
|
|
54
|
+
for (const auto index : affectedChildrenIt->second) {
|
|
55
|
+
children[index] = cloneShadowTreeWithNewPropsRecursive(
|
|
56
|
+
*children[index], childrenMap, propsMap);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return shadowNode.clone(
|
|
61
|
+
{mergeProps(shadowNode, propsMap, *family),
|
|
62
|
+
std::make_shared<ShadowNode::ListOfShared>(children),
|
|
63
|
+
shadowNode.getState()});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
RootShadowNode::Unshared cloneShadowTreeWithNewProps(
|
|
67
|
+
const RootShadowNode &oldRootNode,
|
|
68
|
+
const PropsMap &propsMap) {
|
|
69
|
+
ChildrenMap childrenMap;
|
|
70
|
+
|
|
71
|
+
for (auto &[family, _] : propsMap) {
|
|
72
|
+
const auto ancestors = family->getAncestors(oldRootNode);
|
|
73
|
+
|
|
74
|
+
for (const auto &[parentNode, index] :
|
|
75
|
+
std::ranges::reverse_view(ancestors)) {
|
|
76
|
+
const auto parentFamily = &parentNode.get().getFamily();
|
|
77
|
+
auto &affectedChildren = childrenMap[parentFamily];
|
|
78
|
+
|
|
79
|
+
if (affectedChildren.contains(index)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
affectedChildren.insert(index);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// This cast is safe, because this function returns a clone
|
|
88
|
+
// of the oldRootNode, which is an instance of RootShadowNode
|
|
89
|
+
return std::static_pointer_cast<RootShadowNode>(
|
|
90
|
+
cloneShadowTreeWithNewPropsRecursive(oldRootNode, childrenMap, propsMap));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
} // namespace reanimated
|
|
94
|
+
|
|
95
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
|
-
|
|
4
|
-
#include <react/renderer/core/PropsParserContext.h>
|
|
5
|
-
#include <react/renderer/uimanager/UIManager.h>
|
|
6
|
-
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <type_traits>
|
|
9
|
-
#include <unordered_map>
|
|
10
|
-
#include <unordered_set>
|
|
11
|
-
#include <vector>
|
|
12
|
-
|
|
13
|
-
using namespace facebook;
|
|
14
|
-
using namespace react;
|
|
15
|
-
|
|
16
|
-
namespace reanimated {
|
|
17
|
-
|
|
18
|
-
using PropsMap =
|
|
19
|
-
std::unordered_map<const ShadowNodeFamily *, std::vector<RawProps>>;
|
|
20
|
-
using ChildrenMap =
|
|
21
|
-
std::unordered_map<const ShadowNodeFamily *, std::unordered_set<int>>;
|
|
22
|
-
|
|
23
|
-
RootShadowNode::Unshared cloneShadowTreeWithNewProps(
|
|
24
|
-
const RootShadowNode &oldRootNode,
|
|
25
|
-
const PropsMap &propsMap);
|
|
26
|
-
|
|
27
|
-
} // namespace reanimated
|
|
28
|
-
|
|
29
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
1
|
+
#pragma once
|
|
2
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
|
+
|
|
4
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
5
|
+
#include <react/renderer/uimanager/UIManager.h>
|
|
6
|
+
|
|
7
|
+
#include <memory>
|
|
8
|
+
#include <type_traits>
|
|
9
|
+
#include <unordered_map>
|
|
10
|
+
#include <unordered_set>
|
|
11
|
+
#include <vector>
|
|
12
|
+
|
|
13
|
+
using namespace facebook;
|
|
14
|
+
using namespace react;
|
|
15
|
+
|
|
16
|
+
namespace reanimated {
|
|
17
|
+
|
|
18
|
+
using PropsMap =
|
|
19
|
+
std::unordered_map<const ShadowNodeFamily *, std::vector<RawProps>>;
|
|
20
|
+
using ChildrenMap =
|
|
21
|
+
std::unordered_map<const ShadowNodeFamily *, std::unordered_set<int>>;
|
|
22
|
+
|
|
23
|
+
RootShadowNode::Unshared cloneShadowTreeWithNewProps(
|
|
24
|
+
const RootShadowNode &oldRootNode,
|
|
25
|
+
const PropsMap &propsMap);
|
|
26
|
+
|
|
27
|
+
} // namespace reanimated
|
|
28
|
+
|
|
29
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
typedef enum LayoutAnimationType {
|
|
4
|
-
ENTERING = 1,
|
|
5
|
-
EXITING = 2,
|
|
6
|
-
LAYOUT = 3,
|
|
7
|
-
SHARED_ELEMENT_TRANSITION = 4,
|
|
8
|
-
SHARED_ELEMENT_TRANSITION_PROGRESS = 5,
|
|
9
|
-
} LayoutAnimationType;
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
typedef enum LayoutAnimationType {
|
|
4
|
+
ENTERING = 1,
|
|
5
|
+
EXITING = 2,
|
|
6
|
+
LAYOUT = 3,
|
|
7
|
+
SHARED_ELEMENT_TRANSITION = 4,
|
|
8
|
+
SHARED_ELEMENT_TRANSITION_PROGRESS = 5,
|
|
9
|
+
} LayoutAnimationType;
|