react-native-reanimated 4.3.0-rc.0 → 4.3.1
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/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +8 -5
- package/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -5
- package/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +2 -3
- package/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +2 -3
- package/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +7 -3
- package/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +9 -2
- package/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +6 -2
- package/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +8 -2
- package/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +2 -2
- package/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +2 -2
- package/Common/cpp/reanimated/Compat/WorkletsApi.h +13 -0
- package/Common/cpp/reanimated/Events/UIEventHandler.cpp +1 -1
- package/Common/cpp/reanimated/Events/UIEventHandler.h +3 -4
- package/Common/cpp/reanimated/Events/UIEventHandlerRegistry.cpp +3 -2
- package/Common/cpp/reanimated/Events/UIEventHandlerRegistry.h +1 -1
- package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +2 -8
- package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -6
- package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +1 -6
- package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +1 -8
- package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +12 -7
- package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +6 -3
- package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +4 -6
- package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +25 -7
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +1 -2
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +1 -1
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +9 -9
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +2 -3
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +21 -21
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +3 -3
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +3 -3
- package/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +24 -20
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +35 -53
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +1 -2
- package/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +22 -22
- package/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +10 -10
- package/Common/cpp/reanimated/Tools/ReaJSIUtils.h +5 -5
- package/README.md +1 -1
- package/android/build.gradle +0 -21
- package/android/src/main/cpp/reanimated/android/NativeProxy.cpp +6 -10
- package/android/src/main/cpp/reanimated/android/NativeProxy.h +1 -2
- package/android/src/main/java/com/swmansion/reanimated/CopiedEvent.java +66 -9
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +16 -11
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +34 -8
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NoopEventHandler.java +27 -6
- package/apple/reanimated/apple/REANodesManager.mm +0 -8
- package/apple/reanimated/apple/ReanimatedModule.mm +6 -12
- package/apple/reanimated/apple/native/NativeProxy.h +1 -2
- package/apple/reanimated/apple/native/NativeProxy.mm +1 -1
- package/compatibility.json +7 -29
- package/lib/module/PropsRegistryGarbageCollector.js +3 -0
- package/lib/module/PropsRegistryGarbageCollector.js.map +1 -1
- package/lib/module/common/style/processors/colors.js +31 -4
- package/lib/module/common/style/processors/colors.js.map +1 -1
- package/lib/module/common/style/processors/filter.js +103 -61
- package/lib/module/common/style/processors/filter.js.map +1 -1
- package/lib/module/common/style/processors/font.js +7 -1
- package/lib/module/common/style/processors/font.js.map +1 -1
- package/lib/module/common/style/processors/insets.js +26 -14
- package/lib/module/common/style/processors/insets.js.map +1 -1
- package/lib/module/common/style/processors/others.js +15 -5
- package/lib/module/common/style/processors/others.js.map +1 -1
- package/lib/module/common/style/processors/shadows.js +14 -3
- package/lib/module/common/style/processors/shadows.js.map +1 -1
- package/lib/module/common/style/processors/transform.js +30 -1
- package/lib/module/common/style/processors/transform.js.map +1 -1
- package/lib/module/common/style/processors/transformOrigin.js +20 -3
- package/lib/module/common/style/processors/transformOrigin.js.map +1 -1
- package/lib/module/common/utils/guards.js +27 -7
- package/lib/module/common/utils/guards.js.map +1 -1
- package/lib/module/common/utils/parsers.js +2 -1
- package/lib/module/common/utils/parsers.js.map +1 -1
- package/lib/module/createAnimatedComponent/AnimatedComponent.js +1 -7
- package/lib/module/createAnimatedComponent/AnimatedComponent.js.map +1 -1
- package/lib/module/css/native/managers/CSSManager.js +16 -15
- package/lib/module/css/native/managers/CSSManager.js.map +1 -1
- package/lib/module/css/native/managers/CSSTransitionsManager.js +47 -44
- package/lib/module/css/native/managers/CSSTransitionsManager.js.map +1 -1
- package/lib/module/css/native/normalization/transition/config.js +35 -17
- package/lib/module/css/native/normalization/transition/config.js.map +1 -1
- package/lib/module/css/utils/props.js +6 -0
- package/lib/module/css/utils/props.js.map +1 -1
- package/lib/module/featureFlags/index.js +1 -1
- package/lib/module/featureFlags/staticFlags.json +1 -1
- package/lib/module/hook/useAnimatedRef.js +2 -2
- package/lib/module/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/hook/useAnimatedStyle.js +7 -1
- package/lib/module/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/hook/useHandler.js +82 -28
- package/lib/module/hook/useHandler.js.map +1 -1
- package/lib/module/hook/utils.js +1 -74
- package/lib/module/hook/utils.js.map +1 -1
- package/lib/module/initializers.js +2 -0
- package/lib/module/initializers.js.map +1 -1
- package/lib/module/jestUtils/common.js +10 -0
- package/lib/module/jestUtils/common.js.map +1 -1
- package/lib/module/jestUtils/index.js +2 -5
- package/lib/module/jestUtils/index.js.map +1 -1
- package/lib/module/jestUtils/index.web.js +1 -1
- package/lib/module/jestUtils/index.web.js.map +1 -1
- package/lib/module/mutables.js +5 -1
- package/lib/module/mutables.js.map +1 -1
- package/lib/module/platform-specific/jsVersion.js +1 -1
- package/lib/module/platform-specific/jsVersion.js.map +1 -1
- package/lib/typescript/PropsRegistryGarbageCollector.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/colors.d.ts +3 -3
- package/lib/typescript/common/style/processors/colors.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/filter.d.ts +0 -4
- package/lib/typescript/common/style/processors/filter.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/font.d.ts +1 -1
- package/lib/typescript/common/style/processors/font.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/insets.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/others.d.ts +1 -1
- package/lib/typescript/common/style/processors/others.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/shadows.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/transform.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/transformOrigin.d.ts +2 -2
- package/lib/typescript/common/style/processors/transformOrigin.d.ts.map +1 -1
- package/lib/typescript/common/utils/guards.d.ts +0 -1
- package/lib/typescript/common/utils/guards.d.ts.map +1 -1
- package/lib/typescript/common/utils/parsers.d.ts.map +1 -1
- package/lib/typescript/commonTypes.d.ts +1 -1
- package/lib/typescript/commonTypes.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts.map +1 -1
- package/lib/typescript/css/native/managers/CSSManager.d.ts +7 -1
- package/lib/typescript/css/native/managers/CSSManager.d.ts.map +1 -1
- package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts +5 -4
- package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts.map +1 -1
- package/lib/typescript/css/native/normalization/transition/config.d.ts.map +1 -1
- package/lib/typescript/css/native/types/transition.d.ts +15 -1
- package/lib/typescript/css/native/types/transition.d.ts.map +1 -1
- package/lib/typescript/css/utils/props.d.ts.map +1 -1
- package/lib/typescript/featureFlags/index.d.ts +1 -1
- package/lib/typescript/hook/useAnimatedStyle.d.ts.map +1 -1
- package/lib/typescript/hook/useHandler.d.ts +8 -9
- package/lib/typescript/hook/useHandler.d.ts.map +1 -1
- package/lib/typescript/hook/utils.d.ts +0 -5
- package/lib/typescript/hook/utils.d.ts.map +1 -1
- package/lib/typescript/jestUtils/common.d.ts +2 -0
- package/lib/typescript/jestUtils/common.d.ts.map +1 -1
- package/lib/typescript/jestUtils/index.d.ts +4 -3
- package/lib/typescript/jestUtils/index.d.ts.map +1 -1
- package/lib/typescript/mutables.d.ts.map +1 -1
- package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
- package/lib/typescript/platform-specific/jsVersion.d.ts.map +1 -1
- package/package.json +13 -10
- package/src/PropsRegistryGarbageCollector.ts +3 -0
- package/src/common/style/processors/colors.ts +20 -7
- package/src/common/style/processors/filter.ts +95 -70
- package/src/common/style/processors/font.ts +5 -2
- package/src/common/style/processors/insets.ts +23 -14
- package/src/common/style/processors/others.ts +12 -6
- package/src/common/style/processors/shadows.ts +10 -6
- package/src/common/style/processors/transform.ts +15 -1
- package/src/common/style/processors/transformOrigin.ts +40 -11
- package/src/common/utils/guards.ts +21 -16
- package/src/common/utils/parsers.ts +1 -1
- package/src/commonTypes.ts +1 -1
- package/src/createAnimatedComponent/AnimatedComponent.tsx +1 -7
- package/src/css/native/managers/CSSManager.ts +29 -14
- package/src/css/native/managers/CSSTransitionsManager.ts +52 -54
- package/src/css/native/normalization/transition/config.ts +35 -27
- package/src/css/native/types/transition.ts +15 -1
- package/src/css/utils/props.ts +7 -0
- package/src/featureFlags/index.ts +1 -1
- package/src/featureFlags/staticFlags.json +1 -1
- package/src/hook/useAnimatedRef.ts +2 -2
- package/src/hook/useAnimatedStyle.ts +15 -6
- package/src/hook/useHandler.ts +150 -64
- package/src/hook/utils.ts +1 -127
- package/src/initializers.ts +1 -0
- package/src/jestUtils/common.ts +10 -0
- package/src/jestUtils/index.ts +5 -8
- package/src/jestUtils/index.web.ts +1 -1
- package/src/mutables.ts +5 -1
- package/src/platform-specific/jsVersion.ts +1 -1
- package/src/privateGlobals.d.ts +4 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#include <react/renderer/scheduler/Scheduler.h>
|
|
2
2
|
#include <react/renderer/uimanager/UIManagerBinding.h>
|
|
3
|
+
#include <reanimated/Compat/WorkletsApi.h>
|
|
3
4
|
#include <reanimated/Events/UIEventHandler.h>
|
|
4
5
|
#include <reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h>
|
|
5
6
|
#include <reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h>
|
|
@@ -8,7 +9,6 @@
|
|
|
8
9
|
#include <reanimated/RuntimeDecorators/UIRuntimeDecorator.h>
|
|
9
10
|
#include <reanimated/Tools/FeatureFlags.h>
|
|
10
11
|
#include <reanimated/Tools/ReanimatedSystraceSection.h>
|
|
11
|
-
#include <worklets/SharedItems/Serializable.h>
|
|
12
12
|
|
|
13
13
|
#ifdef __ANDROID__
|
|
14
14
|
#include <fbjni/fbjni.h>
|
|
@@ -26,13 +26,11 @@ namespace reanimated {
|
|
|
26
26
|
|
|
27
27
|
using namespace worklets;
|
|
28
28
|
|
|
29
|
-
#if REACT_NATIVE_MINOR_VERSION >= 81
|
|
30
29
|
static inline std::shared_ptr<const ShadowNode> shadowNodeFromValue(
|
|
31
30
|
jsi::Runtime &rt,
|
|
32
31
|
const jsi::Value &shadowNodeWrapper) {
|
|
33
32
|
return Bridging<std::shared_ptr<const ShadowNode>>::fromJs(rt, shadowNodeWrapper);
|
|
34
33
|
}
|
|
35
|
-
#endif
|
|
36
34
|
|
|
37
35
|
namespace {
|
|
38
36
|
|
|
@@ -69,7 +67,7 @@ std::pair<UpdatesBatch, UpdatesBatch> partitionUpdates(
|
|
|
69
67
|
const auto keyStr = key.asString();
|
|
70
68
|
const bool isColorProp = keyStr == "color" || keyStr.find("Color") != std::string::npos;
|
|
71
69
|
const bool isSynchronous =
|
|
72
|
-
synchronousPropNames.contains(keyStr) && (!shouldRequireIntegerColors || !isColorProp || value.
|
|
70
|
+
synchronousPropNames.contains(keyStr) && (!shouldRequireIntegerColors || !isColorProp || value.isNumber());
|
|
73
71
|
if (isSynchronous) {
|
|
74
72
|
synchronousProps[keyStr] = value;
|
|
75
73
|
} else {
|
|
@@ -91,7 +89,7 @@ std::pair<UpdatesBatch, UpdatesBatch> partitionUpdates(
|
|
|
91
89
|
const auto keyStr = key.asString();
|
|
92
90
|
const bool isColorProp = keyStr == "color" || keyStr.find("Color") != std::string::npos;
|
|
93
91
|
const bool isSynchronous =
|
|
94
|
-
synchronousPropNames.contains(keyStr) && (!shouldRequireIntegerColors || !isColorProp || value.
|
|
92
|
+
synchronousPropNames.contains(keyStr) && (!shouldRequireIntegerColors || !isColorProp || value.isNumber());
|
|
95
93
|
if (!isSynchronous) {
|
|
96
94
|
hasOnlySynchronousProps = false;
|
|
97
95
|
break;
|
|
@@ -249,7 +247,7 @@ void ReanimatedModuleProxy::init(const PlatformDepMethodsHolder &platformDepMeth
|
|
|
249
247
|
return strongThis->obtainProp(rt, shadowNodeWrapper, propName);
|
|
250
248
|
};
|
|
251
249
|
|
|
252
|
-
jsi::Runtime &uiRuntime = uiRuntime_
|
|
250
|
+
jsi::Runtime &uiRuntime = getJSIRuntimeFromWorkletRuntime(uiRuntime_);
|
|
253
251
|
UIRuntimeDecorator::decorate(
|
|
254
252
|
uiRuntime,
|
|
255
253
|
obtainProp,
|
|
@@ -278,11 +276,11 @@ jsi::Value ReanimatedModuleProxy::registerEventHandler(
|
|
|
278
276
|
|
|
279
277
|
uint64_t newRegistrationId = NEXT_EVENT_HANDLER_ID++;
|
|
280
278
|
auto eventNameStr = eventName.asString(rt).utf8(rt);
|
|
281
|
-
auto handlerSerializable =
|
|
282
|
-
rt, worklet, "[Reanimated] Event handler must be a serializable worklet.");
|
|
279
|
+
auto handlerSerializable = extractSerializable(
|
|
280
|
+
rt, worklet, "[Reanimated] Event handler must be a serializable worklet.", Serializable::ValueType::WorkletType);
|
|
283
281
|
int emitterReactTagInt = emitterReactTag.asNumber();
|
|
284
282
|
|
|
285
|
-
|
|
283
|
+
scheduleOnUI(uiScheduler_, [=, weakThis = weak_from_this()]() {
|
|
286
284
|
auto strongThis = weakThis.lock();
|
|
287
285
|
if (!strongThis) {
|
|
288
286
|
return;
|
|
@@ -297,7 +295,7 @@ jsi::Value ReanimatedModuleProxy::registerEventHandler(
|
|
|
297
295
|
|
|
298
296
|
void ReanimatedModuleProxy::unregisterEventHandler(jsi::Runtime &, const jsi::Value ®istrationId) {
|
|
299
297
|
uint64_t id = registrationId.asNumber();
|
|
300
|
-
|
|
298
|
+
scheduleOnUI(uiScheduler_, [=, weakThis = weak_from_this()]() {
|
|
301
299
|
auto strongThis = weakThis.lock();
|
|
302
300
|
if (!strongThis) {
|
|
303
301
|
return;
|
|
@@ -323,12 +321,12 @@ jsi::Value ReanimatedModuleProxy::getViewProp(
|
|
|
323
321
|
const auto propNameStr = propName.asString(rnRuntime).utf8(rnRuntime);
|
|
324
322
|
const auto funPtr = std::make_shared<jsi::Function>(callback.getObject(rnRuntime).asFunction(rnRuntime));
|
|
325
323
|
const auto shadowNode = shadowNodeFromValue(rnRuntime, shadowNodeWrapper);
|
|
326
|
-
|
|
324
|
+
scheduleOnUI(uiScheduler_, [=, weakThis = weak_from_this()]() {
|
|
327
325
|
auto strongThis = weakThis.lock();
|
|
328
326
|
if (!strongThis) {
|
|
329
327
|
return;
|
|
330
328
|
}
|
|
331
|
-
jsi::Runtime &uiRuntime = strongThis->uiRuntime_
|
|
329
|
+
jsi::Runtime &uiRuntime = getJSIRuntimeFromWorkletRuntime(strongThis->uiRuntime_);
|
|
332
330
|
const auto resultStr = strongThis->obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode);
|
|
333
331
|
|
|
334
332
|
strongThis->jsInvoker_->invokeAsync([=](jsi::Runtime &rnRuntime) {
|
|
@@ -364,8 +362,8 @@ jsi::Value ReanimatedModuleProxy::configureLayoutAnimationBatch(
|
|
|
364
362
|
if (config.isUndefined()) {
|
|
365
363
|
batchItem.config = nullptr;
|
|
366
364
|
} else {
|
|
367
|
-
batchItem.config =
|
|
368
|
-
rt, config, "[Reanimated] Layout animation config must be an object.");
|
|
365
|
+
batchItem.config = extractSerializable(
|
|
366
|
+
rt, config, "[Reanimated] Layout animation config must be an object.", Serializable::ValueType::ObjectType);
|
|
369
367
|
}
|
|
370
368
|
auto sharedTag = item.getProperty(rt, "sharedTransitionTag");
|
|
371
369
|
if (!sharedTag.isUndefined()) {
|
|
@@ -495,17 +493,13 @@ void ReanimatedModuleProxy::applyCSSAnimations(
|
|
|
495
493
|
}
|
|
496
494
|
}
|
|
497
495
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
cssAnimationsRegistry_->apply(
|
|
501
|
-
rt, shadowNode, updates.animationNames, newAnimations, updates.settingsUpdates, timestamp);
|
|
502
|
-
}
|
|
496
|
+
cssAnimationsRegistry_->apply(
|
|
497
|
+
rt, shadowNode, updates.animationNames, newAnimations, updates.settingsUpdates, timestamp);
|
|
503
498
|
|
|
504
499
|
maybeRunCSSLoop();
|
|
505
500
|
}
|
|
506
501
|
|
|
507
502
|
void ReanimatedModuleProxy::unregisterCSSAnimations(const jsi::Value &viewTag) {
|
|
508
|
-
auto lock = cssAnimationsRegistry_->lock();
|
|
509
503
|
cssAnimationsRegistry_->remove(viewTag.asNumber());
|
|
510
504
|
}
|
|
511
505
|
|
|
@@ -516,16 +510,12 @@ void ReanimatedModuleProxy::runCSSTransition(
|
|
|
516
510
|
auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
517
511
|
const auto config = parseCSSTransitionConfig(rt, transitionConfig);
|
|
518
512
|
|
|
519
|
-
|
|
520
|
-
auto lock = cssTransitionsRegistry_->lock();
|
|
521
|
-
cssTransitionsRegistry_->run(rt, shadowNode, config);
|
|
522
|
-
}
|
|
513
|
+
cssTransitionsRegistry_->run(rt, shadowNode, config);
|
|
523
514
|
|
|
524
515
|
maybeRunCSSLoop();
|
|
525
516
|
}
|
|
526
517
|
|
|
527
518
|
void ReanimatedModuleProxy::unregisterCSSTransition(jsi::Runtime &rt, const jsi::Value &viewTag) {
|
|
528
|
-
auto lock = cssTransitionsRegistry_->lock();
|
|
529
519
|
cssTransitionsRegistry_->remove(viewTag.asNumber());
|
|
530
520
|
}
|
|
531
521
|
|
|
@@ -537,15 +527,12 @@ jsi::Value ReanimatedModuleProxy::getSettledUpdates(jsi::Runtime &rt) {
|
|
|
537
527
|
// TODO(future): use unified timestamp
|
|
538
528
|
const auto currentTimestamp = getAnimationTimestamp_();
|
|
539
529
|
|
|
540
|
-
const auto lock = animatedPropsRegistry_->lock();
|
|
541
|
-
|
|
542
530
|
// TODO: fix bug when threshold difference is smaller than 1 second
|
|
543
531
|
// TODO(future): flush updates from CSS animations and CSS transitions registries
|
|
544
|
-
animatedPropsRegistry_->removeUpdatesOlderThanTimestamp(currentTimestamp - 2000); // 2 seconds
|
|
545
|
-
|
|
546
532
|
// TODO(future): find a better way to obtain timestamp for removing updates
|
|
547
533
|
// TODO(future): move removing old updates to separate method
|
|
548
|
-
return animatedPropsRegistry_->getUpdatesOlderThanTimestamp(
|
|
534
|
+
return animatedPropsRegistry_->getUpdatesOlderThanTimestamp(
|
|
535
|
+
rt, currentTimestamp - 1000 /* 1 second */, currentTimestamp - 2000 /* 2 seconds */);
|
|
549
536
|
}
|
|
550
537
|
|
|
551
538
|
bool ReanimatedModuleProxy::handleEvent(
|
|
@@ -583,7 +570,7 @@ bool ReanimatedModuleProxy::handleRawEvent(const RawEvent &rawEvent, double curr
|
|
|
583
570
|
|
|
584
571
|
if constexpr (StaticFeatureFlags::getFlag("ENABLE_SHARED_ELEMENT_TRANSITIONS")) {
|
|
585
572
|
if (eventType == "onTransitionProgress") {
|
|
586
|
-
jsi::Runtime &uiRuntime = uiRuntime_
|
|
573
|
+
jsi::Runtime &uiRuntime = getJSIRuntimeFromWorkletRuntime(uiRuntime_);
|
|
587
574
|
const auto &eventPayload = rawEvent.eventPayload;
|
|
588
575
|
jsi::Object payload = eventPayload->asJSIValue(uiRuntime).asObject(uiRuntime);
|
|
589
576
|
auto progress = payload.getProperty(uiRuntime, "progress").asNumber();
|
|
@@ -620,7 +607,7 @@ bool ReanimatedModuleProxy::handleRawEvent(const RawEvent &rawEvent, double curr
|
|
|
620
607
|
return false;
|
|
621
608
|
}
|
|
622
609
|
|
|
623
|
-
jsi::Runtime &uiRuntime = uiRuntime_
|
|
610
|
+
jsi::Runtime &uiRuntime = getJSIRuntimeFromWorkletRuntime(uiRuntime_);
|
|
624
611
|
const auto &eventPayload = rawEvent.eventPayload;
|
|
625
612
|
jsi::Value payload = eventPayload->asJSIValue(uiRuntime);
|
|
626
613
|
|
|
@@ -657,7 +644,7 @@ void ReanimatedModuleProxy::maybeRunCSSLoop() {
|
|
|
657
644
|
|
|
658
645
|
cssLoopRunning_ = true;
|
|
659
646
|
|
|
660
|
-
|
|
647
|
+
scheduleOnUI(uiScheduler_, [=, weakThis = weak_from_this()]() {
|
|
661
648
|
auto strongThis = weakThis.lock();
|
|
662
649
|
if (!strongThis) {
|
|
663
650
|
return;
|
|
@@ -687,7 +674,7 @@ void ReanimatedModuleProxy::performOperations() {
|
|
|
687
674
|
surfaceId, [](const ShadowTree &shadowTree) { shadowTree.notifyDelegatesOfUpdates(); });
|
|
688
675
|
}
|
|
689
676
|
|
|
690
|
-
jsi::Runtime &uiRuntime = uiRuntime_
|
|
677
|
+
jsi::Runtime &uiRuntime = getJSIRuntimeFromWorkletRuntime(uiRuntime_);
|
|
691
678
|
|
|
692
679
|
UpdatesBatch updatesBatch;
|
|
693
680
|
{
|
|
@@ -696,24 +683,17 @@ void ReanimatedModuleProxy::performOperations() {
|
|
|
696
683
|
auto lock = updatesRegistryManager_->lock();
|
|
697
684
|
|
|
698
685
|
if (shouldUpdateCssAnimations_) {
|
|
699
|
-
currentCssTimestamp_ = getAnimationTimestamp_();
|
|
700
|
-
auto lock = cssTransitionsRegistry_->lock();
|
|
701
686
|
// Update CSS transitions and flush updates
|
|
702
|
-
|
|
703
|
-
cssTransitionsRegistry_->
|
|
687
|
+
currentCssTimestamp_ = getAnimationTimestamp_();
|
|
688
|
+
cssTransitionsRegistry_->updateAndFlush(currentCssTimestamp_, updatesBatch);
|
|
704
689
|
}
|
|
705
690
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
// Flush all animated props updates
|
|
709
|
-
animatedPropsRegistry_->flushUpdates(updatesBatch);
|
|
710
|
-
}
|
|
691
|
+
// Flush all animated props updates
|
|
692
|
+
animatedPropsRegistry_->flushUpdates(updatesBatch);
|
|
711
693
|
|
|
712
694
|
if (shouldUpdateCssAnimations_) {
|
|
713
|
-
auto lock = cssAnimationsRegistry_->lock();
|
|
714
695
|
// Update CSS animations and flush updates
|
|
715
|
-
cssAnimationsRegistry_->
|
|
716
|
-
cssAnimationsRegistry_->flushUpdates(updatesBatch);
|
|
696
|
+
cssAnimationsRegistry_->updateAndFlush(currentCssTimestamp_, updatesBatch);
|
|
717
697
|
}
|
|
718
698
|
|
|
719
699
|
shouldUpdateCssAnimations_ = false;
|
|
@@ -1198,7 +1178,6 @@ void ReanimatedModuleProxy::commitUpdates(jsi::Runtime &rt, const UpdatesBatch &
|
|
|
1198
1178
|
for (auto const &[shadowNode, props] : updatesBatch) {
|
|
1199
1179
|
SurfaceId surfaceId = shadowNode->getSurfaceId();
|
|
1200
1180
|
auto family = &shadowNode->getFamily();
|
|
1201
|
-
react_native_assert(family->getSurfaceId() == surfaceId);
|
|
1202
1181
|
propsMapBySurface[surfaceId][family].emplace_back(props);
|
|
1203
1182
|
}
|
|
1204
1183
|
}
|
|
@@ -1260,7 +1239,7 @@ void ReanimatedModuleProxy::dispatchCommand(
|
|
|
1260
1239
|
|
|
1261
1240
|
jsi::String
|
|
1262
1241
|
ReanimatedModuleProxy::obtainProp(jsi::Runtime &rt, const jsi::Value &shadowNodeWrapper, const jsi::Value &propName) {
|
|
1263
|
-
jsi::Runtime &uiRuntime = uiRuntime_
|
|
1242
|
+
jsi::Runtime &uiRuntime = getJSIRuntimeFromWorkletRuntime(uiRuntime_);
|
|
1264
1243
|
const auto propNameStr = propName.asString(rt).utf8(rt);
|
|
1265
1244
|
const auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
1266
1245
|
const auto resultStr = obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode);
|
|
@@ -1330,7 +1309,7 @@ void ReanimatedModuleProxy::initializeLayoutAnimationsProxy() {
|
|
|
1330
1309
|
layoutAnimationsManager_,
|
|
1331
1310
|
componentDescriptorRegistry,
|
|
1332
1311
|
scheduler->getContextContainer(),
|
|
1333
|
-
uiRuntime_
|
|
1312
|
+
getJSIRuntimeFromWorkletRuntime(uiRuntime_),
|
|
1334
1313
|
uiScheduler_
|
|
1335
1314
|
#ifdef ANDROID
|
|
1336
1315
|
,
|
|
@@ -1348,7 +1327,7 @@ void ReanimatedModuleProxy::initializeLayoutAnimationsProxy() {
|
|
|
1348
1327
|
layoutAnimationsManager_,
|
|
1349
1328
|
componentDescriptorRegistry,
|
|
1350
1329
|
scheduler->getContextContainer(),
|
|
1351
|
-
uiRuntime_
|
|
1330
|
+
getJSIRuntimeFromWorkletRuntime(uiRuntime_),
|
|
1352
1331
|
uiScheduler_
|
|
1353
1332
|
#ifdef ANDROID
|
|
1354
1333
|
,
|
|
@@ -1395,15 +1374,18 @@ jsi::Value ReanimatedModuleProxy::subscribeForKeyboardEvents(
|
|
|
1395
1374
|
const jsi::Value &handlerWorklet,
|
|
1396
1375
|
const jsi::Value &isStatusBarTranslucent,
|
|
1397
1376
|
const jsi::Value &isNavigationBarTranslucent) {
|
|
1398
|
-
auto serializableHandler =
|
|
1399
|
-
rt,
|
|
1377
|
+
auto serializableHandler = extractSerializable(
|
|
1378
|
+
rt,
|
|
1379
|
+
handlerWorklet,
|
|
1380
|
+
"[Reanimated] Keyboard event handler must be a worklet.",
|
|
1381
|
+
Serializable::ValueType::WorkletType);
|
|
1400
1382
|
return subscribeForKeyboardEventsFunction_(
|
|
1401
1383
|
[=, weakThis = weak_from_this()](int keyboardState, int height) {
|
|
1402
1384
|
auto strongThis = weakThis.lock();
|
|
1403
1385
|
if (!strongThis) {
|
|
1404
1386
|
return;
|
|
1405
1387
|
}
|
|
1406
|
-
strongThis->uiRuntime_
|
|
1388
|
+
runSyncOnRuntime(strongThis->uiRuntime_, serializableHandler, jsi::Value(keyboardState), jsi::Value(height));
|
|
1407
1389
|
},
|
|
1408
1390
|
isStatusBarTranslucent.getBool(),
|
|
1409
1391
|
isNavigationBarTranslucent.getBool());
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#include <reanimated/CSS/registries/CSSKeyframesRegistry.h>
|
|
12
12
|
#include <reanimated/CSS/registries/CSSTransitionsRegistry.h>
|
|
13
13
|
#include <reanimated/CSS/registries/StaticPropsRegistry.h>
|
|
14
|
+
#include <reanimated/Compat/WorkletsApi.h>
|
|
14
15
|
#include <reanimated/Events/UIEventHandlerRegistry.h>
|
|
15
16
|
#include <reanimated/Fabric/ReanimatedCommitHook.h>
|
|
16
17
|
#include <reanimated/Fabric/ReanimatedCommitShadowNode.h>
|
|
@@ -24,8 +25,6 @@
|
|
|
24
25
|
#include <reanimated/NativeModules/ReanimatedModuleProxySpec.h>
|
|
25
26
|
#include <reanimated/Tools/PlatformDepMethodsHolder.h>
|
|
26
27
|
#include <reanimated/Tools/SingleInstanceChecker.h>
|
|
27
|
-
#include <worklets/Tools/UIScheduler.h>
|
|
28
|
-
#include <worklets/WorkletRuntime/WorkletRuntime.h>
|
|
29
28
|
|
|
30
29
|
#include <memory>
|
|
31
30
|
#include <set>
|
|
@@ -7,31 +7,31 @@ namespace reanimated {
|
|
|
7
7
|
|
|
8
8
|
void UIRuntimeDecorator::decorate(
|
|
9
9
|
jsi::Runtime &uiRuntime,
|
|
10
|
-
ObtainPropFunction obtainPropFunction,
|
|
11
|
-
UpdatePropsFunction updateProps,
|
|
12
|
-
MeasureFunction measure,
|
|
13
|
-
DispatchCommandFunction dispatchCommand,
|
|
14
|
-
GetAnimationTimestampFunction getAnimationTimestamp,
|
|
15
|
-
SetGestureStateFunction setGestureState,
|
|
16
|
-
ProgressLayoutAnimationFunction progressLayoutAnimation,
|
|
17
|
-
EndLayoutAnimationFunction endLayoutAnimation,
|
|
18
|
-
MaybeFlushUIUpdatesQueueFunction maybeFlushUIUpdatesQueue) {
|
|
19
|
-
|
|
20
|
-
jsi_utils::installJsiFunction(uiRuntime, "_updateProps",
|
|
21
|
-
jsi_utils::installJsiFunction(uiRuntime, "_dispatchCommand",
|
|
22
|
-
jsi_utils::installJsiFunction(uiRuntime, "_measure",
|
|
23
|
-
jsi_utils::installJsiFunction(uiRuntime, "_getAnimationTimestamp",
|
|
24
|
-
jsi_utils::installJsiFunction(uiRuntime, "_notifyAboutProgress",
|
|
25
|
-
jsi_utils::installJsiFunction(uiRuntime, "_notifyAboutEnd",
|
|
26
|
-
jsi_utils::installJsiFunction(uiRuntime, "_setGestureState",
|
|
27
|
-
jsi_utils::installJsiFunction(uiRuntime, "_obtainProp",
|
|
28
|
-
|
|
29
|
-
subscribeForMicrotasksFinalization(uiRuntime,
|
|
10
|
+
const ObtainPropFunction &obtainPropFunction,
|
|
11
|
+
const UpdatePropsFunction &updateProps,
|
|
12
|
+
const MeasureFunction &measure,
|
|
13
|
+
const DispatchCommandFunction &dispatchCommand,
|
|
14
|
+
const GetAnimationTimestampFunction &getAnimationTimestamp,
|
|
15
|
+
const SetGestureStateFunction &setGestureState,
|
|
16
|
+
const ProgressLayoutAnimationFunction &progressLayoutAnimation,
|
|
17
|
+
const EndLayoutAnimationFunction &endLayoutAnimation,
|
|
18
|
+
const MaybeFlushUIUpdatesQueueFunction &maybeFlushUIUpdatesQueue) {
|
|
19
|
+
|
|
20
|
+
jsi_utils::installJsiFunction(uiRuntime, "_updateProps", updateProps);
|
|
21
|
+
jsi_utils::installJsiFunction(uiRuntime, "_dispatchCommand", dispatchCommand);
|
|
22
|
+
jsi_utils::installJsiFunction(uiRuntime, "_measure", measure);
|
|
23
|
+
jsi_utils::installJsiFunction(uiRuntime, "_getAnimationTimestamp", getAnimationTimestamp);
|
|
24
|
+
jsi_utils::installJsiFunction(uiRuntime, "_notifyAboutProgress", progressLayoutAnimation);
|
|
25
|
+
jsi_utils::installJsiFunction(uiRuntime, "_notifyAboutEnd", endLayoutAnimation);
|
|
26
|
+
jsi_utils::installJsiFunction(uiRuntime, "_setGestureState", setGestureState);
|
|
27
|
+
jsi_utils::installJsiFunction(uiRuntime, "_obtainProp", obtainPropFunction);
|
|
28
|
+
|
|
29
|
+
subscribeForMicrotasksFinalization(uiRuntime, maybeFlushUIUpdatesQueue);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
void UIRuntimeDecorator::subscribeForMicrotasksFinalization(
|
|
33
33
|
jsi::Runtime &uiRuntime,
|
|
34
|
-
MaybeFlushUIUpdatesQueueFunction maybeFlushUIUpdatesQueue) {
|
|
34
|
+
const MaybeFlushUIUpdatesQueueFunction &maybeFlushUIUpdatesQueue) {
|
|
35
35
|
auto maybeMicrotaskQueueFinalizers = uiRuntime.global().getProperty(uiRuntime, "_microtaskQueueFinalizers");
|
|
36
36
|
|
|
37
37
|
if (maybeMicrotaskQueueFinalizers.isUndefined()) {
|
|
@@ -50,7 +50,7 @@ void UIRuntimeDecorator::subscribeForMicrotasksFinalization(
|
|
|
50
50
|
uiRuntime,
|
|
51
51
|
jsi::PropNameID::forAscii(uiRuntime, "_maybeFlushUIUpdatesQueue"),
|
|
52
52
|
0,
|
|
53
|
-
jsi_utils::createHostFunction(
|
|
53
|
+
jsi_utils::createHostFunction(maybeFlushUIUpdatesQueue)));
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
} // namespace reanimated
|
|
@@ -12,20 +12,20 @@ class UIRuntimeDecorator {
|
|
|
12
12
|
public:
|
|
13
13
|
static void decorate(
|
|
14
14
|
jsi::Runtime &uiRuntime,
|
|
15
|
-
const ObtainPropFunction obtainPropFunction,
|
|
16
|
-
const UpdatePropsFunction updateProps,
|
|
17
|
-
const MeasureFunction measure,
|
|
18
|
-
const DispatchCommandFunction dispatchCommand,
|
|
19
|
-
const GetAnimationTimestampFunction getAnimationTimestamp,
|
|
20
|
-
const SetGestureStateFunction setGestureState,
|
|
21
|
-
const ProgressLayoutAnimationFunction progressLayoutAnimation,
|
|
22
|
-
const EndLayoutAnimationFunction endLayoutAnimation,
|
|
23
|
-
const MaybeFlushUIUpdatesQueueFunction maybeFlushUIUpdatesQueue);
|
|
15
|
+
const ObtainPropFunction &obtainPropFunction,
|
|
16
|
+
const UpdatePropsFunction &updateProps,
|
|
17
|
+
const MeasureFunction &measure,
|
|
18
|
+
const DispatchCommandFunction &dispatchCommand,
|
|
19
|
+
const GetAnimationTimestampFunction &getAnimationTimestamp,
|
|
20
|
+
const SetGestureStateFunction &setGestureState,
|
|
21
|
+
const ProgressLayoutAnimationFunction &progressLayoutAnimation,
|
|
22
|
+
const EndLayoutAnimationFunction &endLayoutAnimation,
|
|
23
|
+
const MaybeFlushUIUpdatesQueueFunction &maybeFlushUIUpdatesQueue);
|
|
24
24
|
|
|
25
25
|
private:
|
|
26
26
|
static void subscribeForMicrotasksFinalization(
|
|
27
27
|
jsi::Runtime &uiRuntime,
|
|
28
|
-
MaybeFlushUIUpdatesQueueFunction maybeFlushUIUpdatesQueue);
|
|
28
|
+
const MaybeFlushUIUpdatesQueueFunction &maybeFlushUIUpdatesQueue);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
} // namespace reanimated
|
|
@@ -75,7 +75,7 @@ inline std::tuple<T, Rest...> convertArgs(jsi::Runtime &rt, const jsi::Value *ar
|
|
|
75
75
|
// native C++ types needed to call `function`
|
|
76
76
|
template <typename Ret, typename... Args>
|
|
77
77
|
std::tuple<Args...>
|
|
78
|
-
getArgsForFunction(std::function<Ret(Args...)
|
|
78
|
+
getArgsForFunction(const std::function<Ret(Args...)> &, jsi::Runtime &rt, const jsi::Value *args, const size_t count) {
|
|
79
79
|
react_native_assert(sizeof...(Args) == count && "Argument list has different length than expected");
|
|
80
80
|
return convertArgs<Args...>(rt, args);
|
|
81
81
|
}
|
|
@@ -85,7 +85,7 @@ getArgsForFunction(std::function<Ret(Args...)>, jsi::Runtime &rt, const jsi::Val
|
|
|
85
85
|
// passing `rt` as the first argument
|
|
86
86
|
template <typename Ret, typename... Args>
|
|
87
87
|
std::tuple<jsi::Runtime &, Args...> getArgsForFunction(
|
|
88
|
-
std::function<Ret(jsi::Runtime &, Args...)
|
|
88
|
+
const std::function<Ret(jsi::Runtime &, Args...)> &,
|
|
89
89
|
jsi::Runtime &rt,
|
|
90
90
|
const jsi::Value *args,
|
|
91
91
|
const size_t count) {
|
|
@@ -117,7 +117,7 @@ inline jsi::Value apply(std::function<void(Args...)> function, std::tuple<Args..
|
|
|
117
117
|
// returns a function with JSI calling convention
|
|
118
118
|
// from a native function `function`
|
|
119
119
|
template <typename Fun>
|
|
120
|
-
jsi::HostFunctionType createHostFunction(Fun function) {
|
|
120
|
+
jsi::HostFunctionType createHostFunction(const Fun &function) {
|
|
121
121
|
return [function](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, const size_t count) {
|
|
122
122
|
auto argz = getArgsForFunction(function, rt, args, count);
|
|
123
123
|
return apply(function, std::move(argz));
|
|
@@ -127,7 +127,7 @@ jsi::HostFunctionType createHostFunction(Fun function) {
|
|
|
127
127
|
// returns a function with JSI calling convention
|
|
128
128
|
// from a native function `function` returning a string
|
|
129
129
|
template <typename... Args>
|
|
130
|
-
jsi::HostFunctionType createHostFunction(std::function<std::string(Args...)> function) {
|
|
130
|
+
jsi::HostFunctionType createHostFunction(const std::function<std::string(Args...)> &function) {
|
|
131
131
|
return [function](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, const size_t count) {
|
|
132
132
|
auto argz = getArgsForFunction(function, rt, args, count);
|
|
133
133
|
return apply(rt, function, std::move(argz));
|
|
@@ -151,7 +151,7 @@ struct takes_runtime<jsi::Runtime &, Rest...> {
|
|
|
151
151
|
// and installs it as a global function named `name`
|
|
152
152
|
// in the `rt` JS runtime
|
|
153
153
|
template <typename Ret, typename... Args>
|
|
154
|
-
void installJsiFunction(jsi::Runtime &rt, std::string_view name, std::function<Ret(Args...)> function) {
|
|
154
|
+
void installJsiFunction(jsi::Runtime &rt, std::string_view name, const std::function<Ret(Args...)> &function) {
|
|
155
155
|
auto clb = createHostFunction(function);
|
|
156
156
|
auto argsCount = sizeof...(Args) - takes_runtime<Args...>::value;
|
|
157
157
|
jsi::Value jsiFunction =
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
### Nightly CI state
|
|
8
8
|
|
|
9
|
-
[](https://github.com/software-mansion/react-native-reanimated/actions/workflows/npm-reanimated-publish.yml)
|
|
10
10
|
[![Lint clang-tidy [Nightly]](https://github.com/software-mansion/react-native-reanimated/actions/workflows/lint-clang-tidy-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/lint-clang-tidy-nightly.yml)
|
|
11
11
|
[](https://github.com/software-mansion/react-native-reanimated/actions/workflows/reanimated-compatibility-check-nightly.yml)
|
|
12
12
|
[![Use frameworks Reanimated build check [Nightly]](https://github.com/software-mansion/react-native-reanimated/actions/workflows/use-frameworks-reanimated-build-check-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/use-frameworks-reanimated-build-check-nightly.yml)
|
package/android/build.gradle
CHANGED
|
@@ -43,24 +43,6 @@ def resolveReactNativeDirectory() {
|
|
|
43
43
|
throw new GradleException("[Reanimated] Unable to resolve react-native location in node_modules. You should set project extension property (in `app/build.gradle`) named `REACT_NATIVE_NODE_MODULES_DIR` with the path to react-native in node_modules.")
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
def resolveReactNativeWorkletsDirectory() {
|
|
47
|
-
def reactNativeWorkletsLocation = safeAppExtGet("REACT_NATIVE_WORKLETS_NODE_MODULES_DIR", null)
|
|
48
|
-
if (reactNativeWorkletsLocation != null) {
|
|
49
|
-
return file(reactNativeWorkletsLocation)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Fallback to node resolver for custom directory structures like monorepos.
|
|
53
|
-
def reactNativeWorkletsPackage = file(providers.exec {
|
|
54
|
-
workingDir(rootDir)
|
|
55
|
-
commandLine("node", "--print", "require.resolve('react-native-worklets/package.json')")
|
|
56
|
-
}.standardOutput.asText.get().trim())
|
|
57
|
-
if (reactNativeWorkletsPackage.exists()) {
|
|
58
|
-
return reactNativeWorkletsPackage.parentFile
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
throw new GradleException("[Reanimated] Unable to resolve react-native-worklets location in node_modules. You should set project extension property (in `app/build.gradle`) named `REACT_NATIVE_WORKLETS_NODE_MODULES_DIR` with the path to react-native-worklets in node_modules.")
|
|
62
|
-
}
|
|
63
|
-
|
|
64
46
|
def getReactNativeVersion() {
|
|
65
47
|
def reactNativeRootDir = resolveReactNativeDirectory()
|
|
66
48
|
def reactProperties = new Properties()
|
|
@@ -112,7 +94,6 @@ if (isNewArchitectureEnabled() && project != rootProject) {
|
|
|
112
94
|
|
|
113
95
|
def packageDir = project.projectDir.parentFile
|
|
114
96
|
def reactNativeRootDir = resolveReactNativeDirectory()
|
|
115
|
-
def reactNativeWorkletsRootDir = resolveReactNativeWorkletsDirectory()
|
|
116
97
|
def REACT_NATIVE_MINOR_VERSION = getReactNativeMinorVersion()
|
|
117
98
|
def REACT_NATIVE_VERSION = getReactNativeVersion()
|
|
118
99
|
def REANIMATED_VERSION = getReanimatedVersion()
|
|
@@ -138,7 +119,6 @@ buildscript {
|
|
|
138
119
|
}
|
|
139
120
|
dependencies {
|
|
140
121
|
classpath "com.android.tools.build:gradle:8.13.1"
|
|
141
|
-
classpath "de.undercouch:gradle-download-task:5.6.0"
|
|
142
122
|
classpath "com.diffplug.spotless:spotless-plugin-gradle:8.1.0"
|
|
143
123
|
}
|
|
144
124
|
}
|
|
@@ -149,7 +129,6 @@ if (project == rootProject) {
|
|
|
149
129
|
|
|
150
130
|
apply plugin: "com.android.library"
|
|
151
131
|
apply plugin: "maven-publish"
|
|
152
|
-
apply plugin: "de.undercouch.download"
|
|
153
132
|
|
|
154
133
|
android {
|
|
155
134
|
compileSdkVersion safeExtGet("compileSdkVersion", 36)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#include <react/fabric/Binding.h>
|
|
2
|
+
#include <reanimated/Compat/WorkletsApi.h>
|
|
2
3
|
#include <reanimated/RuntimeDecorators/RNRuntimeDecorator.h>
|
|
3
4
|
#include <reanimated/Tools/PlatformDepMethodsHolder.h>
|
|
4
5
|
#include <reanimated/Tools/ReanimatedVersion.h>
|
|
@@ -7,7 +8,6 @@
|
|
|
7
8
|
#include <reanimated/android/KeyboardWorkletWrapper.h>
|
|
8
9
|
#include <reanimated/android/NativeProxy.h>
|
|
9
10
|
#include <reanimated/android/SensorSetter.h>
|
|
10
|
-
#include <worklets/Compat/Holders.h>
|
|
11
11
|
|
|
12
12
|
#include <memory>
|
|
13
13
|
#include <string>
|
|
@@ -71,16 +71,11 @@ jni::local_ref<NativeProxy::jhybriddata> NativeProxy::initHybrid(
|
|
|
71
71
|
auto jsCallInvoker = jsCallInvokerHolder->cthis()->getCallInvoker();
|
|
72
72
|
auto &rnRuntime = *reinterpret_cast<jsi::Runtime *>(jsContext); // NOLINT //(performance-no-int-to-ptr)
|
|
73
73
|
const auto global = rnRuntime.global();
|
|
74
|
-
|
|
75
74
|
const auto uiRuntime =
|
|
76
|
-
|
|
77
|
-
global.getProperty(rnRuntime, "__UI_WORKLET_RUNTIME_HOLDER").asObject(rnRuntime).getNativeState(rnRuntime))
|
|
78
|
-
->runtime_;
|
|
75
|
+
getWorkletRuntimeFromHolder(rnRuntime, global.getPropertyAsObject(rnRuntime, "__UI_WORKLET_RUNTIME_HOLDER"));
|
|
79
76
|
|
|
80
77
|
const auto uiScheduler =
|
|
81
|
-
|
|
82
|
-
global.getProperty(rnRuntime, "__UI_SCHEDULER_HOLDER").asObject(rnRuntime).getNativeState(rnRuntime))
|
|
83
|
-
->scheduler_;
|
|
78
|
+
getUISchedulerFromHolder(rnRuntime, global.getPropertyAsObject(rnRuntime, "__UI_SCHEDULER_HOLDER"));
|
|
84
79
|
|
|
85
80
|
return makeCxxInstance(jThis, &rnRuntime, jsCallInvoker, fabricUIManager, uiRuntime, uiScheduler);
|
|
86
81
|
}
|
|
@@ -120,7 +115,8 @@ void NativeProxy::injectCppVersion() {
|
|
|
120
115
|
|
|
121
116
|
void NativeProxy::installJSIBindings() {
|
|
122
117
|
jsi::Runtime &rnRuntime = *rnRuntime_;
|
|
123
|
-
|
|
118
|
+
auto &uiRuntime = getJSIRuntimeFromWorkletRuntime(uiRuntime_);
|
|
119
|
+
RNRuntimeDecorator::decorate(rnRuntime, uiRuntime, reanimatedModuleProxy_);
|
|
124
120
|
}
|
|
125
121
|
|
|
126
122
|
bool NativeProxy::isAnyHandlerWaitingForEvent(const std::string &eventName, const int emitterReactTag) {
|
|
@@ -263,7 +259,7 @@ void NativeProxy::handleEvent(
|
|
|
263
259
|
return;
|
|
264
260
|
}
|
|
265
261
|
|
|
266
|
-
auto &uiRuntime = uiRuntime_
|
|
262
|
+
auto &uiRuntime = getJSIRuntimeFromWorkletRuntime(uiRuntime_);
|
|
267
263
|
jsi::Value payload;
|
|
268
264
|
try {
|
|
269
265
|
payload = jsi::Value::createFromJsonUtf8(uiRuntime, reinterpret_cast<uint8_t *>(&eventJSON[0]), eventJSON.size());
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
#include <react/fabric/JFabricUIManager.h>
|
|
7
7
|
#include <react/jni/WritableNativeMap.h>
|
|
8
8
|
#include <react/renderer/scheduler/Scheduler.h>
|
|
9
|
+
#include <reanimated/Compat/WorkletsApi.h>
|
|
9
10
|
#include <reanimated/NativeModules/ReanimatedModuleProxy.h>
|
|
10
|
-
#include <worklets/Tools/UIScheduler.h>
|
|
11
|
-
#include <worklets/WorkletRuntime/WorkletRuntime.h>
|
|
12
11
|
|
|
13
12
|
#include <memory>
|
|
14
13
|
#include <string>
|