react-native-reanimated 3.0.0-rc.7 → 3.0.0-rc.9
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/AnimatedSensor/AnimatedSensorModule.cpp +32 -37
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +4 -3
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +76 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +41 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +168 -167
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +36 -34
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +22 -34
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +13 -14
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +30 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +1 -1
- package/Common/cpp/SharedItems/RuntimeManager.h +1 -34
- package/Common/cpp/SharedItems/Shareables.cpp +144 -0
- package/Common/cpp/SharedItems/Shareables.h +470 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +79 -50
- package/Common/cpp/Tools/RuntimeDecorator.h +13 -3
- package/Common/cpp/Tools/Scheduler.cpp +10 -0
- package/Common/cpp/Tools/SingleInstanceChecker.h +1 -1
- package/android/src/main/cpp/LayoutAnimations.cpp +6 -16
- package/android/src/main/cpp/LayoutAnimations.h +4 -4
- package/android/src/main/cpp/NativeProxy.cpp +50 -63
- package/ios/LayoutReanimation/REAAnimationsManager.h +3 -1
- package/ios/LayoutReanimation/REAAnimationsManager.m +49 -16
- package/ios/LayoutReanimation/REAUIManager.mm +22 -62
- package/ios/native/NativeProxy.mm +26 -42
- package/lib/commonjs/createAnimatedComponent.js +7 -11
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +27 -55
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -3
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +7 -0
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/component/FlatList.js +19 -3
- package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +74 -240
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/errors.js +66 -0
- package/lib/commonjs/reanimated2/errors.js.map +1 -0
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +15 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +18 -8
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +27 -36
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +23 -59
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +157 -0
- package/lib/commonjs/reanimated2/initializers.js.map +1 -0
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +8 -33
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +14 -103
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +4 -7
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +5 -0
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +87 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/mappers.js +186 -0
- package/lib/commonjs/reanimated2/mappers.js.map +1 -0
- package/lib/commonjs/reanimated2/mock.js +26 -0
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/mutables.js +173 -0
- package/lib/commonjs/reanimated2/mutables.js.map +1 -0
- package/lib/commonjs/reanimated2/shareables.js +159 -0
- package/lib/commonjs/reanimated2/shareables.js.map +1 -0
- package/lib/commonjs/reanimated2/threads.js +58 -0
- package/lib/commonjs/reanimated2/threads.js.map +1 -0
- package/lib/commonjs/reanimated2/time.js +55 -0
- package/lib/commonjs/reanimated2/time.js.map +1 -0
- package/lib/commonjs/reanimated2/valueSetter.js +81 -0
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -0
- package/lib/module/createAnimatedComponent.js +7 -12
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js +27 -53
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +4 -3
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +7 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +18 -4
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/core.js +33 -226
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +58 -0
- package/lib/module/reanimated2/errors.js.map +1 -0
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +16 -6
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +17 -8
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +29 -34
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +26 -62
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +143 -0
- package/lib/module/reanimated2/initializers.js.map +1 -0
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +8 -31
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +14 -98
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +4 -7
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +5 -0
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +82 -0
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/index.js +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +173 -0
- package/lib/module/reanimated2/mappers.js.map +1 -0
- package/lib/module/reanimated2/mock.js +26 -0
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +149 -0
- package/lib/module/reanimated2/mutables.js.map +1 -0
- package/lib/module/reanimated2/shareables.js +138 -0
- package/lib/module/reanimated2/shareables.js.map +1 -0
- package/lib/module/reanimated2/threads.js +45 -0
- package/lib/module/reanimated2/threads.js.map +1 -0
- package/lib/module/reanimated2/time.js +37 -0
- package/lib/module/reanimated2/time.js.map +1 -0
- package/lib/module/reanimated2/valueSetter.js +66 -0
- package/lib/module/reanimated2/valueSetter.js.map +1 -0
- package/package.json +3 -2
- package/plugin.js +112 -30
- package/src/createAnimatedComponent.tsx +8 -24
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +43 -53
- package/src/reanimated2/ViewDescriptorsSet.ts +30 -69
- package/src/reanimated2/WorkletEventHandler.ts +4 -11
- package/src/reanimated2/animation/util.ts +1 -0
- package/src/reanimated2/commonTypes.ts +29 -4
- package/src/reanimated2/component/FlatList.tsx +30 -5
- package/src/reanimated2/core.ts +68 -258
- package/src/reanimated2/errors.ts +57 -0
- package/src/reanimated2/globals.d.ts +48 -29
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +18 -9
- package/src/reanimated2/hook/useAnimatedRef.ts +27 -9
- package/src/reanimated2/hook/useAnimatedSensor.ts +33 -31
- package/src/reanimated2/hook/useAnimatedStyle.ts +26 -74
- package/src/reanimated2/hook/useSharedValue.ts +6 -3
- package/src/reanimated2/hook/utils.ts +1 -1
- package/src/reanimated2/initializers.ts +143 -0
- package/src/reanimated2/interpolateColor.ts +2 -2
- package/src/reanimated2/jestUtils.ts +14 -29
- package/src/reanimated2/js-reanimated/JSReanimated.ts +24 -94
- package/src/reanimated2/js-reanimated/global.ts +4 -7
- package/src/reanimated2/js-reanimated/index.ts +4 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +7 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/animationsManager.ts +91 -0
- package/src/reanimated2/layoutReanimation/index.ts +1 -1
- package/src/reanimated2/mappers.ts +179 -0
- package/src/reanimated2/mock.ts +105 -0
- package/src/reanimated2/mutables.ts +151 -0
- package/src/reanimated2/shareables.ts +128 -0
- package/src/reanimated2/threads.ts +46 -0
- package/src/reanimated2/time.ts +30 -0
- package/src/reanimated2/valueSetter.ts +64 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +0 -127
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +0 -56
- package/Common/cpp/Registries/MapperRegistry.cpp +0 -147
- package/Common/cpp/Registries/MapperRegistry.h +0 -29
- package/Common/cpp/Registries/WorkletsCache.cpp +0 -45
- package/Common/cpp/Registries/WorkletsCache.h +0 -24
- package/Common/cpp/SharedItems/FrozenObject.cpp +0 -35
- package/Common/cpp/SharedItems/FrozenObject.h +0 -36
- package/Common/cpp/SharedItems/HostFunctionHandler.h +0 -28
- package/Common/cpp/SharedItems/MutableValue.cpp +0 -134
- package/Common/cpp/SharedItems/MutableValue.h +0 -54
- package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +0 -47
- package/Common/cpp/SharedItems/MutableValueSetterProxy.h +0 -25
- package/Common/cpp/SharedItems/RemoteObject.cpp +0 -45
- package/Common/cpp/SharedItems/RemoteObject.h +0 -35
- package/Common/cpp/SharedItems/ShareableValue.cpp +0 -529
- package/Common/cpp/SharedItems/ShareableValue.h +0 -63
- package/Common/cpp/SharedItems/ValueWrapper.h +0 -183
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +0 -55
- package/Common/cpp/Tools/JSIStoreValueUser.h +0 -37
- package/Common/cpp/Tools/Mapper.cpp +0 -86
- package/Common/cpp/Tools/Mapper.h +0 -51
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -58
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -52
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +0 -49
|
@@ -19,84 +19,37 @@
|
|
|
19
19
|
|
|
20
20
|
#include "EventHandlerRegistry.h"
|
|
21
21
|
#include "FeaturesConfig.h"
|
|
22
|
-
#include "FrozenObject.h"
|
|
23
|
-
#include "JSIStoreValueUser.h"
|
|
24
|
-
#include "Mapper.h"
|
|
25
|
-
#include "MapperRegistry.h"
|
|
26
|
-
#include "MutableValue.h"
|
|
27
22
|
#include "ReanimatedHiddenHeaders.h"
|
|
28
23
|
#include "RuntimeDecorator.h"
|
|
29
|
-
#include "
|
|
24
|
+
#include "Shareables.h"
|
|
30
25
|
#include "WorkletEventHandler.h"
|
|
31
26
|
|
|
32
27
|
using namespace facebook;
|
|
33
28
|
|
|
34
29
|
namespace reanimated {
|
|
35
30
|
|
|
36
|
-
void extractMutables(
|
|
37
|
-
jsi::Runtime &rt,
|
|
38
|
-
std::shared_ptr<ShareableValue> sv,
|
|
39
|
-
std::vector<std::shared_ptr<MutableValue>> &res) {
|
|
40
|
-
switch (sv->type) {
|
|
41
|
-
case ValueType::MutableValueType: {
|
|
42
|
-
auto &mutableValue = ValueWrapper::asMutableValue(sv->valueContainer);
|
|
43
|
-
res.push_back(mutableValue);
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
case ValueType::FrozenArrayType:
|
|
47
|
-
for (auto &it : ValueWrapper::asFrozenArray(sv->valueContainer)) {
|
|
48
|
-
extractMutables(rt, it, res);
|
|
49
|
-
}
|
|
50
|
-
break;
|
|
51
|
-
case ValueType::RemoteObjectType:
|
|
52
|
-
case ValueType::FrozenObjectType:
|
|
53
|
-
for (auto &it : ValueWrapper::asFrozenObject(sv->valueContainer)->map) {
|
|
54
|
-
extractMutables(rt, it.second, res);
|
|
55
|
-
}
|
|
56
|
-
break;
|
|
57
|
-
default:
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
std::vector<std::shared_ptr<MutableValue>> extractMutablesFromArray(
|
|
63
|
-
jsi::Runtime &rt,
|
|
64
|
-
const jsi::Array &array,
|
|
65
|
-
NativeReanimatedModule *module) {
|
|
66
|
-
std::vector<std::shared_ptr<MutableValue>> res;
|
|
67
|
-
for (size_t i = 0, size = array.size(rt); i < size; i++) {
|
|
68
|
-
auto shareable =
|
|
69
|
-
ShareableValue::adapt(rt, array.getValueAtIndex(rt, i), module);
|
|
70
|
-
extractMutables(rt, shareable, res);
|
|
71
|
-
}
|
|
72
|
-
return res;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
31
|
NativeReanimatedModule::NativeReanimatedModule(
|
|
76
|
-
std::shared_ptr<CallInvoker> jsInvoker,
|
|
77
|
-
std::shared_ptr<Scheduler> scheduler,
|
|
78
|
-
std::shared_ptr<jsi::Runtime> rt,
|
|
79
|
-
std::shared_ptr<ErrorHandler> errorHandler,
|
|
32
|
+
const std::shared_ptr<CallInvoker> &jsInvoker,
|
|
33
|
+
const std::shared_ptr<Scheduler> &scheduler,
|
|
34
|
+
const std::shared_ptr<jsi::Runtime> &rt,
|
|
35
|
+
const std::shared_ptr<ErrorHandler> &errorHandler,
|
|
80
36
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
81
37
|
// nothing
|
|
82
38
|
#else
|
|
83
39
|
std::function<jsi::Value(jsi::Runtime &, const int, const jsi::String &)>
|
|
84
40
|
propObtainer,
|
|
85
41
|
#endif
|
|
86
|
-
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy,
|
|
87
42
|
PlatformDepMethodsHolder platformDepMethodsHolder)
|
|
88
43
|
: NativeReanimatedModuleSpec(jsInvoker),
|
|
89
44
|
RuntimeManager(rt, errorHandler, scheduler, RuntimeType::UI),
|
|
90
|
-
|
|
91
|
-
mapperRegistry(std::make_shared<MapperRegistry>()),
|
|
92
|
-
eventHandlerRegistry(std::make_shared<EventHandlerRegistry>()),
|
|
45
|
+
eventHandlerRegistry(std::make_unique<EventHandlerRegistry>()),
|
|
93
46
|
requestRender(platformDepMethodsHolder.requestRender),
|
|
94
47
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
95
48
|
// nothing
|
|
96
49
|
#else
|
|
97
50
|
propObtainer(propObtainer),
|
|
98
51
|
#endif
|
|
99
|
-
animatedSensorModule(platformDepMethodsHolder
|
|
52
|
+
animatedSensorModule(platformDepMethodsHolder),
|
|
100
53
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
101
54
|
synchronouslyUpdateUIPropsFunction(
|
|
102
55
|
platformDepMethodsHolder.synchronouslyUpdateUIPropsFunction)
|
|
@@ -105,12 +58,58 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
105
58
|
platformDepMethodsHolder.configurePropsFunction)
|
|
106
59
|
#endif
|
|
107
60
|
{
|
|
108
|
-
auto requestAnimationFrame = [=](
|
|
109
|
-
|
|
61
|
+
auto requestAnimationFrame = [=](jsi::Runtime &rt, const jsi::Value &fn) {
|
|
62
|
+
auto jsFunction = std::make_shared<jsi::Value>(rt, fn);
|
|
63
|
+
frameCallbacks.push_back([=](double timestamp) {
|
|
64
|
+
runtimeHelper->runOnUIGuarded(*jsFunction, jsi::Value(timestamp));
|
|
65
|
+
});
|
|
110
66
|
maybeRequestRender();
|
|
111
67
|
};
|
|
112
68
|
|
|
113
|
-
|
|
69
|
+
auto scheduleOnJS = [this](
|
|
70
|
+
jsi::Runtime &rt,
|
|
71
|
+
const jsi::Value &remoteFun,
|
|
72
|
+
const jsi::Value &argsValue) {
|
|
73
|
+
auto shareableRemoteFun = extractShareableOrThrow<ShareableRemoteFunction>(
|
|
74
|
+
rt,
|
|
75
|
+
remoteFun,
|
|
76
|
+
"Incompatible object passed to scheduleOnJS. It is only allowed to schedule functions defined on the React Native JS runtime this way.");
|
|
77
|
+
auto shareableArgs = argsValue.isUndefined()
|
|
78
|
+
? nullptr
|
|
79
|
+
: extractShareableOrThrow(rt, argsValue);
|
|
80
|
+
auto jsRuntime = this->runtimeHelper->rnRuntime();
|
|
81
|
+
this->scheduler->scheduleOnJS([=] {
|
|
82
|
+
jsi::Runtime &rt = *jsRuntime;
|
|
83
|
+
auto remoteFun = shareableRemoteFun->getJSValue(rt);
|
|
84
|
+
if (shareableArgs == nullptr) {
|
|
85
|
+
// fast path for remote function w/o arguments
|
|
86
|
+
remoteFun.asObject(rt).asFunction(rt).call(rt);
|
|
87
|
+
} else {
|
|
88
|
+
auto argsArray = shareableArgs->getJSValue(rt).asObject(rt).asArray(rt);
|
|
89
|
+
auto argsSize = argsArray.size(rt);
|
|
90
|
+
// number of arguments is typically relatively small so it is ok to
|
|
91
|
+
// to use VLAs here, hence disabling the lint rule
|
|
92
|
+
jsi::Value args[argsSize]; // NOLINT(runtime/arrays)
|
|
93
|
+
for (size_t i = 0; i < argsSize; i++) {
|
|
94
|
+
args[i] = argsArray.getValueAtIndex(rt, i);
|
|
95
|
+
}
|
|
96
|
+
remoteFun.asObject(rt).asFunction(rt).call(rt, args, argsSize);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
auto makeShareableClone = [this](jsi::Runtime &rt, const jsi::Value &value) {
|
|
102
|
+
return this->makeShareableClone(rt, value);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
auto updateDataSynchronously =
|
|
106
|
+
[this](
|
|
107
|
+
jsi::Runtime &rt,
|
|
108
|
+
const jsi::Value &synchronizedDataHolderRef,
|
|
109
|
+
const jsi::Value &newData) {
|
|
110
|
+
return this->updateDataSynchronously(
|
|
111
|
+
rt, synchronizedDataHolderRef, newData);
|
|
112
|
+
};
|
|
114
113
|
|
|
115
114
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
116
115
|
auto updateProps = [this](
|
|
@@ -151,11 +150,15 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
151
150
|
platformDepMethodsHolder.scrollToFunction,
|
|
152
151
|
#endif
|
|
153
152
|
requestAnimationFrame,
|
|
153
|
+
scheduleOnJS,
|
|
154
|
+
makeShareableClone,
|
|
155
|
+
updateDataSynchronously,
|
|
154
156
|
platformDepMethodsHolder.getCurrentTime,
|
|
155
157
|
platformDepMethodsHolder.registerSensor,
|
|
156
158
|
platformDepMethodsHolder.unregisterSensor,
|
|
157
159
|
platformDepMethodsHolder.setGestureStateFunction,
|
|
158
|
-
|
|
160
|
+
platformDepMethodsHolder.progressLayoutAnimation,
|
|
161
|
+
platformDepMethodsHolder.endLayoutAnimation);
|
|
159
162
|
onRenderCallback = [this](double timestampMs) {
|
|
160
163
|
this->renderRequested = false;
|
|
161
164
|
this->onRender(timestampMs);
|
|
@@ -174,87 +177,111 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
174
177
|
|
|
175
178
|
void NativeReanimatedModule::installCoreFunctions(
|
|
176
179
|
jsi::Runtime &rt,
|
|
177
|
-
const jsi::Value &
|
|
178
|
-
|
|
180
|
+
const jsi::Value &callGuard,
|
|
181
|
+
const jsi::Value &valueUnpacker) {
|
|
182
|
+
if (!runtimeHelper) {
|
|
183
|
+
// initialize runtimeHelper here if not already present. We expect only one
|
|
184
|
+
// instace of the helper to exists.
|
|
185
|
+
runtimeHelper =
|
|
186
|
+
std::make_shared<JSRuntimeHelper>(&rt, this->runtime.get(), scheduler);
|
|
187
|
+
}
|
|
188
|
+
runtimeHelper->callGuard =
|
|
189
|
+
std::make_unique<CoreFunction>(runtimeHelper.get(), callGuard);
|
|
190
|
+
runtimeHelper->valueUnpacker =
|
|
191
|
+
std::make_unique<CoreFunction>(runtimeHelper.get(), valueUnpacker);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
NativeReanimatedModule::~NativeReanimatedModule() {
|
|
195
|
+
if (runtimeHelper) {
|
|
196
|
+
runtimeHelper->callGuard = nullptr;
|
|
197
|
+
runtimeHelper->valueUnpacker = nullptr;
|
|
198
|
+
// event handler registry and frame callbacks store some JSI values from UI
|
|
199
|
+
// runtime, so they have to go away before we tear down the runtime
|
|
200
|
+
eventHandlerRegistry.reset();
|
|
201
|
+
frameCallbacks.clear();
|
|
202
|
+
runtime.reset();
|
|
203
|
+
// make sure uiRuntimeDestroyed is set after the runtime is deallocated
|
|
204
|
+
runtimeHelper->uiRuntimeDestroyed = true;
|
|
205
|
+
}
|
|
179
206
|
}
|
|
180
207
|
|
|
181
|
-
|
|
208
|
+
void NativeReanimatedModule::scheduleOnUI(
|
|
182
209
|
jsi::Runtime &rt,
|
|
183
|
-
const jsi::Value &
|
|
184
|
-
|
|
210
|
+
const jsi::Value &worklet) {
|
|
211
|
+
auto shareableWorklet = extractShareableOrThrow(rt, worklet);
|
|
212
|
+
assert(
|
|
213
|
+
shareableWorklet->valueType() == Shareable::WorkletType &&
|
|
214
|
+
"only worklets can be scheduled to run on UI");
|
|
215
|
+
scheduler->scheduleOnUI([=] {
|
|
216
|
+
jsi::Runtime &rt = *runtimeHelper->uiRuntime();
|
|
217
|
+
auto workletValue = shareableWorklet->getJSValue(rt);
|
|
218
|
+
runtimeHelper->runOnUIGuarded(workletValue);
|
|
219
|
+
});
|
|
185
220
|
}
|
|
186
221
|
|
|
187
|
-
jsi::Value NativeReanimatedModule::
|
|
222
|
+
jsi::Value NativeReanimatedModule::makeSynchronizedDataHolder(
|
|
188
223
|
jsi::Runtime &rt,
|
|
189
|
-
const jsi::Value &
|
|
190
|
-
|
|
191
|
-
|
|
224
|
+
const jsi::Value &initialShareable) {
|
|
225
|
+
auto dataHolder = std::make_shared<ShareableSynchronizedDataHolder>(
|
|
226
|
+
runtimeHelper, rt, initialShareable);
|
|
227
|
+
return dataHolder->getJSValue(rt);
|
|
192
228
|
}
|
|
193
229
|
|
|
194
|
-
|
|
230
|
+
void NativeReanimatedModule::updateDataSynchronously(
|
|
195
231
|
jsi::Runtime &rt,
|
|
196
|
-
const jsi::Value &
|
|
197
|
-
|
|
198
|
-
|
|
232
|
+
const jsi::Value &synchronizedDataHolderRef,
|
|
233
|
+
const jsi::Value &newData) {
|
|
234
|
+
auto dataHolder = extractShareableOrThrow<ShareableSynchronizedDataHolder>(
|
|
235
|
+
rt, synchronizedDataHolderRef);
|
|
236
|
+
dataHolder->set(rt, newData);
|
|
199
237
|
}
|
|
200
238
|
|
|
201
|
-
jsi::Value NativeReanimatedModule::
|
|
239
|
+
jsi::Value NativeReanimatedModule::getDataSynchronously(
|
|
202
240
|
jsi::Runtime &rt,
|
|
203
|
-
const jsi::Value &
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const jsi::Value &viewDescriptors) {
|
|
208
|
-
static unsigned long MAPPER_ID = 1;
|
|
209
|
-
|
|
210
|
-
unsigned long newMapperId = MAPPER_ID++;
|
|
211
|
-
auto mapperShareable = ShareableValue::adapt(rt, worklet, this);
|
|
212
|
-
auto inputMutables =
|
|
213
|
-
extractMutablesFromArray(rt, inputs.asObject(rt).asArray(rt), this);
|
|
214
|
-
auto outputMutables =
|
|
215
|
-
extractMutablesFromArray(rt, outputs.asObject(rt).asArray(rt), this);
|
|
216
|
-
|
|
217
|
-
int optimalizationLvl = 0;
|
|
218
|
-
auto optimalization =
|
|
219
|
-
updater.asObject(rt).getProperty(rt, "__optimalization");
|
|
220
|
-
if (optimalization.isNumber()) {
|
|
221
|
-
optimalizationLvl = optimalization.asNumber();
|
|
222
|
-
}
|
|
223
|
-
auto updaterSV = ShareableValue::adapt(rt, updater, this);
|
|
224
|
-
auto viewDescriptorsSV = ShareableValue::adapt(rt, viewDescriptors, this);
|
|
225
|
-
|
|
226
|
-
scheduler->scheduleOnUI([=] {
|
|
227
|
-
auto mapperFunction =
|
|
228
|
-
mapperShareable->getValue(*runtime).asObject(*runtime).asFunction(
|
|
229
|
-
*runtime);
|
|
230
|
-
std::shared_ptr<jsi::Function> mapperFunctionPointer =
|
|
231
|
-
std::make_shared<jsi::Function>(std::move(mapperFunction));
|
|
232
|
-
|
|
233
|
-
std::shared_ptr<Mapper> mapperPointer = std::make_shared<Mapper>(
|
|
234
|
-
this,
|
|
235
|
-
newMapperId,
|
|
236
|
-
mapperFunctionPointer,
|
|
237
|
-
inputMutables,
|
|
238
|
-
outputMutables);
|
|
239
|
-
if (optimalizationLvl > 0) {
|
|
240
|
-
mapperPointer->enableFastMode(
|
|
241
|
-
optimalizationLvl, updaterSV, viewDescriptorsSV);
|
|
242
|
-
}
|
|
243
|
-
mapperRegistry->startMapper(mapperPointer);
|
|
244
|
-
maybeRequestRender();
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
return jsi::Value(static_cast<double>(newMapperId));
|
|
241
|
+
const jsi::Value &synchronizedDataHolderRef) {
|
|
242
|
+
auto dataHolder = extractShareableOrThrow<ShareableSynchronizedDataHolder>(
|
|
243
|
+
rt, synchronizedDataHolderRef);
|
|
244
|
+
return dataHolder->get(rt);
|
|
248
245
|
}
|
|
249
246
|
|
|
250
|
-
|
|
247
|
+
jsi::Value NativeReanimatedModule::makeShareableClone(
|
|
251
248
|
jsi::Runtime &rt,
|
|
252
|
-
const jsi::Value &
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
const jsi::Value &value) {
|
|
250
|
+
std::shared_ptr<Shareable> shareable;
|
|
251
|
+
if (value.isObject()) {
|
|
252
|
+
auto object = value.asObject(rt);
|
|
253
|
+
if (!object.getProperty(rt, "__workletHash").isUndefined()) {
|
|
254
|
+
shareable = std::make_shared<ShareableWorklet>(runtimeHelper, rt, object);
|
|
255
|
+
} else if (!object.getProperty(rt, "__init").isUndefined()) {
|
|
256
|
+
shareable = std::make_shared<ShareableHandle>(runtimeHelper, rt, object);
|
|
257
|
+
} else if (object.isFunction(rt)) {
|
|
258
|
+
shareable = std::make_shared<ShareableRemoteFunction>(
|
|
259
|
+
runtimeHelper, rt, object.asFunction(rt));
|
|
260
|
+
} else if (object.isArray(rt)) {
|
|
261
|
+
shareable = std::make_shared<ShareableArray>(
|
|
262
|
+
runtimeHelper, rt, object.asArray(rt));
|
|
263
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
264
|
+
} else if (object.isHostObject<ShadowNodeWrapper>(rt)) {
|
|
265
|
+
shareable = std::make_shared<ShareableShadowNodeWrapper>(
|
|
266
|
+
runtimeHelper, rt, object);
|
|
267
|
+
#endif
|
|
268
|
+
} else {
|
|
269
|
+
shareable = std::make_shared<ShareableObject>(runtimeHelper, rt, object);
|
|
270
|
+
}
|
|
271
|
+
} else if (value.isString()) {
|
|
272
|
+
shareable = std::make_shared<ShareableString>(rt, value.asString(rt));
|
|
273
|
+
} else if (value.isUndefined()) {
|
|
274
|
+
shareable = std::make_shared<ShareableScalar>();
|
|
275
|
+
} else if (value.isNull()) {
|
|
276
|
+
shareable = std::make_shared<ShareableScalar>(nullptr);
|
|
277
|
+
} else if (value.isBool()) {
|
|
278
|
+
shareable = std::make_shared<ShareableScalar>(value.getBool());
|
|
279
|
+
} else if (value.isNumber()) {
|
|
280
|
+
shareable = std::make_shared<ShareableScalar>(value.getNumber());
|
|
281
|
+
} else {
|
|
282
|
+
throw std::runtime_error("attempted to convert an unsupported value type");
|
|
283
|
+
}
|
|
284
|
+
return ShareableJSRef::newHostObject(rt, shareable);
|
|
258
285
|
}
|
|
259
286
|
|
|
260
287
|
jsi::Value NativeReanimatedModule::registerEventHandler(
|
|
@@ -265,12 +292,12 @@ jsi::Value NativeReanimatedModule::registerEventHandler(
|
|
|
265
292
|
|
|
266
293
|
unsigned long newRegistrationId = EVENT_HANDLER_ID++;
|
|
267
294
|
auto eventName = eventHash.asString(rt).utf8(rt);
|
|
268
|
-
auto handlerShareable =
|
|
295
|
+
auto handlerShareable = extractShareableOrThrow(rt, worklet);
|
|
269
296
|
|
|
270
297
|
scheduler->scheduleOnUI([=] {
|
|
298
|
+
jsi::Runtime &rt = *runtimeHelper->uiRuntime();
|
|
271
299
|
auto handlerFunction =
|
|
272
|
-
handlerShareable->
|
|
273
|
-
*runtime);
|
|
300
|
+
handlerShareable->getJSValue(rt).asObject(rt).asFunction(rt);
|
|
274
301
|
auto handler = std::make_shared<WorkletEventHandler>(
|
|
275
302
|
newRegistrationId, eventName, std::move(handlerFunction));
|
|
276
303
|
eventHandlerRegistry->registerEventHandler(handler);
|
|
@@ -342,13 +369,11 @@ jsi::Value NativeReanimatedModule::configureLayoutAnimation(
|
|
|
342
369
|
jsi::Runtime &rt,
|
|
343
370
|
const jsi::Value &viewTag,
|
|
344
371
|
const jsi::Value &type,
|
|
345
|
-
const jsi::Value &config
|
|
346
|
-
|
|
347
|
-
layoutAnimationsProxy_->configureAnimation(
|
|
372
|
+
const jsi::Value &config) {
|
|
373
|
+
layoutAnimationsManager_.configureAnimation(
|
|
348
374
|
viewTag.asNumber(),
|
|
349
375
|
type.asString(rt).utf8(rt),
|
|
350
|
-
|
|
351
|
-
ShareableValue::adapt(rt, viewSharedValue, this));
|
|
376
|
+
extractShareableOrThrow(rt, config));
|
|
352
377
|
return jsi::Value::undefined();
|
|
353
378
|
}
|
|
354
379
|
|
|
@@ -366,10 +391,6 @@ void NativeReanimatedModule::onEvent(
|
|
|
366
391
|
#else
|
|
367
392
|
eventHandlerRegistry->processEvent(*runtime, eventName, eventAsString);
|
|
368
393
|
#endif
|
|
369
|
-
mapperRegistry->execute(*runtime);
|
|
370
|
-
if (mapperRegistry->needRunOnRender()) {
|
|
371
|
-
maybeRequestRender();
|
|
372
|
-
}
|
|
373
394
|
} catch (std::exception &e) {
|
|
374
395
|
std::string str = e.what();
|
|
375
396
|
this->errorHandler->setError(str);
|
|
@@ -400,11 +421,6 @@ void NativeReanimatedModule::onRender(double timestampMs) {
|
|
|
400
421
|
for (auto &callback : callbacks) {
|
|
401
422
|
callback(timestampMs);
|
|
402
423
|
}
|
|
403
|
-
mapperRegistry->execute(*runtime);
|
|
404
|
-
|
|
405
|
-
if (mapperRegistry->needRunOnRender()) {
|
|
406
|
-
maybeRequestRender();
|
|
407
|
-
}
|
|
408
424
|
} catch (std::exception &e) {
|
|
409
425
|
std::string str = e.what();
|
|
410
426
|
this->errorHandler->setError(str);
|
|
@@ -420,9 +436,9 @@ jsi::Value NativeReanimatedModule::registerSensor(
|
|
|
420
436
|
jsi::Runtime &rt,
|
|
421
437
|
const jsi::Value &sensorType,
|
|
422
438
|
const jsi::Value &interval,
|
|
423
|
-
const jsi::Value &
|
|
439
|
+
const jsi::Value &sensorDataHandler) {
|
|
424
440
|
return animatedSensorModule.registerSensor(
|
|
425
|
-
rt, sensorType, interval,
|
|
441
|
+
rt, runtimeHelper, sensorType, interval, sensorDataHandler);
|
|
426
442
|
}
|
|
427
443
|
|
|
428
444
|
void NativeReanimatedModule::unregisterSensor(
|
|
@@ -645,30 +661,15 @@ void NativeReanimatedModule::setNewestShadowNodesRegistry(
|
|
|
645
661
|
|
|
646
662
|
jsi::Value NativeReanimatedModule::subscribeForKeyboardEvents(
|
|
647
663
|
jsi::Runtime &rt,
|
|
648
|
-
const jsi::Value &
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
auto keyboardEventDataUpdater =
|
|
658
|
-
[this, &rt, keyboardStateShared, heightShared](
|
|
659
|
-
int keyboardState, int height) {
|
|
660
|
-
auto &keyboardStateValue =
|
|
661
|
-
ValueWrapper::asMutableValue(keyboardStateShared->valueContainer);
|
|
662
|
-
keyboardStateValue->setValue(rt, jsi::Value(keyboardState));
|
|
663
|
-
|
|
664
|
-
auto &heightMutableValue =
|
|
665
|
-
ValueWrapper::asMutableValue(heightShared->valueContainer);
|
|
666
|
-
heightMutableValue->setValue(rt, jsi::Value(height));
|
|
667
|
-
|
|
668
|
-
this->mapperRegistry->execute(*this->runtime);
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
return subscribeForKeyboardEventsFunction(keyboardEventDataUpdater);
|
|
664
|
+
const jsi::Value &handlerWorklet) {
|
|
665
|
+
auto shareableHandler = extractShareableOrThrow(rt, handlerWorklet);
|
|
666
|
+
auto uiRuntime = runtimeHelper->uiRuntime();
|
|
667
|
+
return subscribeForKeyboardEventsFunction([=](int keyboardState, int height) {
|
|
668
|
+
jsi::Runtime &rt = *uiRuntime;
|
|
669
|
+
auto handler = shareableHandler->getJSValue(rt);
|
|
670
|
+
handler.asObject(rt).asFunction(rt).call(
|
|
671
|
+
rt, jsi::Value(keyboardState), jsi::Value(height));
|
|
672
|
+
});
|
|
672
673
|
}
|
|
673
674
|
|
|
674
675
|
void NativeReanimatedModule::unsubscribeFromKeyboardEvents(
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
#include "AnimatedSensorModule.h"
|
|
15
15
|
#include "ErrorHandler.h"
|
|
16
|
-
#include "
|
|
16
|
+
#include "LayoutAnimationsManager.h"
|
|
17
17
|
#include "NativeReanimatedModuleSpec.h"
|
|
18
18
|
#include "PlatformDepMethodsHolder.h"
|
|
19
19
|
#include "RuntimeDecorator.h"
|
|
@@ -25,46 +25,48 @@ namespace reanimated {
|
|
|
25
25
|
|
|
26
26
|
using FrameCallback = std::function<void(double)>;
|
|
27
27
|
|
|
28
|
-
class ShareableValue;
|
|
29
|
-
class MutableValue;
|
|
30
|
-
class MapperRegistry;
|
|
31
28
|
class EventHandlerRegistry;
|
|
32
29
|
|
|
33
30
|
class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
34
31
|
public RuntimeManager {
|
|
35
|
-
friend ShareableValue;
|
|
36
|
-
friend MutableValue;
|
|
37
|
-
|
|
38
32
|
public:
|
|
39
33
|
NativeReanimatedModule(
|
|
40
|
-
std::shared_ptr<CallInvoker> jsInvoker,
|
|
41
|
-
std::shared_ptr<Scheduler> scheduler,
|
|
42
|
-
std::shared_ptr<jsi::Runtime> rt,
|
|
43
|
-
std::shared_ptr<ErrorHandler> errorHandler,
|
|
34
|
+
const std::shared_ptr<CallInvoker> &jsInvoker,
|
|
35
|
+
const std::shared_ptr<Scheduler> &scheduler,
|
|
36
|
+
const std::shared_ptr<jsi::Runtime> &rt,
|
|
37
|
+
const std::shared_ptr<ErrorHandler> &errorHandler,
|
|
44
38
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
45
39
|
// nothing
|
|
46
40
|
#else
|
|
47
41
|
std::function<jsi::Value(jsi::Runtime &, const int, const jsi::String &)>
|
|
48
42
|
propObtainer,
|
|
49
43
|
#endif
|
|
50
|
-
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy,
|
|
51
44
|
PlatformDepMethodsHolder platformDepMethodsHolder);
|
|
52
45
|
|
|
53
|
-
|
|
54
|
-
override;
|
|
46
|
+
~NativeReanimatedModule();
|
|
55
47
|
|
|
56
|
-
|
|
57
|
-
jsi::Value makeMutable(jsi::Runtime &rt, const jsi::Value &value) override;
|
|
58
|
-
jsi::Value makeRemote(jsi::Runtime &rt, const jsi::Value &value) override;
|
|
48
|
+
std::shared_ptr<JSRuntimeHelper> runtimeHelper;
|
|
59
49
|
|
|
60
|
-
|
|
50
|
+
void installCoreFunctions(
|
|
61
51
|
jsi::Runtime &rt,
|
|
62
|
-
const jsi::Value &
|
|
63
|
-
const jsi::Value &
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
const jsi::Value &callGuard,
|
|
53
|
+
const jsi::Value &valueUnpacker) override;
|
|
54
|
+
|
|
55
|
+
jsi::Value makeShareableClone(jsi::Runtime &rt, const jsi::Value &value)
|
|
56
|
+
override;
|
|
57
|
+
|
|
58
|
+
jsi::Value makeSynchronizedDataHolder(
|
|
59
|
+
jsi::Runtime &rt,
|
|
60
|
+
const jsi::Value &initialShareable) override;
|
|
61
|
+
jsi::Value getDataSynchronously(
|
|
62
|
+
jsi::Runtime &rt,
|
|
63
|
+
const jsi::Value &synchronizedDataHolderRef) override;
|
|
64
|
+
void updateDataSynchronously(
|
|
65
|
+
jsi::Runtime &rt,
|
|
66
|
+
const jsi::Value &synchronizedDataHolderRef,
|
|
67
|
+
const jsi::Value &newData);
|
|
68
|
+
|
|
69
|
+
void scheduleOnUI(jsi::Runtime &rt, const jsi::Value &worklet) override;
|
|
68
70
|
|
|
69
71
|
jsi::Value registerEventHandler(
|
|
70
72
|
jsi::Runtime &rt,
|
|
@@ -86,6 +88,11 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
86
88
|
jsi::Runtime &rt,
|
|
87
89
|
const jsi::Value &uiProps,
|
|
88
90
|
const jsi::Value &nativeProps) override;
|
|
91
|
+
jsi::Value configureLayoutAnimation(
|
|
92
|
+
jsi::Runtime &rt,
|
|
93
|
+
const jsi::Value &viewTag,
|
|
94
|
+
const jsi::Value &type,
|
|
95
|
+
const jsi::Value &config) override;
|
|
89
96
|
|
|
90
97
|
void onRender(double timestampMs);
|
|
91
98
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -144,23 +151,17 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
144
151
|
jsi::Runtime &rt,
|
|
145
152
|
const jsi::Value &listenerId) override;
|
|
146
153
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const jsi::Value &type,
|
|
151
|
-
const jsi::Value &config,
|
|
152
|
-
const jsi::Value &viewSharedValue) override;
|
|
154
|
+
inline LayoutAnimationsManager &layoutAnimationsManager() {
|
|
155
|
+
return layoutAnimationsManager_;
|
|
156
|
+
}
|
|
153
157
|
|
|
154
158
|
private:
|
|
155
159
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
156
160
|
bool isThereAnyLayoutProp(jsi::Runtime &rt, const jsi::Value &props);
|
|
157
161
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
158
162
|
|
|
159
|
-
std::
|
|
160
|
-
std::shared_ptr<MapperRegistry> mapperRegistry;
|
|
161
|
-
std::shared_ptr<EventHandlerRegistry> eventHandlerRegistry;
|
|
163
|
+
std::unique_ptr<EventHandlerRegistry> eventHandlerRegistry;
|
|
162
164
|
std::function<void(FrameCallback &, jsi::Runtime &)> requestRender;
|
|
163
|
-
std::shared_ptr<jsi::Value> dummyEvent;
|
|
164
165
|
std::vector<FrameCallback> frameCallbacks;
|
|
165
166
|
bool renderRequested = false;
|
|
166
167
|
std::function<jsi::Value(jsi::Runtime &, const int, const jsi::String &)>
|
|
@@ -187,6 +188,7 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
187
188
|
#endif
|
|
188
189
|
|
|
189
190
|
std::unordered_set<std::string> nativePropNames_; // filled by configureProps
|
|
191
|
+
LayoutAnimationsManager layoutAnimationsManager_;
|
|
190
192
|
|
|
191
193
|
KeyboardEventSubscribeFunction subscribeForKeyboardEventsFunction;
|
|
192
194
|
KeyboardEventUnsubscribeFunction unsubscribeFromKeyboardEventsFunction;
|