@react-native-ohos/react-native-reanimated 3.18.2 → 3.18.3

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.
Files changed (99) hide show
  1. package/LICENSE +21 -21
  2. package/README.OpenSource +10 -10
  3. package/README.md +406 -10
  4. package/harmony/reanimated/BuildProfile.ets +1 -1
  5. package/harmony/reanimated/build-profile.json5 +11 -11
  6. package/harmony/reanimated/oh-package-lock.json5 +29 -0
  7. package/harmony/reanimated/oh-package.json5 +11 -11
  8. package/harmony/reanimated/src/main/cpp/CMakeLists.txt +2 -0
  9. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +86 -86
  10. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +47 -47
  11. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +68 -68
  12. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +73 -68
  13. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +101 -101
  14. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +51 -51
  15. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +49 -49
  16. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +96 -96
  17. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +33 -33
  18. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +95 -95
  19. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +29 -29
  20. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +9 -9
  21. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +232 -232
  22. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +90 -90
  23. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.cpp +870 -870
  24. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +147 -147
  25. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +91 -91
  26. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +176 -176
  27. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +971 -971
  28. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +252 -254
  29. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +231 -231
  30. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +109 -109
  31. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +56 -56
  32. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +20 -20
  33. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +70 -70
  34. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +35 -35
  35. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +14 -14
  36. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +5 -5
  37. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +19 -19
  38. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +98 -98
  39. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +135 -135
  40. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +47 -47
  41. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +59 -59
  42. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +27 -27
  43. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +25 -25
  44. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +94 -94
  45. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +49 -49
  46. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +8 -8
  47. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +39 -39
  48. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +326 -326
  49. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +345 -345
  50. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +52 -52
  51. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +35 -35
  52. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +10 -10
  53. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +342 -342
  54. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +47 -47
  55. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +16 -16
  56. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +20 -20
  57. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +20 -20
  58. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +29 -29
  59. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +16 -16
  60. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +26 -26
  61. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +199 -199
  62. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +95 -95
  63. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.h +19 -19
  64. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +72 -72
  65. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -49
  66. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +20 -20
  67. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +22 -22
  68. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +29 -29
  69. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +41 -41
  70. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +16 -16
  71. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +19 -19
  72. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +112 -112
  73. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +127 -127
  74. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +53 -53
  75. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +22 -22
  76. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +191 -191
  77. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +173 -173
  78. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +90 -90
  79. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -36
  80. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +189 -189
  81. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +22 -22
  82. package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +29 -19
  83. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +248 -0
  84. package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +36 -0
  85. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +36 -0
  86. package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +23 -0
  87. package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +60 -60
  88. package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +89 -89
  89. package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +53 -4
  90. package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +115 -15
  91. package/harmony/reanimated/src/main/module.json5 +12 -12
  92. package/harmony/reanimated/src/main/resources/base/element/color.json +7 -7
  93. package/harmony/reanimated/src/main/resources/base/element/string.json +15 -15
  94. package/harmony/reanimated/src/main/resources/base/profile/main_pages.json +5 -5
  95. package/harmony/reanimated/src/main/resources/en_US/element/string.json +15 -15
  96. package/harmony/reanimated/src/main/resources/zh_CN/element/string.json +15 -15
  97. package/harmony/reanimated/ts.ts +6 -6
  98. package/harmony/reanimated.har +0 -0
  99. package/package.json +51 -50
@@ -1,147 +1,147 @@
1
- #pragma once
2
- #ifdef RCT_NEW_ARCH_ENABLED
3
-
4
- #include <reanimated/Fabric/PropsRegistry.h>
5
- #include <reanimated/LayoutAnimations/LayoutAnimationsManager.h>
6
- #include <reanimated/LayoutAnimations/LayoutAnimationsUtils.h>
7
-
8
- #include <worklets/Tools/UIScheduler.h>
9
-
10
- #include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
11
- #include <react/renderer/mounting/MountingOverrideDelegate.h>
12
- #include <react/renderer/mounting/ShadowView.h>
13
-
14
- #include <memory>
15
- #include <string>
16
- #include <unordered_map>
17
- #include <unordered_set>
18
- #include <vector>
19
-
20
- namespace reanimated {
21
-
22
- class ReanimatedModuleProxy;
23
-
24
- using namespace facebook;
25
-
26
- struct LayoutAnimation {
27
- #if REACT_NATIVE_MINOR_VERSION >= 78
28
- std::shared_ptr<ShadowView> finalView, currentView;
29
- Tag parentTag;
30
- #else
31
- std::shared_ptr<ShadowView> finalView, currentView, parentView;
32
- #endif // REACT_NATIVE_MINOR_VERSION >= 78
33
- std::optional<double> opacity;
34
- int count = 1;
35
- LayoutAnimation &operator=(const LayoutAnimation &other) = default;
36
- };
37
-
38
- struct LayoutAnimationsProxy
39
- : public MountingOverrideDelegate,
40
- public std::enable_shared_from_this<LayoutAnimationsProxy> {
41
- mutable std::unordered_map<Tag, std::shared_ptr<Node>> nodeForTag_;
42
- mutable std::unordered_map<Tag, LayoutAnimation> layoutAnimations_;
43
- mutable std::recursive_mutex mutex;
44
- mutable SurfaceManager surfaceManager;
45
- mutable std::unordered_set<std::shared_ptr<MutationNode>> deadNodes;
46
- mutable std::unordered_map<Tag, int> leastRemoved;
47
- std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager_;
48
- ContextContainer::Shared contextContainer_;
49
- SharedComponentDescriptorRegistry componentDescriptorRegistry_;
50
- jsi::Runtime &uiRuntime_;
51
- const std::shared_ptr<UIScheduler> uiScheduler_;
52
- LayoutAnimationsProxy(
53
- std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager,
54
- SharedComponentDescriptorRegistry componentDescriptorRegistry,
55
- ContextContainer::Shared contextContainer,
56
- jsi::Runtime &uiRuntime,
57
- const std::shared_ptr<UIScheduler> uiScheduler)
58
- : layoutAnimationsManager_(layoutAnimationsManager),
59
- contextContainer_(contextContainer),
60
- componentDescriptorRegistry_(componentDescriptorRegistry),
61
- uiRuntime_(uiRuntime),
62
- uiScheduler_(uiScheduler) {}
63
-
64
- void startEnteringAnimation(const int tag, ShadowViewMutation &mutation)
65
- const;
66
- void startExitingAnimation(const int tag, ShadowViewMutation &mutation) const;
67
- void startLayoutAnimation(const int tag, const ShadowViewMutation &mutation)
68
- const;
69
-
70
- void transferConfigFromNativeID(const std::string nativeId, const int tag)
71
- const;
72
- std::optional<SurfaceId> progressLayoutAnimation(
73
- int tag,
74
- const jsi::Object &newStyle);
75
- std::optional<SurfaceId> endLayoutAnimation(int tag, bool shouldRemove);
76
- void maybeCancelAnimation(const int tag) const;
77
-
78
- void parseRemoveMutations(
79
- std::unordered_map<Tag, ShadowView> &movedViews,
80
- ShadowViewMutationList &mutations,
81
- std::vector<std::shared_ptr<MutationNode>> &roots) const;
82
- void handleRemovals(
83
- ShadowViewMutationList &filteredMutations,
84
- std::vector<std::shared_ptr<MutationNode>> &roots) const;
85
-
86
- void handleUpdatesAndEnterings(
87
- ShadowViewMutationList &filteredMutations,
88
- const std::unordered_map<Tag, ShadowView> &movedViews,
89
- ShadowViewMutationList &mutations,
90
- const PropsParserContext &propsParserContext,
91
- SurfaceId surfaceId) const;
92
- void addOngoingAnimations(
93
- SurfaceId surfaceId,
94
- ShadowViewMutationList &mutations) const;
95
- void updateOngoingAnimationTarget(
96
- const int tag,
97
- const ShadowViewMutation &mutation) const;
98
- std::shared_ptr<ShadowView> cloneViewWithoutOpacity(
99
- facebook::react::ShadowViewMutation &mutation,
100
- const PropsParserContext &propsParserContext) const;
101
- void maybeRestoreOpacity(
102
- LayoutAnimation &layoutAnimation,
103
- const jsi::Object &newStyle) const;
104
- void maybeUpdateWindowDimensions(
105
- facebook::react::ShadowViewMutation &mutation,
106
- SurfaceId surfaceId) const;
107
- void createLayoutAnimation(
108
- const ShadowViewMutation &mutation,
109
- ShadowView &oldView,
110
- const SurfaceId &surfaceId,
111
- const int tag) const;
112
-
113
- void updateIndexForMutation(ShadowViewMutation &mutation) const;
114
-
115
- void removeRecursively(
116
- std::shared_ptr<MutationNode> node,
117
- ShadowViewMutationList &mutations) const;
118
- bool startAnimationsRecursively(
119
- std::shared_ptr<MutationNode> node,
120
- const bool shouldRemoveSubviewsWithoutAnimations,
121
- const bool shouldAnimate,
122
- const bool isScreenPop,
123
- ShadowViewMutationList &mutations) const;
124
- void endAnimationsRecursively(
125
- std::shared_ptr<MutationNode> node,
126
- ShadowViewMutationList &mutations) const;
127
- void maybeDropAncestors(
128
- std::shared_ptr<Node> node,
129
- std::shared_ptr<MutationNode> child,
130
- ShadowViewMutationList &cleanupMutations) const;
131
-
132
- const ComponentDescriptor &getComponentDescriptorForShadowView(
133
- const ShadowView &shadowView) const;
134
-
135
- // MountingOverrideDelegate
136
-
137
- bool shouldOverridePullTransaction() const override;
138
- std::optional<MountingTransaction> pullTransaction(
139
- SurfaceId surfaceId,
140
- MountingTransaction::Number number,
141
- const TransactionTelemetry &telemetry,
142
- ShadowViewMutationList mutations) const override;
143
- };
144
-
145
- } // namespace reanimated
146
-
147
- #endif // RCT_NEW_ARCH_ENABLED
1
+ #pragma once
2
+ #ifdef RCT_NEW_ARCH_ENABLED
3
+
4
+ #include <reanimated/Fabric/PropsRegistry.h>
5
+ #include <reanimated/LayoutAnimations/LayoutAnimationsManager.h>
6
+ #include <reanimated/LayoutAnimations/LayoutAnimationsUtils.h>
7
+
8
+ #include <worklets/Tools/UIScheduler.h>
9
+
10
+ #include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
11
+ #include <react/renderer/mounting/MountingOverrideDelegate.h>
12
+ #include <react/renderer/mounting/ShadowView.h>
13
+
14
+ #include <memory>
15
+ #include <string>
16
+ #include <unordered_map>
17
+ #include <unordered_set>
18
+ #include <vector>
19
+
20
+ namespace reanimated {
21
+
22
+ class ReanimatedModuleProxy;
23
+
24
+ using namespace facebook;
25
+
26
+ struct LayoutAnimation {
27
+ #if REACT_NATIVE_MINOR_VERSION >= 78
28
+ std::shared_ptr<ShadowView> finalView, currentView;
29
+ Tag parentTag;
30
+ #else
31
+ std::shared_ptr<ShadowView> finalView, currentView, parentView;
32
+ #endif // REACT_NATIVE_MINOR_VERSION >= 78
33
+ std::optional<double> opacity;
34
+ int count = 1;
35
+ LayoutAnimation &operator=(const LayoutAnimation &other) = default;
36
+ };
37
+
38
+ struct LayoutAnimationsProxy
39
+ : public MountingOverrideDelegate,
40
+ public std::enable_shared_from_this<LayoutAnimationsProxy> {
41
+ mutable std::unordered_map<Tag, std::shared_ptr<Node>> nodeForTag_;
42
+ mutable std::unordered_map<Tag, LayoutAnimation> layoutAnimations_;
43
+ mutable std::recursive_mutex mutex;
44
+ mutable SurfaceManager surfaceManager;
45
+ mutable std::unordered_set<std::shared_ptr<MutationNode>> deadNodes;
46
+ mutable std::unordered_map<Tag, int> leastRemoved;
47
+ std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager_;
48
+ ContextContainer::Shared contextContainer_;
49
+ SharedComponentDescriptorRegistry componentDescriptorRegistry_;
50
+ jsi::Runtime &uiRuntime_;
51
+ const std::shared_ptr<UIScheduler> uiScheduler_;
52
+ LayoutAnimationsProxy(
53
+ std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager,
54
+ SharedComponentDescriptorRegistry componentDescriptorRegistry,
55
+ ContextContainer::Shared contextContainer,
56
+ jsi::Runtime &uiRuntime,
57
+ const std::shared_ptr<UIScheduler> uiScheduler)
58
+ : layoutAnimationsManager_(layoutAnimationsManager),
59
+ contextContainer_(contextContainer),
60
+ componentDescriptorRegistry_(componentDescriptorRegistry),
61
+ uiRuntime_(uiRuntime),
62
+ uiScheduler_(uiScheduler) {}
63
+
64
+ void startEnteringAnimation(const int tag, ShadowViewMutation &mutation)
65
+ const;
66
+ void startExitingAnimation(const int tag, ShadowViewMutation &mutation) const;
67
+ void startLayoutAnimation(const int tag, const ShadowViewMutation &mutation)
68
+ const;
69
+
70
+ void transferConfigFromNativeID(const std::string nativeId, const int tag)
71
+ const;
72
+ std::optional<SurfaceId> progressLayoutAnimation(
73
+ int tag,
74
+ const jsi::Object &newStyle);
75
+ std::optional<SurfaceId> endLayoutAnimation(int tag, bool shouldRemove);
76
+ void maybeCancelAnimation(const int tag) const;
77
+
78
+ void parseRemoveMutations(
79
+ std::unordered_map<Tag, ShadowView> &movedViews,
80
+ ShadowViewMutationList &mutations,
81
+ std::vector<std::shared_ptr<MutationNode>> &roots) const;
82
+ void handleRemovals(
83
+ ShadowViewMutationList &filteredMutations,
84
+ std::vector<std::shared_ptr<MutationNode>> &roots) const;
85
+
86
+ void handleUpdatesAndEnterings(
87
+ ShadowViewMutationList &filteredMutations,
88
+ const std::unordered_map<Tag, ShadowView> &movedViews,
89
+ ShadowViewMutationList &mutations,
90
+ const PropsParserContext &propsParserContext,
91
+ SurfaceId surfaceId) const;
92
+ void addOngoingAnimations(
93
+ SurfaceId surfaceId,
94
+ ShadowViewMutationList &mutations) const;
95
+ void updateOngoingAnimationTarget(
96
+ const int tag,
97
+ const ShadowViewMutation &mutation) const;
98
+ std::shared_ptr<ShadowView> cloneViewWithoutOpacity(
99
+ facebook::react::ShadowViewMutation &mutation,
100
+ const PropsParserContext &propsParserContext) const;
101
+ void maybeRestoreOpacity(
102
+ LayoutAnimation &layoutAnimation,
103
+ const jsi::Object &newStyle) const;
104
+ void maybeUpdateWindowDimensions(
105
+ facebook::react::ShadowViewMutation &mutation,
106
+ SurfaceId surfaceId) const;
107
+ void createLayoutAnimation(
108
+ const ShadowViewMutation &mutation,
109
+ ShadowView &oldView,
110
+ const SurfaceId &surfaceId,
111
+ const int tag) const;
112
+
113
+ void updateIndexForMutation(ShadowViewMutation &mutation) const;
114
+
115
+ void removeRecursively(
116
+ std::shared_ptr<MutationNode> node,
117
+ ShadowViewMutationList &mutations) const;
118
+ bool startAnimationsRecursively(
119
+ std::shared_ptr<MutationNode> node,
120
+ const bool shouldRemoveSubviewsWithoutAnimations,
121
+ const bool shouldAnimate,
122
+ const bool isScreenPop,
123
+ ShadowViewMutationList &mutations) const;
124
+ void endAnimationsRecursively(
125
+ std::shared_ptr<MutationNode> node,
126
+ ShadowViewMutationList &mutations) const;
127
+ void maybeDropAncestors(
128
+ std::shared_ptr<Node> node,
129
+ std::shared_ptr<MutationNode> child,
130
+ ShadowViewMutationList &cleanupMutations) const;
131
+
132
+ const ComponentDescriptor &getComponentDescriptorForShadowView(
133
+ const ShadowView &shadowView) const;
134
+
135
+ // MountingOverrideDelegate
136
+
137
+ bool shouldOverridePullTransaction() const override;
138
+ std::optional<MountingTransaction> pullTransaction(
139
+ SurfaceId surfaceId,
140
+ MountingTransaction::Number number,
141
+ const TransactionTelemetry &telemetry,
142
+ ShadowViewMutationList mutations) const override;
143
+ };
144
+
145
+ } // namespace reanimated
146
+
147
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -1,91 +1,91 @@
1
- #ifdef RCT_NEW_ARCH_ENABLED
2
- #include <reanimated/LayoutAnimations/LayoutAnimationsUtils.h>
3
-
4
- namespace reanimated {
5
-
6
- std::unordered_map<Tag, UpdateValues> &SurfaceManager::getUpdateMap(
7
- SurfaceId surfaceId) {
8
- auto props = props_.find(surfaceId);
9
- if (props != props_.end()) {
10
- return *props->second;
11
- }
12
-
13
- auto newProps = std::make_shared<std::unordered_map<Tag, UpdateValues>>();
14
- props_.insert_or_assign(surfaceId, newProps);
15
- return *newProps;
16
- }
17
-
18
- void SurfaceManager::updateWindow(
19
- const SurfaceId surfaceId,
20
- const double windowWidth,
21
- const double windowHeight) {
22
- windows_.insert_or_assign(surfaceId, Rect{windowWidth, windowHeight});
23
- }
24
-
25
- Rect SurfaceManager::getWindow(SurfaceId surfaceId) {
26
- auto windowIt = windows_.find(surfaceId);
27
- if (windowIt != windows_.end()) {
28
- return windowIt->second;
29
- }
30
- return Rect{0, 0};
31
- }
32
-
33
- void Node::applyMutationToIndices(ShadowViewMutation mutation) {
34
- #if REACT_NATIVE_MINOR_VERSION >= 78
35
- const auto parentTag = mutation.parentTag;
36
- #else
37
- const auto parentTag = mutation.parentShadowView.tag;
38
- #endif // REACT_NATIVE_MINOR_VERSION >= 78
39
-
40
- if (tag != parentTag) {
41
- return;
42
- }
43
-
44
- int delta = mutation.type == ShadowViewMutation::Insert ? 1 : -1;
45
- for (int i = children.size() - 1; i >= 0; i--) {
46
- if (children[i]->mutation.index < mutation.index) {
47
- return;
48
- }
49
- children[i]->mutation.index += delta;
50
- }
51
- }
52
-
53
- // Should only be called on unflattened parents
54
- void Node::removeChildFromUnflattenedTree(std::shared_ptr<MutationNode> child) {
55
- for (int i = unflattenedChildren.size() - 1; i >= 0; i--) {
56
- if (unflattenedChildren[i]->tag == child->tag) {
57
- unflattenedChildren.erase(unflattenedChildren.begin() + i);
58
- break;
59
- }
60
- }
61
-
62
- auto &flattenedChildren = child->parent->children;
63
- for (int i = flattenedChildren.size() - 1; i >= 0; i--) {
64
- if (flattenedChildren[i]->tag == child->tag) {
65
- flattenedChildren.erase(flattenedChildren.begin() + i);
66
- return;
67
- }
68
- flattenedChildren[i]->mutation.index--;
69
- }
70
- }
71
-
72
- void Node::insertChildren(
73
- std::vector<std::shared_ptr<MutationNode>> &newChildren) {
74
- mergeAndSwap(children, newChildren);
75
- }
76
-
77
- void Node::insertUnflattenedChildren(
78
- std::vector<std::shared_ptr<MutationNode>> &newChildren) {
79
- mergeAndSwap(unflattenedChildren, newChildren);
80
- }
81
-
82
- bool Node::isMutationMode() {
83
- return false;
84
- }
85
-
86
- bool MutationNode::isMutationMode() {
87
- return true;
88
- }
89
- } // namespace reanimated
90
-
91
- #endif
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
+ #include <reanimated/LayoutAnimations/LayoutAnimationsUtils.h>
3
+
4
+ namespace reanimated {
5
+
6
+ std::unordered_map<Tag, UpdateValues> &SurfaceManager::getUpdateMap(
7
+ SurfaceId surfaceId) {
8
+ auto props = props_.find(surfaceId);
9
+ if (props != props_.end()) {
10
+ return *props->second;
11
+ }
12
+
13
+ auto newProps = std::make_shared<std::unordered_map<Tag, UpdateValues>>();
14
+ props_.insert_or_assign(surfaceId, newProps);
15
+ return *newProps;
16
+ }
17
+
18
+ void SurfaceManager::updateWindow(
19
+ const SurfaceId surfaceId,
20
+ const double windowWidth,
21
+ const double windowHeight) {
22
+ windows_.insert_or_assign(surfaceId, Rect{windowWidth, windowHeight});
23
+ }
24
+
25
+ Rect SurfaceManager::getWindow(SurfaceId surfaceId) {
26
+ auto windowIt = windows_.find(surfaceId);
27
+ if (windowIt != windows_.end()) {
28
+ return windowIt->second;
29
+ }
30
+ return Rect{0, 0};
31
+ }
32
+
33
+ void Node::applyMutationToIndices(ShadowViewMutation mutation) {
34
+ #if REACT_NATIVE_MINOR_VERSION >= 78
35
+ const auto parentTag = mutation.parentTag;
36
+ #else
37
+ const auto parentTag = mutation.parentShadowView.tag;
38
+ #endif // REACT_NATIVE_MINOR_VERSION >= 78
39
+
40
+ if (tag != parentTag) {
41
+ return;
42
+ }
43
+
44
+ int delta = mutation.type == ShadowViewMutation::Insert ? 1 : -1;
45
+ for (int i = children.size() - 1; i >= 0; i--) {
46
+ if (children[i]->mutation.index < mutation.index) {
47
+ return;
48
+ }
49
+ children[i]->mutation.index += delta;
50
+ }
51
+ }
52
+
53
+ // Should only be called on unflattened parents
54
+ void Node::removeChildFromUnflattenedTree(std::shared_ptr<MutationNode> child) {
55
+ for (int i = unflattenedChildren.size() - 1; i >= 0; i--) {
56
+ if (unflattenedChildren[i]->tag == child->tag) {
57
+ unflattenedChildren.erase(unflattenedChildren.begin() + i);
58
+ break;
59
+ }
60
+ }
61
+
62
+ auto &flattenedChildren = child->parent->children;
63
+ for (int i = flattenedChildren.size() - 1; i >= 0; i--) {
64
+ if (flattenedChildren[i]->tag == child->tag) {
65
+ flattenedChildren.erase(flattenedChildren.begin() + i);
66
+ return;
67
+ }
68
+ flattenedChildren[i]->mutation.index--;
69
+ }
70
+ }
71
+
72
+ void Node::insertChildren(
73
+ std::vector<std::shared_ptr<MutationNode>> &newChildren) {
74
+ mergeAndSwap(children, newChildren);
75
+ }
76
+
77
+ void Node::insertUnflattenedChildren(
78
+ std::vector<std::shared_ptr<MutationNode>> &newChildren) {
79
+ mergeAndSwap(unflattenedChildren, newChildren);
80
+ }
81
+
82
+ bool Node::isMutationMode() {
83
+ return false;
84
+ }
85
+
86
+ bool MutationNode::isMutationMode() {
87
+ return true;
88
+ }
89
+ } // namespace reanimated
90
+
91
+ #endif