@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.
Files changed (92) hide show
  1. package/LICENSE +21 -21
  2. package/README.OpenSource +10 -10
  3. package/README.md +10 -10
  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/CMakeLists.txt +1 -1
  8. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +86 -86
  9. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +47 -47
  10. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +68 -68
  11. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +68 -68
  12. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +101 -101
  13. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +51 -51
  14. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +49 -49
  15. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +96 -87
  16. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +33 -33
  17. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +95 -95
  18. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +29 -29
  19. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +9 -9
  20. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +232 -232
  21. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +90 -90
  22. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.cpp +870 -870
  23. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +147 -147
  24. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +91 -91
  25. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +176 -176
  26. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +971 -971
  27. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +252 -252
  28. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +231 -231
  29. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +109 -109
  30. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +56 -56
  31. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +20 -20
  32. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +70 -70
  33. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +35 -35
  34. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +14 -14
  35. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +5 -5
  36. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +19 -19
  37. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +98 -98
  38. package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +135 -135
  39. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +47 -47
  40. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +59 -59
  41. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +27 -27
  42. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +25 -25
  43. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +94 -94
  44. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +49 -49
  45. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +8 -8
  46. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +39 -39
  47. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +326 -326
  48. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +345 -345
  49. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +52 -52
  50. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +35 -35
  51. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +10 -10
  52. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +342 -342
  53. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +47 -47
  54. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +16 -16
  55. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +20 -20
  56. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +20 -20
  57. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +29 -29
  58. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +16 -16
  59. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +26 -26
  60. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +199 -199
  61. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +95 -95
  62. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.h +19 -19
  63. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +72 -72
  64. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -49
  65. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +20 -20
  66. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +22 -22
  67. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +29 -29
  68. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +41 -41
  69. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +16 -16
  70. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +19 -19
  71. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +112 -112
  72. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +127 -127
  73. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +53 -53
  74. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +22 -22
  75. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +191 -191
  76. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +173 -155
  77. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +90 -90
  78. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -36
  79. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +189 -182
  80. package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +22 -22
  81. package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +60 -60
  82. package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +89 -89
  83. package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +7 -0
  84. package/harmony/reanimated/src/main/module.json5 +12 -12
  85. package/harmony/reanimated/src/main/resources/base/element/color.json +7 -7
  86. package/harmony/reanimated/src/main/resources/base/element/string.json +15 -15
  87. package/harmony/reanimated/src/main/resources/base/profile/main_pages.json +5 -5
  88. package/harmony/reanimated/src/main/resources/en_US/element/string.json +15 -15
  89. package/harmony/reanimated/src/main/resources/zh_CN/element/string.json +15 -15
  90. package/harmony/reanimated/ts.ts +6 -6
  91. package/harmony/reanimated.har +0 -0
  92. package/package.json +50 -50
@@ -1,109 +1,109 @@
1
- #pragma once
2
-
3
- #include <ReactCommon/CallInvoker.h>
4
- #include <ReactCommon/TurboModule.h>
5
-
6
- #include <memory>
7
- #include <string>
8
- #include <vector>
9
-
10
- using namespace facebook;
11
- using namespace react;
12
-
13
- namespace reanimated {
14
-
15
- class JSI_EXPORT ReanimatedModuleProxySpec : public TurboModule {
16
- protected:
17
- explicit ReanimatedModuleProxySpec(
18
- const std::shared_ptr<CallInvoker> &jsInvoker);
19
-
20
- public:
21
- // Scheduling
22
- virtual void scheduleOnUI(jsi::Runtime &rt, const jsi::Value &worklet) = 0;
23
- virtual jsi::Value executeOnUIRuntimeSync(
24
- jsi::Runtime &rt,
25
- const jsi::Value &worklet) = 0;
26
-
27
- // Worklet runtime
28
- virtual jsi::Value createWorkletRuntime(
29
- jsi::Runtime &rt,
30
- const jsi::Value &name,
31
- const jsi::Value &initializer) = 0;
32
- virtual jsi::Value scheduleOnRuntime(
33
- jsi::Runtime &rt,
34
- const jsi::Value &workletRuntimeValue,
35
- const jsi::Value &shareableWorkletValue) = 0;
36
-
37
- // events
38
- virtual jsi::Value registerEventHandler(
39
- jsi::Runtime &rt,
40
- const jsi::Value &worklet,
41
- const jsi::Value &eventName,
42
- const jsi::Value &emitterReactTag) = 0;
43
- virtual void unregisterEventHandler(
44
- jsi::Runtime &rt,
45
- const jsi::Value &registrationId) = 0;
46
-
47
- // views
48
- virtual jsi::Value getViewProp(
49
- jsi::Runtime &rt,
50
- #ifdef RCT_NEW_ARCH_ENABLED
51
- const jsi::Value &shadowNodeWrapper,
52
- #else
53
- const jsi::Value &viewTag,
54
- #endif
55
- const jsi::Value &propName,
56
- const jsi::Value &callback) = 0;
57
-
58
- // sensors
59
- virtual jsi::Value registerSensor(
60
- jsi::Runtime &rt,
61
- const jsi::Value &sensorType,
62
- const jsi::Value &interval,
63
- const jsi::Value &iosReferenceFrame,
64
- const jsi::Value &sensorDataContainer) = 0;
65
- virtual void unregisterSensor(
66
- jsi::Runtime &rt,
67
- const jsi::Value &sensorId) = 0;
68
-
69
- // keyboard
70
- virtual jsi::Value subscribeForKeyboardEvents(
71
- jsi::Runtime &rt,
72
- const jsi::Value &keyboardEventContainer,
73
- const jsi::Value &isStatusBarTranslucent,
74
- const jsi::Value &isNavigationBarTranslucent) = 0;
75
- virtual void unsubscribeFromKeyboardEvents(
76
- jsi::Runtime &rt,
77
- const jsi::Value &listenerId) = 0;
78
-
79
- // other
80
- virtual jsi::Value enableLayoutAnimations(
81
- jsi::Runtime &rt,
82
- const jsi::Value &config) = 0;
83
- virtual jsi::Value configureProps(
84
- jsi::Runtime &rt,
85
- const jsi::Value &uiProps,
86
- const jsi::Value &nativeProps) = 0;
87
-
88
- // layout animations
89
- virtual jsi::Value configureLayoutAnimationBatch(
90
- jsi::Runtime &rt,
91
- const jsi::Value &layoutAnimationsBatch) = 0;
92
-
93
- virtual void setShouldAnimateExiting(
94
- jsi::Runtime &rt,
95
- const jsi::Value &viewTag,
96
- const jsi::Value &shouldAnimate) = 0;
97
-
98
- #ifdef RCT_NEW_ARCH_ENABLED
99
- // Cleanup
100
- virtual void markNodeAsRemovable(
101
- jsi::Runtime &rt,
102
- const jsi::Value &shadowNodeWrapper) = 0;
103
- virtual void unmarkNodeAsRemovable(
104
- jsi::Runtime &rt,
105
- const jsi::Value &viewTag) = 0;
106
- #endif // RCT_NEW_ARCH_ENABLED
107
- };
108
-
109
- } // namespace reanimated
1
+ #pragma once
2
+
3
+ #include <ReactCommon/CallInvoker.h>
4
+ #include <ReactCommon/TurboModule.h>
5
+
6
+ #include <memory>
7
+ #include <string>
8
+ #include <vector>
9
+
10
+ using namespace facebook;
11
+ using namespace react;
12
+
13
+ namespace reanimated {
14
+
15
+ class JSI_EXPORT ReanimatedModuleProxySpec : public TurboModule {
16
+ protected:
17
+ explicit ReanimatedModuleProxySpec(
18
+ const std::shared_ptr<CallInvoker> &jsInvoker);
19
+
20
+ public:
21
+ // Scheduling
22
+ virtual void scheduleOnUI(jsi::Runtime &rt, const jsi::Value &worklet) = 0;
23
+ virtual jsi::Value executeOnUIRuntimeSync(
24
+ jsi::Runtime &rt,
25
+ const jsi::Value &worklet) = 0;
26
+
27
+ // Worklet runtime
28
+ virtual jsi::Value createWorkletRuntime(
29
+ jsi::Runtime &rt,
30
+ const jsi::Value &name,
31
+ const jsi::Value &initializer) = 0;
32
+ virtual jsi::Value scheduleOnRuntime(
33
+ jsi::Runtime &rt,
34
+ const jsi::Value &workletRuntimeValue,
35
+ const jsi::Value &shareableWorkletValue) = 0;
36
+
37
+ // events
38
+ virtual jsi::Value registerEventHandler(
39
+ jsi::Runtime &rt,
40
+ const jsi::Value &worklet,
41
+ const jsi::Value &eventName,
42
+ const jsi::Value &emitterReactTag) = 0;
43
+ virtual void unregisterEventHandler(
44
+ jsi::Runtime &rt,
45
+ const jsi::Value &registrationId) = 0;
46
+
47
+ // views
48
+ virtual jsi::Value getViewProp(
49
+ jsi::Runtime &rt,
50
+ #ifdef RCT_NEW_ARCH_ENABLED
51
+ const jsi::Value &shadowNodeWrapper,
52
+ #else
53
+ const jsi::Value &viewTag,
54
+ #endif
55
+ const jsi::Value &propName,
56
+ const jsi::Value &callback) = 0;
57
+
58
+ // sensors
59
+ virtual jsi::Value registerSensor(
60
+ jsi::Runtime &rt,
61
+ const jsi::Value &sensorType,
62
+ const jsi::Value &interval,
63
+ const jsi::Value &iosReferenceFrame,
64
+ const jsi::Value &sensorDataContainer) = 0;
65
+ virtual void unregisterSensor(
66
+ jsi::Runtime &rt,
67
+ const jsi::Value &sensorId) = 0;
68
+
69
+ // keyboard
70
+ virtual jsi::Value subscribeForKeyboardEvents(
71
+ jsi::Runtime &rt,
72
+ const jsi::Value &keyboardEventContainer,
73
+ const jsi::Value &isStatusBarTranslucent,
74
+ const jsi::Value &isNavigationBarTranslucent) = 0;
75
+ virtual void unsubscribeFromKeyboardEvents(
76
+ jsi::Runtime &rt,
77
+ const jsi::Value &listenerId) = 0;
78
+
79
+ // other
80
+ virtual jsi::Value enableLayoutAnimations(
81
+ jsi::Runtime &rt,
82
+ const jsi::Value &config) = 0;
83
+ virtual jsi::Value configureProps(
84
+ jsi::Runtime &rt,
85
+ const jsi::Value &uiProps,
86
+ const jsi::Value &nativeProps) = 0;
87
+
88
+ // layout animations
89
+ virtual jsi::Value configureLayoutAnimationBatch(
90
+ jsi::Runtime &rt,
91
+ const jsi::Value &layoutAnimationsBatch) = 0;
92
+
93
+ virtual void setShouldAnimateExiting(
94
+ jsi::Runtime &rt,
95
+ const jsi::Value &viewTag,
96
+ const jsi::Value &shouldAnimate) = 0;
97
+
98
+ #ifdef RCT_NEW_ARCH_ENABLED
99
+ // Cleanup
100
+ virtual void markNodeAsRemovable(
101
+ jsi::Runtime &rt,
102
+ const jsi::Value &shadowNodeWrapper) = 0;
103
+ virtual void unmarkNodeAsRemovable(
104
+ jsi::Runtime &rt,
105
+ const jsi::Value &viewTag) = 0;
106
+ #endif // RCT_NEW_ARCH_ENABLED
107
+ };
108
+
109
+ } // namespace reanimated
@@ -1,56 +1,56 @@
1
- #include <reanimated/RuntimeDecorators/RNRuntimeDecorator.h>
2
- #include <worklets/Tools/ReanimatedJSIUtils.h>
3
- #include <worklets/Tools/ReanimatedVersion.h>
4
-
5
- namespace reanimated {
6
-
7
- void RNRuntimeDecorator::decorate(
8
- jsi::Runtime &rnRuntime,
9
- const std::shared_ptr<ReanimatedModuleProxy> &reanimatedModuleProxy) {
10
- jsi::Runtime &uiRuntime = reanimatedModuleProxy->getUIRuntime();
11
- auto workletRuntimeValue =
12
- rnRuntime.global()
13
- .getPropertyAsObject(rnRuntime, "ArrayBuffer")
14
- .asFunction(rnRuntime)
15
- .callAsConstructor(rnRuntime, {static_cast<double>(sizeof(void *))});
16
- uintptr_t *workletRuntimeData = reinterpret_cast<uintptr_t *>(
17
- workletRuntimeValue.getObject(rnRuntime).getArrayBuffer(rnRuntime).data(
18
- rnRuntime));
19
- workletRuntimeData[0] = reinterpret_cast<uintptr_t>(&uiRuntime);
20
- rnRuntime.global().setProperty(
21
- rnRuntime, "_WORKLET_RUNTIME", workletRuntimeValue);
22
-
23
- #ifdef RCT_NEW_ARCH_ENABLED
24
- constexpr auto isFabric = true;
25
- #else
26
- constexpr auto isFabric = false;
27
- #endif // RCT_NEW_ARCH_ENABLED
28
- rnRuntime.global().setProperty(rnRuntime, "_IS_FABRIC", isFabric);
29
-
30
- rnRuntime.global().setProperty(
31
- rnRuntime, "_IS_BRIDGELESS", reanimatedModuleProxy->isBridgeless());
32
-
33
- #ifndef NDEBUG
34
- checkJSVersion(rnRuntime, reanimatedModuleProxy->getJSLogger());
35
- #endif // NDEBUG
36
-
37
- #if defined(IS_REANIMATED_EXAMPLE_APP) && defined(RCT_NEW_ARCH_ENABLED)
38
- jsi_utils::installJsiFunction(
39
- rnRuntime,
40
- "_registriesLeakCheck",
41
- reanimatedModuleProxy->createRegistriesLeakCheck());
42
- #endif // defined(IS_REANIMATED_EXAMPLE_APP) && defined(RCT_NEW_ARCH_ENABLED)
43
- injectReanimatedCppVersion(rnRuntime);
44
-
45
- rnRuntime.global().setProperty(
46
- rnRuntime,
47
- "_REANIMATED_IS_REDUCED_MOTION",
48
- reanimatedModuleProxy->isReducedMotion());
49
-
50
- rnRuntime.global().setProperty(
51
- rnRuntime,
52
- "__reanimatedModuleProxy",
53
- jsi::Object::createFromHostObject(rnRuntime, reanimatedModuleProxy));
54
- }
55
-
56
- } // namespace reanimated
1
+ #include <reanimated/RuntimeDecorators/RNRuntimeDecorator.h>
2
+ #include <worklets/Tools/ReanimatedJSIUtils.h>
3
+ #include <worklets/Tools/ReanimatedVersion.h>
4
+
5
+ namespace reanimated {
6
+
7
+ void RNRuntimeDecorator::decorate(
8
+ jsi::Runtime &rnRuntime,
9
+ const std::shared_ptr<ReanimatedModuleProxy> &reanimatedModuleProxy) {
10
+ jsi::Runtime &uiRuntime = reanimatedModuleProxy->getUIRuntime();
11
+ auto workletRuntimeValue =
12
+ rnRuntime.global()
13
+ .getPropertyAsObject(rnRuntime, "ArrayBuffer")
14
+ .asFunction(rnRuntime)
15
+ .callAsConstructor(rnRuntime, {static_cast<double>(sizeof(void *))});
16
+ uintptr_t *workletRuntimeData = reinterpret_cast<uintptr_t *>(
17
+ workletRuntimeValue.getObject(rnRuntime).getArrayBuffer(rnRuntime).data(
18
+ rnRuntime));
19
+ workletRuntimeData[0] = reinterpret_cast<uintptr_t>(&uiRuntime);
20
+ rnRuntime.global().setProperty(
21
+ rnRuntime, "_WORKLET_RUNTIME", workletRuntimeValue);
22
+
23
+ #ifdef RCT_NEW_ARCH_ENABLED
24
+ constexpr auto isFabric = true;
25
+ #else
26
+ constexpr auto isFabric = false;
27
+ #endif // RCT_NEW_ARCH_ENABLED
28
+ rnRuntime.global().setProperty(rnRuntime, "_IS_FABRIC", isFabric);
29
+
30
+ rnRuntime.global().setProperty(
31
+ rnRuntime, "_IS_BRIDGELESS", reanimatedModuleProxy->isBridgeless());
32
+
33
+ #ifndef NDEBUG
34
+ checkJSVersion(rnRuntime, reanimatedModuleProxy->getJSLogger());
35
+ #endif // NDEBUG
36
+
37
+ #if defined(IS_REANIMATED_EXAMPLE_APP) && defined(RCT_NEW_ARCH_ENABLED)
38
+ jsi_utils::installJsiFunction(
39
+ rnRuntime,
40
+ "_registriesLeakCheck",
41
+ reanimatedModuleProxy->createRegistriesLeakCheck());
42
+ #endif // defined(IS_REANIMATED_EXAMPLE_APP) && defined(RCT_NEW_ARCH_ENABLED)
43
+ injectReanimatedCppVersion(rnRuntime);
44
+
45
+ rnRuntime.global().setProperty(
46
+ rnRuntime,
47
+ "_REANIMATED_IS_REDUCED_MOTION",
48
+ reanimatedModuleProxy->isReducedMotion());
49
+
50
+ rnRuntime.global().setProperty(
51
+ rnRuntime,
52
+ "__reanimatedModuleProxy",
53
+ jsi::Object::createFromHostObject(rnRuntime, reanimatedModuleProxy));
54
+ }
55
+
56
+ } // namespace reanimated
@@ -1,20 +1,20 @@
1
- #pragma once
2
-
3
- #include <reanimated/NativeModules/ReanimatedModuleProxy.h>
4
-
5
- #include <jsi/jsi.h>
6
-
7
- #include <memory>
8
-
9
- using namespace facebook;
10
-
11
- namespace reanimated {
12
-
13
- class RNRuntimeDecorator {
14
- public:
15
- static void decorate(
16
- jsi::Runtime &rnRuntime,
17
- const std::shared_ptr<ReanimatedModuleProxy> &reanimatedModuleProxy);
18
- };
19
-
20
- } // namespace reanimated
1
+ #pragma once
2
+
3
+ #include <reanimated/NativeModules/ReanimatedModuleProxy.h>
4
+
5
+ #include <jsi/jsi.h>
6
+
7
+ #include <memory>
8
+
9
+ using namespace facebook;
10
+
11
+ namespace reanimated {
12
+
13
+ class RNRuntimeDecorator {
14
+ public:
15
+ static void decorate(
16
+ jsi::Runtime &rnRuntime,
17
+ const std::shared_ptr<ReanimatedModuleProxy> &reanimatedModuleProxy);
18
+ };
19
+
20
+ } // namespace reanimated
@@ -1,70 +1,70 @@
1
- #include <reanimated/RuntimeDecorators/UIRuntimeDecorator.h>
2
- #include <worklets/Tools/ReanimatedJSIUtils.h>
3
-
4
- namespace reanimated {
5
-
6
- using namespace worklets;
7
-
8
- void UIRuntimeDecorator::decorate(
9
- jsi::Runtime &uiRuntime,
10
- #ifdef RCT_NEW_ARCH_ENABLED
11
- // nothing
12
- #else
13
- const ScrollToFunction scrollTo,
14
- #endif
15
- const ObtainPropFunction obtainPropFunction,
16
- const UpdatePropsFunction updateProps,
17
- const MeasureFunction measure,
18
- const DispatchCommandFunction dispatchCommand,
19
- const RequestAnimationFrameFunction requestAnimationFrame,
20
- const GetAnimationTimestampFunction getAnimationTimestamp,
21
- const SetGestureStateFunction setGestureState,
22
- const ProgressLayoutAnimationFunction progressLayoutAnimation,
23
- const EndLayoutAnimationFunction endLayoutAnimation,
24
- const MaybeFlushUIUpdatesQueueFunction maybeFlushUIUpdatesQueue) {
25
- uiRuntime.global().setProperty(uiRuntime, "_UI", true);
26
-
27
- #ifdef RCT_NEW_ARCH_ENABLED
28
- jsi_utils::installJsiFunction(uiRuntime, "_updatePropsFabric", updateProps);
29
- jsi_utils::installJsiFunction(
30
- uiRuntime, "_dispatchCommandFabric", dispatchCommand);
31
- jsi_utils::installJsiFunction(uiRuntime, "_measureFabric", measure);
32
- #else
33
- jsi_utils::installJsiFunction(uiRuntime, "_updatePropsPaper", updateProps);
34
- jsi_utils::installJsiFunction(
35
- uiRuntime, "_dispatchCommandPaper", dispatchCommand);
36
- jsi_utils::installJsiFunction(uiRuntime, "_scrollToPaper", scrollTo);
37
- jsi_utils::installJsiFunction(
38
- uiRuntime,
39
- "_measurePaper",
40
- [measure](jsi::Runtime &rt, int viewTag) -> jsi::Value {
41
- auto result = measure(viewTag);
42
- jsi::Object resultObject(rt);
43
- for (const auto &item : result) {
44
- resultObject.setProperty(rt, item.first.c_str(), item.second);
45
- }
46
- return resultObject;
47
- });
48
- jsi_utils::installJsiFunction(
49
- uiRuntime, "_obtainPropPaper", obtainPropFunction);
50
- #endif // RCT_NEW_ARCH_ENABLED
51
-
52
- jsi_utils::installJsiFunction(
53
- uiRuntime, "requestAnimationFrame", requestAnimationFrame);
54
- jsi_utils::installJsiFunction(
55
- uiRuntime, "_getAnimationTimestamp", getAnimationTimestamp);
56
-
57
- jsi_utils::installJsiFunction(
58
- uiRuntime, "_notifyAboutProgress", progressLayoutAnimation);
59
- jsi_utils::installJsiFunction(
60
- uiRuntime, "_notifyAboutEnd", endLayoutAnimation);
61
-
62
- jsi_utils::installJsiFunction(uiRuntime, "_setGestureState", setGestureState);
63
- jsi_utils::installJsiFunction(
64
- uiRuntime, "_maybeFlushUIUpdatesQueue", maybeFlushUIUpdatesQueue);
65
-
66
- jsi_utils::installJsiFunction(
67
- uiRuntime, "_obtainPropFabric", obtainPropFunction);
68
- }
69
-
70
- } // namespace reanimated
1
+ #include <reanimated/RuntimeDecorators/UIRuntimeDecorator.h>
2
+ #include <worklets/Tools/ReanimatedJSIUtils.h>
3
+
4
+ namespace reanimated {
5
+
6
+ using namespace worklets;
7
+
8
+ void UIRuntimeDecorator::decorate(
9
+ jsi::Runtime &uiRuntime,
10
+ #ifdef RCT_NEW_ARCH_ENABLED
11
+ // nothing
12
+ #else
13
+ const ScrollToFunction scrollTo,
14
+ #endif
15
+ const ObtainPropFunction obtainPropFunction,
16
+ const UpdatePropsFunction updateProps,
17
+ const MeasureFunction measure,
18
+ const DispatchCommandFunction dispatchCommand,
19
+ const RequestAnimationFrameFunction requestAnimationFrame,
20
+ const GetAnimationTimestampFunction getAnimationTimestamp,
21
+ const SetGestureStateFunction setGestureState,
22
+ const ProgressLayoutAnimationFunction progressLayoutAnimation,
23
+ const EndLayoutAnimationFunction endLayoutAnimation,
24
+ const MaybeFlushUIUpdatesQueueFunction maybeFlushUIUpdatesQueue) {
25
+ uiRuntime.global().setProperty(uiRuntime, "_UI", true);
26
+
27
+ #ifdef RCT_NEW_ARCH_ENABLED
28
+ jsi_utils::installJsiFunction(uiRuntime, "_updatePropsFabric", updateProps);
29
+ jsi_utils::installJsiFunction(
30
+ uiRuntime, "_dispatchCommandFabric", dispatchCommand);
31
+ jsi_utils::installJsiFunction(uiRuntime, "_measureFabric", measure);
32
+ #else
33
+ jsi_utils::installJsiFunction(uiRuntime, "_updatePropsPaper", updateProps);
34
+ jsi_utils::installJsiFunction(
35
+ uiRuntime, "_dispatchCommandPaper", dispatchCommand);
36
+ jsi_utils::installJsiFunction(uiRuntime, "_scrollToPaper", scrollTo);
37
+ jsi_utils::installJsiFunction(
38
+ uiRuntime,
39
+ "_measurePaper",
40
+ [measure](jsi::Runtime &rt, int viewTag) -> jsi::Value {
41
+ auto result = measure(viewTag);
42
+ jsi::Object resultObject(rt);
43
+ for (const auto &item : result) {
44
+ resultObject.setProperty(rt, item.first.c_str(), item.second);
45
+ }
46
+ return resultObject;
47
+ });
48
+ jsi_utils::installJsiFunction(
49
+ uiRuntime, "_obtainPropPaper", obtainPropFunction);
50
+ #endif // RCT_NEW_ARCH_ENABLED
51
+
52
+ jsi_utils::installJsiFunction(
53
+ uiRuntime, "requestAnimationFrame", requestAnimationFrame);
54
+ jsi_utils::installJsiFunction(
55
+ uiRuntime, "_getAnimationTimestamp", getAnimationTimestamp);
56
+
57
+ jsi_utils::installJsiFunction(
58
+ uiRuntime, "_notifyAboutProgress", progressLayoutAnimation);
59
+ jsi_utils::installJsiFunction(
60
+ uiRuntime, "_notifyAboutEnd", endLayoutAnimation);
61
+
62
+ jsi_utils::installJsiFunction(uiRuntime, "_setGestureState", setGestureState);
63
+ jsi_utils::installJsiFunction(
64
+ uiRuntime, "_maybeFlushUIUpdatesQueue", maybeFlushUIUpdatesQueue);
65
+
66
+ jsi_utils::installJsiFunction(
67
+ uiRuntime, "_obtainPropFabric", obtainPropFunction);
68
+ }
69
+
70
+ } // namespace reanimated
@@ -1,35 +1,35 @@
1
- #pragma once
2
-
3
- #include <jsi/jsi.h>
4
-
5
- #include <reanimated/Tools/PlatformDepMethodsHolder.h>
6
-
7
- using namespace facebook;
8
-
9
- namespace reanimated {
10
-
11
- using RequestAnimationFrameFunction =
12
- std::function<void(jsi::Runtime &, const jsi::Value &)>;
13
-
14
- class UIRuntimeDecorator {
15
- public:
16
- static void decorate(
17
- jsi::Runtime &uiRuntime,
18
- #ifdef RCT_NEW_ARCH_ENABLED
19
- // nothing
20
- #else
21
- const ScrollToFunction scrollTo,
22
- #endif
23
- const ObtainPropFunction obtainPropFunction,
24
- const UpdatePropsFunction updateProps,
25
- const MeasureFunction measure,
26
- const DispatchCommandFunction dispatchCommand,
27
- const RequestAnimationFrameFunction requestAnimationFrame,
28
- const GetAnimationTimestampFunction getAnimationTimestamp,
29
- const SetGestureStateFunction setGestureState,
30
- const ProgressLayoutAnimationFunction progressLayoutAnimation,
31
- const EndLayoutAnimationFunction endLayoutAnimation,
32
- const MaybeFlushUIUpdatesQueueFunction maybeFlushUIUpdatesQueue);
33
- };
34
-
35
- } // namespace reanimated
1
+ #pragma once
2
+
3
+ #include <jsi/jsi.h>
4
+
5
+ #include <reanimated/Tools/PlatformDepMethodsHolder.h>
6
+
7
+ using namespace facebook;
8
+
9
+ namespace reanimated {
10
+
11
+ using RequestAnimationFrameFunction =
12
+ std::function<void(jsi::Runtime &, const jsi::Value &)>;
13
+
14
+ class UIRuntimeDecorator {
15
+ public:
16
+ static void decorate(
17
+ jsi::Runtime &uiRuntime,
18
+ #ifdef RCT_NEW_ARCH_ENABLED
19
+ // nothing
20
+ #else
21
+ const ScrollToFunction scrollTo,
22
+ #endif
23
+ const ObtainPropFunction obtainPropFunction,
24
+ const UpdatePropsFunction updateProps,
25
+ const MeasureFunction measure,
26
+ const DispatchCommandFunction dispatchCommand,
27
+ const RequestAnimationFrameFunction requestAnimationFrame,
28
+ const GetAnimationTimestampFunction getAnimationTimestamp,
29
+ const SetGestureStateFunction setGestureState,
30
+ const ProgressLayoutAnimationFunction progressLayoutAnimation,
31
+ const EndLayoutAnimationFunction endLayoutAnimation,
32
+ const MaybeFlushUIUpdatesQueueFunction maybeFlushUIUpdatesQueue);
33
+ };
34
+
35
+ } // namespace reanimated
@@ -1,14 +1,14 @@
1
- #pragma once
2
-
3
- #include <algorithm>
4
-
5
- namespace reanimated {
6
- namespace collection {
7
-
8
- template <class CollectionType, class ValueType>
9
- inline bool contains(const CollectionType &collection, const ValueType &value) {
10
- return collection.find(value) != collection.end();
11
- }
12
-
13
- } // namespace collection
14
- } // namespace reanimated
1
+ #pragma once
2
+
3
+ #include <algorithm>
4
+
5
+ namespace reanimated {
6
+ namespace collection {
7
+
8
+ template <class CollectionType, class ValueType>
9
+ inline bool contains(const CollectionType &collection, const ValueType &value) {
10
+ return collection.find(value) != collection.end();
11
+ }
12
+
13
+ } // namespace collection
14
+ } // namespace reanimated
@@ -1,5 +1,5 @@
1
- #include <reanimated/Tools/FeaturesConfig.h>
2
-
3
- namespace reanimated {
4
- bool FeaturesConfig::_isLayoutAnimationEnabled = false;
5
- }
1
+ #include <reanimated/Tools/FeaturesConfig.h>
2
+
3
+ namespace reanimated {
4
+ bool FeaturesConfig::_isLayoutAnimationEnabled = false;
5
+ }
@@ -1,19 +1,19 @@
1
- #pragma once
2
- #include <string>
3
-
4
- namespace reanimated {
5
-
6
- class FeaturesConfig {
7
- public:
8
- static inline bool isLayoutAnimationEnabled() {
9
- return _isLayoutAnimationEnabled;
10
- }
11
- static inline void setLayoutAnimationEnabled(bool isLayoutAnimationEnabled) {
12
- _isLayoutAnimationEnabled = isLayoutAnimationEnabled;
13
- }
14
-
15
- private:
16
- static bool _isLayoutAnimationEnabled;
17
- };
18
-
19
- } // namespace reanimated
1
+ #pragma once
2
+ #include <string>
3
+
4
+ namespace reanimated {
5
+
6
+ class FeaturesConfig {
7
+ public:
8
+ static inline bool isLayoutAnimationEnabled() {
9
+ return _isLayoutAnimationEnabled;
10
+ }
11
+ static inline void setLayoutAnimationEnabled(bool isLayoutAnimationEnabled) {
12
+ _isLayoutAnimationEnabled = isLayoutAnimationEnabled;
13
+ }
14
+
15
+ private:
16
+ static bool _isLayoutAnimationEnabled;
17
+ };
18
+
19
+ } // namespace reanimated