@react-native-ohos/react-native-reanimated 3.18.1-rc.1 → 3.18.1-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.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.OpenSource +11 -0
  3. package/README.md +10 -0
  4. package/harmony/reanimated/BuildProfile.ets +16 -16
  5. package/harmony/reanimated/build-profile.json5 +11 -11
  6. package/harmony/reanimated/oh-package.json5 +11 -11
  7. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +86 -86
  8. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +47 -47
  9. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +68 -68
  10. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +68 -68
  11. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +101 -101
  12. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +51 -51
  13. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +49 -49
  14. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +87 -87
  15. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +33 -33
  16. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +95 -95
  17. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +29 -29
  18. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +9 -9
  19. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +232 -232
  20. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +90 -90
  21. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.cpp +870 -870
  22. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +147 -147
  23. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +91 -91
  24. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +176 -176
  25. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +971 -971
  26. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +252 -252
  27. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +231 -231
  28. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +109 -109
  29. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +56 -56
  30. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +20 -20
  31. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +70 -70
  32. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +35 -35
  33. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +14 -14
  34. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +5 -5
  35. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +19 -19
  36. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +98 -98
  37. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +135 -135
  38. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +47 -47
  39. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +59 -59
  40. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +27 -27
  41. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +25 -25
  42. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +94 -94
  43. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +49 -49
  44. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +8 -8
  45. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +39 -39
  46. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +326 -326
  47. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +345 -345
  48. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +52 -52
  49. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +35 -35
  50. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +10 -10
  51. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +342 -342
  52. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +47 -47
  53. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +16 -16
  54. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +20 -20
  55. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +20 -20
  56. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +29 -29
  57. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +16 -16
  58. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +26 -26
  59. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +199 -199
  60. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +95 -95
  61. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.h +19 -19
  62. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +72 -72
  63. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -49
  64. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +20 -20
  65. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +22 -22
  66. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +29 -29
  67. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +41 -41
  68. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +16 -16
  69. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +19 -19
  70. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +112 -112
  71. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +127 -127
  72. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +53 -53
  73. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +22 -22
  74. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +191 -191
  75. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +155 -155
  76. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +90 -90
  77. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -36
  78. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +182 -182
  79. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +22 -22
  80. package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +57 -57
  81. package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +89 -89
  82. package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +3 -0
  83. package/harmony/reanimated/src/main/module.json5 +12 -12
  84. package/harmony/reanimated/src/main/resources/base/element/color.json +7 -7
  85. package/harmony/reanimated/src/main/resources/base/element/string.json +15 -15
  86. package/harmony/reanimated/src/main/resources/base/profile/main_pages.json +5 -5
  87. package/harmony/reanimated/src/main/resources/en_US/element/string.json +15 -15
  88. package/harmony/reanimated/src/main/resources/zh_CN/element/string.json +15 -15
  89. package/harmony/reanimated/ts.ts +6 -6
  90. package/harmony/reanimated.har +0 -0
  91. package/package.json +50 -50
@@ -1,252 +1,252 @@
1
- #pragma once
2
-
3
- #include <reanimated/AnimatedSensor/AnimatedSensorModule.h>
4
- #include <reanimated/LayoutAnimations/LayoutAnimationsManager.h>
5
- #include <reanimated/NativeModules/ReanimatedModuleProxySpec.h>
6
- #include <reanimated/Tools/PlatformDepMethodsHolder.h>
7
-
8
- #ifdef RCT_NEW_ARCH_ENABLED
9
- #include <reanimated/Fabric/PropsRegistry.h>
10
- #include <reanimated/Fabric/ReanimatedCommitHook.h>
11
- #include <reanimated/Fabric/ReanimatedMountHook.h>
12
- #include <reanimated/LayoutAnimations/LayoutAnimationsProxy.h>
13
- #endif // RCT_NEW_ARCH_ENABLED
14
-
15
- #include <worklets/NativeModules/WorkletsModuleProxy.h>
16
- #include <worklets/Registries/EventHandlerRegistry.h>
17
- #include <worklets/Tools/JSScheduler.h>
18
- #include <worklets/Tools/SingleInstanceChecker.h>
19
- #include <worklets/Tools/UIScheduler.h>
20
-
21
- #ifdef RCT_NEW_ARCH_ENABLED
22
- #include <react/renderer/uimanager/UIManager.h>
23
- #endif // RCT_NEW_ARCH_ENABLED
24
-
25
- #include <memory>
26
- #include <string>
27
- #include <unordered_set>
28
- #include <utility>
29
- #include <vector>
30
-
31
- namespace reanimated {
32
-
33
- using namespace facebook;
34
-
35
- class ReanimatedModuleProxy
36
- : public ReanimatedModuleProxySpec,
37
- public std::enable_shared_from_this<ReanimatedModuleProxy> {
38
- public:
39
- ReanimatedModuleProxy(
40
- const std::shared_ptr<WorkletsModuleProxy> &workletsModuleProxy,
41
- jsi::Runtime &rnRuntime,
42
- const std::shared_ptr<CallInvoker> &jsCallInvoker,
43
- const PlatformDepMethodsHolder &platformDepMethodsHolder,
44
- const bool isBridgeless,
45
- const bool isReducedMotion);
46
-
47
- // We need this init method to initialize callbacks with
48
- // weak_from_this() which is available only after the object
49
- // is fully constructed.
50
- void init(const PlatformDepMethodsHolder &platformDepMethodsHolder);
51
-
52
- void scheduleOnUI(jsi::Runtime &rt, const jsi::Value &worklet) override;
53
- jsi::Value executeOnUIRuntimeSync(jsi::Runtime &rt, const jsi::Value &worklet)
54
- override;
55
-
56
- jsi::Value createWorkletRuntime(
57
- jsi::Runtime &rt,
58
- const jsi::Value &name,
59
- const jsi::Value &initializer) override;
60
- jsi::Value scheduleOnRuntime(
61
- jsi::Runtime &rt,
62
- const jsi::Value &workletRuntimeValue,
63
- const jsi::Value &shareableWorkletValue) override;
64
-
65
- ~ReanimatedModuleProxy();
66
-
67
- jsi::Value registerEventHandler(
68
- jsi::Runtime &rt,
69
- const jsi::Value &worklet,
70
- const jsi::Value &eventName,
71
- const jsi::Value &emitterReactTag) override;
72
- void unregisterEventHandler(
73
- jsi::Runtime &rt,
74
- const jsi::Value &registrationId) override;
75
-
76
- jsi::Value getViewProp(
77
- jsi::Runtime &rt,
78
- #ifdef RCT_NEW_ARCH_ENABLED
79
- const jsi::Value &shadowNodeWrapper,
80
- #else
81
- const jsi::Value &viewTag,
82
- #endif
83
- const jsi::Value &propName,
84
- const jsi::Value &callback) override;
85
-
86
- jsi::Value enableLayoutAnimations(jsi::Runtime &rt, const jsi::Value &config)
87
- override;
88
- jsi::Value configureProps(
89
- jsi::Runtime &rt,
90
- const jsi::Value &uiProps,
91
- const jsi::Value &nativeProps) override;
92
- jsi::Value configureLayoutAnimationBatch(
93
- jsi::Runtime &rt,
94
- const jsi::Value &layoutAnimationsBatch) override;
95
- void setShouldAnimateExiting(
96
- jsi::Runtime &rt,
97
- const jsi::Value &viewTag,
98
- const jsi::Value &shouldAnimate) override;
99
-
100
- void onRender(double timestampMs);
101
-
102
- bool isAnyHandlerWaitingForEvent(
103
- const std::string &eventName,
104
- const int emitterReactTag);
105
-
106
- void maybeRequestRender();
107
-
108
- bool handleEvent(
109
- const std::string &eventName,
110
- const int emitterReactTag,
111
- const jsi::Value &payload,
112
- double currentTime);
113
-
114
- inline std::shared_ptr<JSLogger> getJSLogger() const {
115
- return jsLogger_;
116
- }
117
-
118
- #ifdef RCT_NEW_ARCH_ENABLED
119
- bool handleRawEvent(const RawEvent &rawEvent, double currentTime);
120
-
121
- void updateProps(jsi::Runtime &rt, const jsi::Value &operations);
122
-
123
- void removeFromPropsRegistry(jsi::Runtime &rt, const jsi::Value &viewTags);
124
-
125
- void performOperations();
126
-
127
- void markNodeAsRemovable(
128
- jsi::Runtime &rt,
129
- const jsi::Value &shadowNodeWrapper) override;
130
- void unmarkNodeAsRemovable(jsi::Runtime &rt, const jsi::Value &viewTag)
131
- override;
132
-
133
- void dispatchCommand(
134
- jsi::Runtime &rt,
135
- const jsi::Value &shadowNodeValue,
136
- const jsi::Value &commandNameValue,
137
- const jsi::Value &argsValue);
138
-
139
- jsi::String obtainProp(
140
- jsi::Runtime &rt,
141
- const jsi::Value &shadowNodeWrapper,
142
- const jsi::Value &propName);
143
-
144
- jsi::Value measure(jsi::Runtime &rt, const jsi::Value &shadowNodeValue);
145
-
146
- void initializeFabric(const std::shared_ptr<UIManager> &uiManager);
147
-
148
- void initializeLayoutAnimationsProxy();
149
-
150
- std::string obtainPropFromShadowNode(
151
- jsi::Runtime &rt,
152
- const std::string &propName,
153
- const ShadowNode::Shared &shadowNode);
154
-
155
- #ifdef IS_REANIMATED_EXAMPLE_APP
156
- std::function<std::string()> createRegistriesLeakCheck();
157
- #endif // IS_REANIMATED_EXAMPLE_APP
158
- #endif
159
-
160
- jsi::Value registerSensor(
161
- jsi::Runtime &rt,
162
- const jsi::Value &sensorType,
163
- const jsi::Value &interval,
164
- const jsi::Value &iosReferenceFrame,
165
- const jsi::Value &sensorDataContainer) override;
166
- void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId) override;
167
-
168
- void cleanupSensors();
169
-
170
- jsi::Value subscribeForKeyboardEvents(
171
- jsi::Runtime &rt,
172
- const jsi::Value &keyboardEventContainer,
173
- const jsi::Value &isStatusBarTranslucent,
174
- const jsi::Value &isNavigationBarTranslucent) override;
175
- void unsubscribeFromKeyboardEvents(
176
- jsi::Runtime &rt,
177
- const jsi::Value &listenerId) override;
178
-
179
- inline LayoutAnimationsManager &layoutAnimationsManager() {
180
- return *layoutAnimationsManager_;
181
- }
182
-
183
- [[nodiscard]] inline jsi::Runtime &getUIRuntime() const {
184
- return uiWorkletRuntime_->getJSIRuntime();
185
- }
186
-
187
- [[nodiscard]] inline bool isBridgeless() const {
188
- return isBridgeless_;
189
- }
190
-
191
- [[nodiscard]] inline bool isReducedMotion() const {
192
- return isReducedMotion_;
193
- }
194
-
195
- [[nodiscard]] inline std::shared_ptr<WorkletsModuleProxy>
196
- getWorkletsModuleProxy() const {
197
- return workletsModuleProxy_;
198
- }
199
-
200
- private:
201
- void requestAnimationFrame(jsi::Runtime &rt, const jsi::Value &callback);
202
-
203
- #ifdef RCT_NEW_ARCH_ENABLED
204
- jsi::Value filterNonAnimatableProps(
205
- jsi::Runtime &rt,
206
- const jsi::Value &props);
207
- #endif // RCT_NEW_ARCH_ENABLED
208
-
209
- const bool isBridgeless_;
210
- const bool isReducedMotion_;
211
- std::shared_ptr<WorkletsModuleProxy> workletsModuleProxy_;
212
- const std::string valueUnpackerCode_;
213
- std::shared_ptr<WorkletRuntime> uiWorkletRuntime_;
214
-
215
- std::unique_ptr<EventHandlerRegistry> eventHandlerRegistry_;
216
- const RequestRenderFunction requestRender_;
217
- std::vector<std::shared_ptr<jsi::Value>> frameCallbacks_;
218
- volatile bool renderRequested_{false};
219
- std::function<void(const double)> onRenderCallback_;
220
- AnimatedSensorModule animatedSensorModule_;
221
- const std::shared_ptr<JSLogger> jsLogger_;
222
- std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager_;
223
-
224
- #ifdef RCT_NEW_ARCH_ENABLED
225
- std::unordered_set<std::string>
226
- animatablePropNames_; // filled by configureProps
227
- std::shared_ptr<UIManager> uiManager_;
228
- std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy_;
229
-
230
- std::vector<std::pair<ShadowNode::Shared, std::unique_ptr<jsi::Value>>>
231
- operationsInBatch_; // TODO: refactor std::pair to custom struct
232
-
233
- std::shared_ptr<PropsRegistry> propsRegistry_;
234
- std::shared_ptr<ReanimatedCommitHook> commitHook_;
235
- std::shared_ptr<ReanimatedMountHook> mountHook_;
236
-
237
- std::vector<Tag> tagsToRemove_; // from `propsRegistry_`
238
- #else
239
- const ObtainPropFunction obtainPropFunction_;
240
- const ConfigurePropsFunction configurePropsPlatformFunction_;
241
- const UpdatePropsFunction updatePropsFunction_;
242
- #endif
243
-
244
- const KeyboardEventSubscribeFunction subscribeForKeyboardEventsFunction_;
245
- const KeyboardEventUnsubscribeFunction unsubscribeFromKeyboardEventsFunction_;
246
-
247
- #ifndef NDEBUG
248
- worklets::SingleInstanceChecker<ReanimatedModuleProxy> singleInstanceChecker_;
249
- #endif // NDEBUG
250
- };
251
-
252
- } // namespace reanimated
1
+ #pragma once
2
+
3
+ #include <reanimated/AnimatedSensor/AnimatedSensorModule.h>
4
+ #include <reanimated/LayoutAnimations/LayoutAnimationsManager.h>
5
+ #include <reanimated/NativeModules/ReanimatedModuleProxySpec.h>
6
+ #include <reanimated/Tools/PlatformDepMethodsHolder.h>
7
+
8
+ #ifdef RCT_NEW_ARCH_ENABLED
9
+ #include <reanimated/Fabric/PropsRegistry.h>
10
+ #include <reanimated/Fabric/ReanimatedCommitHook.h>
11
+ #include <reanimated/Fabric/ReanimatedMountHook.h>
12
+ #include <reanimated/LayoutAnimations/LayoutAnimationsProxy.h>
13
+ #endif // RCT_NEW_ARCH_ENABLED
14
+
15
+ #include <worklets/NativeModules/WorkletsModuleProxy.h>
16
+ #include <worklets/Registries/EventHandlerRegistry.h>
17
+ #include <worklets/Tools/JSScheduler.h>
18
+ #include <worklets/Tools/SingleInstanceChecker.h>
19
+ #include <worklets/Tools/UIScheduler.h>
20
+
21
+ #ifdef RCT_NEW_ARCH_ENABLED
22
+ #include <react/renderer/uimanager/UIManager.h>
23
+ #endif // RCT_NEW_ARCH_ENABLED
24
+
25
+ #include <memory>
26
+ #include <string>
27
+ #include <unordered_set>
28
+ #include <utility>
29
+ #include <vector>
30
+
31
+ namespace reanimated {
32
+
33
+ using namespace facebook;
34
+
35
+ class ReanimatedModuleProxy
36
+ : public ReanimatedModuleProxySpec,
37
+ public std::enable_shared_from_this<ReanimatedModuleProxy> {
38
+ public:
39
+ ReanimatedModuleProxy(
40
+ const std::shared_ptr<WorkletsModuleProxy> &workletsModuleProxy,
41
+ jsi::Runtime &rnRuntime,
42
+ const std::shared_ptr<CallInvoker> &jsCallInvoker,
43
+ const PlatformDepMethodsHolder &platformDepMethodsHolder,
44
+ const bool isBridgeless,
45
+ const bool isReducedMotion);
46
+
47
+ // We need this init method to initialize callbacks with
48
+ // weak_from_this() which is available only after the object
49
+ // is fully constructed.
50
+ void init(const PlatformDepMethodsHolder &platformDepMethodsHolder);
51
+
52
+ void scheduleOnUI(jsi::Runtime &rt, const jsi::Value &worklet) override;
53
+ jsi::Value executeOnUIRuntimeSync(jsi::Runtime &rt, const jsi::Value &worklet)
54
+ override;
55
+
56
+ jsi::Value createWorkletRuntime(
57
+ jsi::Runtime &rt,
58
+ const jsi::Value &name,
59
+ const jsi::Value &initializer) override;
60
+ jsi::Value scheduleOnRuntime(
61
+ jsi::Runtime &rt,
62
+ const jsi::Value &workletRuntimeValue,
63
+ const jsi::Value &shareableWorkletValue) override;
64
+
65
+ ~ReanimatedModuleProxy();
66
+
67
+ jsi::Value registerEventHandler(
68
+ jsi::Runtime &rt,
69
+ const jsi::Value &worklet,
70
+ const jsi::Value &eventName,
71
+ const jsi::Value &emitterReactTag) override;
72
+ void unregisterEventHandler(
73
+ jsi::Runtime &rt,
74
+ const jsi::Value &registrationId) override;
75
+
76
+ jsi::Value getViewProp(
77
+ jsi::Runtime &rt,
78
+ #ifdef RCT_NEW_ARCH_ENABLED
79
+ const jsi::Value &shadowNodeWrapper,
80
+ #else
81
+ const jsi::Value &viewTag,
82
+ #endif
83
+ const jsi::Value &propName,
84
+ const jsi::Value &callback) override;
85
+
86
+ jsi::Value enableLayoutAnimations(jsi::Runtime &rt, const jsi::Value &config)
87
+ override;
88
+ jsi::Value configureProps(
89
+ jsi::Runtime &rt,
90
+ const jsi::Value &uiProps,
91
+ const jsi::Value &nativeProps) override;
92
+ jsi::Value configureLayoutAnimationBatch(
93
+ jsi::Runtime &rt,
94
+ const jsi::Value &layoutAnimationsBatch) override;
95
+ void setShouldAnimateExiting(
96
+ jsi::Runtime &rt,
97
+ const jsi::Value &viewTag,
98
+ const jsi::Value &shouldAnimate) override;
99
+
100
+ void onRender(double timestampMs);
101
+
102
+ bool isAnyHandlerWaitingForEvent(
103
+ const std::string &eventName,
104
+ const int emitterReactTag);
105
+
106
+ void maybeRequestRender();
107
+
108
+ bool handleEvent(
109
+ const std::string &eventName,
110
+ const int emitterReactTag,
111
+ const jsi::Value &payload,
112
+ double currentTime);
113
+
114
+ inline std::shared_ptr<JSLogger> getJSLogger() const {
115
+ return jsLogger_;
116
+ }
117
+
118
+ #ifdef RCT_NEW_ARCH_ENABLED
119
+ bool handleRawEvent(const RawEvent &rawEvent, double currentTime);
120
+
121
+ void updateProps(jsi::Runtime &rt, const jsi::Value &operations);
122
+
123
+ void removeFromPropsRegistry(jsi::Runtime &rt, const jsi::Value &viewTags);
124
+
125
+ void performOperations();
126
+
127
+ void markNodeAsRemovable(
128
+ jsi::Runtime &rt,
129
+ const jsi::Value &shadowNodeWrapper) override;
130
+ void unmarkNodeAsRemovable(jsi::Runtime &rt, const jsi::Value &viewTag)
131
+ override;
132
+
133
+ void dispatchCommand(
134
+ jsi::Runtime &rt,
135
+ const jsi::Value &shadowNodeValue,
136
+ const jsi::Value &commandNameValue,
137
+ const jsi::Value &argsValue);
138
+
139
+ jsi::String obtainProp(
140
+ jsi::Runtime &rt,
141
+ const jsi::Value &shadowNodeWrapper,
142
+ const jsi::Value &propName);
143
+
144
+ jsi::Value measure(jsi::Runtime &rt, const jsi::Value &shadowNodeValue);
145
+
146
+ void initializeFabric(const std::shared_ptr<UIManager> &uiManager);
147
+
148
+ void initializeLayoutAnimationsProxy();
149
+
150
+ std::string obtainPropFromShadowNode(
151
+ jsi::Runtime &rt,
152
+ const std::string &propName,
153
+ const ShadowNode::Shared &shadowNode);
154
+
155
+ #ifdef IS_REANIMATED_EXAMPLE_APP
156
+ std::function<std::string()> createRegistriesLeakCheck();
157
+ #endif // IS_REANIMATED_EXAMPLE_APP
158
+ #endif
159
+
160
+ jsi::Value registerSensor(
161
+ jsi::Runtime &rt,
162
+ const jsi::Value &sensorType,
163
+ const jsi::Value &interval,
164
+ const jsi::Value &iosReferenceFrame,
165
+ const jsi::Value &sensorDataContainer) override;
166
+ void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId) override;
167
+
168
+ void cleanupSensors();
169
+
170
+ jsi::Value subscribeForKeyboardEvents(
171
+ jsi::Runtime &rt,
172
+ const jsi::Value &keyboardEventContainer,
173
+ const jsi::Value &isStatusBarTranslucent,
174
+ const jsi::Value &isNavigationBarTranslucent) override;
175
+ void unsubscribeFromKeyboardEvents(
176
+ jsi::Runtime &rt,
177
+ const jsi::Value &listenerId) override;
178
+
179
+ inline LayoutAnimationsManager &layoutAnimationsManager() {
180
+ return *layoutAnimationsManager_;
181
+ }
182
+
183
+ [[nodiscard]] inline jsi::Runtime &getUIRuntime() const {
184
+ return uiWorkletRuntime_->getJSIRuntime();
185
+ }
186
+
187
+ [[nodiscard]] inline bool isBridgeless() const {
188
+ return isBridgeless_;
189
+ }
190
+
191
+ [[nodiscard]] inline bool isReducedMotion() const {
192
+ return isReducedMotion_;
193
+ }
194
+
195
+ [[nodiscard]] inline std::shared_ptr<WorkletsModuleProxy>
196
+ getWorkletsModuleProxy() const {
197
+ return workletsModuleProxy_;
198
+ }
199
+
200
+ private:
201
+ void requestAnimationFrame(jsi::Runtime &rt, const jsi::Value &callback);
202
+
203
+ #ifdef RCT_NEW_ARCH_ENABLED
204
+ jsi::Value filterNonAnimatableProps(
205
+ jsi::Runtime &rt,
206
+ const jsi::Value &props);
207
+ #endif // RCT_NEW_ARCH_ENABLED
208
+
209
+ const bool isBridgeless_;
210
+ const bool isReducedMotion_;
211
+ std::shared_ptr<WorkletsModuleProxy> workletsModuleProxy_;
212
+ const std::string valueUnpackerCode_;
213
+ std::shared_ptr<WorkletRuntime> uiWorkletRuntime_;
214
+
215
+ std::unique_ptr<EventHandlerRegistry> eventHandlerRegistry_;
216
+ const RequestRenderFunction requestRender_;
217
+ std::vector<std::shared_ptr<jsi::Value>> frameCallbacks_;
218
+ volatile bool renderRequested_{false};
219
+ std::function<void(const double)> onRenderCallback_;
220
+ AnimatedSensorModule animatedSensorModule_;
221
+ const std::shared_ptr<JSLogger> jsLogger_;
222
+ std::shared_ptr<LayoutAnimationsManager> layoutAnimationsManager_;
223
+
224
+ #ifdef RCT_NEW_ARCH_ENABLED
225
+ std::unordered_set<std::string>
226
+ animatablePropNames_; // filled by configureProps
227
+ std::shared_ptr<UIManager> uiManager_;
228
+ std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy_;
229
+
230
+ std::vector<std::pair<ShadowNode::Shared, std::unique_ptr<jsi::Value>>>
231
+ operationsInBatch_; // TODO: refactor std::pair to custom struct
232
+
233
+ std::shared_ptr<PropsRegistry> propsRegistry_;
234
+ std::shared_ptr<ReanimatedCommitHook> commitHook_;
235
+ std::shared_ptr<ReanimatedMountHook> mountHook_;
236
+
237
+ std::vector<Tag> tagsToRemove_; // from `propsRegistry_`
238
+ #else
239
+ const ObtainPropFunction obtainPropFunction_;
240
+ const ConfigurePropsFunction configurePropsPlatformFunction_;
241
+ const UpdatePropsFunction updatePropsFunction_;
242
+ #endif
243
+
244
+ const KeyboardEventSubscribeFunction subscribeForKeyboardEventsFunction_;
245
+ const KeyboardEventUnsubscribeFunction unsubscribeFromKeyboardEventsFunction_;
246
+
247
+ #ifndef NDEBUG
248
+ worklets::SingleInstanceChecker<ReanimatedModuleProxy> singleInstanceChecker_;
249
+ #endif // NDEBUG
250
+ };
251
+
252
+ } // namespace reanimated