@react-native-ohos/react-native-reanimated 3.18.2 → 3.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.OpenSource +10 -10
- package/README.md +406 -10
- package/harmony/reanimated/BuildProfile.ets +1 -1
- package/harmony/reanimated/build-profile.json5 +11 -11
- package/harmony/reanimated/oh-package-lock.json5 +29 -0
- package/harmony/reanimated/oh-package.json5 +11 -11
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +2 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +86 -86
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +47 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +68 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +73 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +101 -101
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +51 -51
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +49 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +96 -96
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +33 -33
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +95 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +29 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +9 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +232 -232
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +90 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.cpp +870 -870
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +147 -147
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +91 -91
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +176 -176
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +971 -971
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +252 -254
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +231 -231
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +109 -109
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +56 -56
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +70 -70
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +35 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +14 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +5 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +98 -98
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +135 -135
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +47 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +59 -59
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +27 -27
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +25 -25
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +94 -94
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +49 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +8 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +39 -39
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +326 -326
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +345 -345
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +52 -52
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +35 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +10 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +342 -342
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +47 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +16 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +29 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +16 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +26 -26
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +199 -199
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +95 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.h +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +72 -72
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +22 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +29 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +41 -41
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +16 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +112 -112
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +127 -127
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +53 -53
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +22 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +191 -191
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +173 -173
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +90 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +189 -189
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +22 -22
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +29 -19
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +248 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +23 -0
- package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +60 -60
- package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +89 -89
- package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +53 -4
- package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +115 -15
- package/harmony/reanimated/src/main/module.json5 +12 -12
- package/harmony/reanimated/src/main/resources/base/element/color.json +7 -7
- package/harmony/reanimated/src/main/resources/base/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/reanimated/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/reanimated/ts.ts +6 -6
- package/harmony/reanimated.har +0 -0
- package/package.json +51 -50
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
|
-
#include <string>
|
|
5
|
-
#include <vector>
|
|
6
|
-
|
|
7
|
-
using namespace facebook;
|
|
8
|
-
|
|
9
|
-
namespace worklets {
|
|
10
|
-
|
|
11
|
-
class JSISerializer {
|
|
12
|
-
public:
|
|
13
|
-
explicit JSISerializer(jsi::Runtime &rt);
|
|
14
|
-
std::string stringifyJSIValueRecursively(
|
|
15
|
-
const jsi::Value &value,
|
|
16
|
-
bool isTopLevel = false);
|
|
17
|
-
|
|
18
|
-
private:
|
|
19
|
-
std::string stringifyArray(const jsi::Array &arr);
|
|
20
|
-
std::string stringifyFunction(const jsi::Function &func);
|
|
21
|
-
std::string stringifyHostObject(jsi::HostObject &hostObject);
|
|
22
|
-
std::string stringifyObject(const jsi::Object &object);
|
|
23
|
-
std::string stringifyError(const jsi::Object &object);
|
|
24
|
-
std::string stringifySet(const jsi::Object &object);
|
|
25
|
-
std::string stringifyMap(const jsi::Object &object);
|
|
26
|
-
std::string stringifyWithName(const jsi::Object &object);
|
|
27
|
-
std::string stringifyWithToString(const jsi::Object &object);
|
|
28
|
-
std::string stringifyRecursiveType(const jsi::Object &object);
|
|
29
|
-
|
|
30
|
-
bool hasBeenVisited(const jsi::Object &object) {
|
|
31
|
-
return visitedNodes_.getPropertyAsFunction(rt_, "has")
|
|
32
|
-
.callWithThis(rt_, visitedNodes_, object)
|
|
33
|
-
.getBool();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
void markAsVisited(const jsi::Object &object) {
|
|
37
|
-
visitedNodes_.getPropertyAsFunction(rt_, "add")
|
|
38
|
-
.callWithThis(rt_, visitedNodes_, object);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
jsi::Runtime &rt_;
|
|
42
|
-
jsi::Object visitedNodes_;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
std::string stringifyJSIValue(jsi::Runtime &rt, const jsi::Value &value);
|
|
46
|
-
|
|
47
|
-
} // namespace worklets
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <vector>
|
|
6
|
+
|
|
7
|
+
using namespace facebook;
|
|
8
|
+
|
|
9
|
+
namespace worklets {
|
|
10
|
+
|
|
11
|
+
class JSISerializer {
|
|
12
|
+
public:
|
|
13
|
+
explicit JSISerializer(jsi::Runtime &rt);
|
|
14
|
+
std::string stringifyJSIValueRecursively(
|
|
15
|
+
const jsi::Value &value,
|
|
16
|
+
bool isTopLevel = false);
|
|
17
|
+
|
|
18
|
+
private:
|
|
19
|
+
std::string stringifyArray(const jsi::Array &arr);
|
|
20
|
+
std::string stringifyFunction(const jsi::Function &func);
|
|
21
|
+
std::string stringifyHostObject(jsi::HostObject &hostObject);
|
|
22
|
+
std::string stringifyObject(const jsi::Object &object);
|
|
23
|
+
std::string stringifyError(const jsi::Object &object);
|
|
24
|
+
std::string stringifySet(const jsi::Object &object);
|
|
25
|
+
std::string stringifyMap(const jsi::Object &object);
|
|
26
|
+
std::string stringifyWithName(const jsi::Object &object);
|
|
27
|
+
std::string stringifyWithToString(const jsi::Object &object);
|
|
28
|
+
std::string stringifyRecursiveType(const jsi::Object &object);
|
|
29
|
+
|
|
30
|
+
bool hasBeenVisited(const jsi::Object &object) {
|
|
31
|
+
return visitedNodes_.getPropertyAsFunction(rt_, "has")
|
|
32
|
+
.callWithThis(rt_, visitedNodes_, object)
|
|
33
|
+
.getBool();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void markAsVisited(const jsi::Object &object) {
|
|
37
|
+
visitedNodes_.getPropertyAsFunction(rt_, "add")
|
|
38
|
+
.callWithThis(rt_, visitedNodes_, object);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
jsi::Runtime &rt_;
|
|
42
|
+
jsi::Object visitedNodes_;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
std::string stringifyJSIValue(jsi::Runtime &rt, const jsi::Value &value);
|
|
46
|
+
|
|
47
|
+
} // namespace worklets
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#include <worklets/Tools/JSLogger.h>
|
|
2
|
-
#include <memory>
|
|
3
|
-
|
|
4
|
-
namespace worklets {
|
|
5
|
-
|
|
6
|
-
void JSLogger::warnOnJS(const std::string &warning) const {
|
|
7
|
-
#ifndef NDEBUG
|
|
8
|
-
jsScheduler_->scheduleOnJS([warning](jsi::Runtime &rt) {
|
|
9
|
-
auto console = rt.global().getPropertyAsObject(rt, "console");
|
|
10
|
-
auto warn = console.getPropertyAsFunction(rt, "warn");
|
|
11
|
-
warn.call(rt, jsi::String::createFromUtf8(rt, warning));
|
|
12
|
-
});
|
|
13
|
-
#endif // NDEBUG
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
} // namespace worklets
|
|
1
|
+
#include <worklets/Tools/JSLogger.h>
|
|
2
|
+
#include <memory>
|
|
3
|
+
|
|
4
|
+
namespace worklets {
|
|
5
|
+
|
|
6
|
+
void JSLogger::warnOnJS(const std::string &warning) const {
|
|
7
|
+
#ifndef NDEBUG
|
|
8
|
+
jsScheduler_->scheduleOnJS([warning](jsi::Runtime &rt) {
|
|
9
|
+
auto console = rt.global().getPropertyAsObject(rt, "console");
|
|
10
|
+
auto warn = console.getPropertyAsFunction(rt, "warn");
|
|
11
|
+
warn.call(rt, jsi::String::createFromUtf8(rt, warning));
|
|
12
|
+
});
|
|
13
|
+
#endif // NDEBUG
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
} // namespace worklets
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <worklets/Tools/JSScheduler.h>
|
|
4
|
-
|
|
5
|
-
#include <memory>
|
|
6
|
-
#include <string>
|
|
7
|
-
|
|
8
|
-
namespace worklets {
|
|
9
|
-
|
|
10
|
-
class JSLogger {
|
|
11
|
-
public:
|
|
12
|
-
explicit JSLogger(const std::shared_ptr<JSScheduler> &jsScheduler)
|
|
13
|
-
: jsScheduler_(jsScheduler) {}
|
|
14
|
-
void warnOnJS(const std::string &warning) const;
|
|
15
|
-
|
|
16
|
-
private:
|
|
17
|
-
const std::shared_ptr<JSScheduler> jsScheduler_;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
} // namespace worklets
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <worklets/Tools/JSScheduler.h>
|
|
4
|
+
|
|
5
|
+
#include <memory>
|
|
6
|
+
#include <string>
|
|
7
|
+
|
|
8
|
+
namespace worklets {
|
|
9
|
+
|
|
10
|
+
class JSLogger {
|
|
11
|
+
public:
|
|
12
|
+
explicit JSLogger(const std::shared_ptr<JSScheduler> &jsScheduler)
|
|
13
|
+
: jsScheduler_(jsScheduler) {}
|
|
14
|
+
void warnOnJS(const std::string &warning) const;
|
|
15
|
+
|
|
16
|
+
private:
|
|
17
|
+
const std::shared_ptr<JSScheduler> jsScheduler_;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
} // namespace worklets
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#include <worklets/Tools/JSScheduler.h>
|
|
2
|
-
|
|
3
|
-
#include <utility>
|
|
4
|
-
|
|
5
|
-
using namespace facebook;
|
|
6
|
-
using namespace react;
|
|
7
|
-
|
|
8
|
-
namespace worklets {
|
|
9
|
-
|
|
10
|
-
JSScheduler::JSScheduler(
|
|
11
|
-
jsi::Runtime &rnRuntime,
|
|
12
|
-
const std::shared_ptr<CallInvoker> &jsCallInvoker)
|
|
13
|
-
: scheduleOnJS([&](Job job) {
|
|
14
|
-
jsCallInvoker_->invokeAsync(
|
|
15
|
-
[job = std::move(job), &rt = rnRuntime_] { job(rt); });
|
|
16
|
-
}),
|
|
17
|
-
rnRuntime_(rnRuntime),
|
|
18
|
-
jsCallInvoker_(jsCallInvoker) {}
|
|
19
|
-
|
|
20
|
-
} // namespace worklets
|
|
1
|
+
#include <worklets/Tools/JSScheduler.h>
|
|
2
|
+
|
|
3
|
+
#include <utility>
|
|
4
|
+
|
|
5
|
+
using namespace facebook;
|
|
6
|
+
using namespace react;
|
|
7
|
+
|
|
8
|
+
namespace worklets {
|
|
9
|
+
|
|
10
|
+
JSScheduler::JSScheduler(
|
|
11
|
+
jsi::Runtime &rnRuntime,
|
|
12
|
+
const std::shared_ptr<CallInvoker> &jsCallInvoker)
|
|
13
|
+
: scheduleOnJS([&](Job job) {
|
|
14
|
+
jsCallInvoker_->invokeAsync(
|
|
15
|
+
[job = std::move(job), &rt = rnRuntime_] { job(rt); });
|
|
16
|
+
}),
|
|
17
|
+
rnRuntime_(rnRuntime),
|
|
18
|
+
jsCallInvoker_(jsCallInvoker) {}
|
|
19
|
+
|
|
20
|
+
} // namespace worklets
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <ReactCommon/CallInvoker.h>
|
|
4
|
-
#include <ReactCommon/RuntimeExecutor.h>
|
|
5
|
-
#include <jsi/jsi.h>
|
|
6
|
-
|
|
7
|
-
#include <memory>
|
|
8
|
-
|
|
9
|
-
using namespace facebook;
|
|
10
|
-
using namespace react;
|
|
11
|
-
|
|
12
|
-
namespace worklets {
|
|
13
|
-
|
|
14
|
-
class JSScheduler {
|
|
15
|
-
using Job = std::function<void(jsi::Runtime &rt)>;
|
|
16
|
-
|
|
17
|
-
public:
|
|
18
|
-
explicit JSScheduler(
|
|
19
|
-
jsi::Runtime &rnRuntime,
|
|
20
|
-
const std::shared_ptr<CallInvoker> &jsCallInvoker);
|
|
21
|
-
|
|
22
|
-
const std::function<void(Job)> scheduleOnJS = nullptr;
|
|
23
|
-
|
|
24
|
-
protected:
|
|
25
|
-
jsi::Runtime &rnRuntime_;
|
|
26
|
-
const std::shared_ptr<CallInvoker> jsCallInvoker_ = nullptr;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
} // namespace worklets
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <ReactCommon/CallInvoker.h>
|
|
4
|
+
#include <ReactCommon/RuntimeExecutor.h>
|
|
5
|
+
#include <jsi/jsi.h>
|
|
6
|
+
|
|
7
|
+
#include <memory>
|
|
8
|
+
|
|
9
|
+
using namespace facebook;
|
|
10
|
+
using namespace react;
|
|
11
|
+
|
|
12
|
+
namespace worklets {
|
|
13
|
+
|
|
14
|
+
class JSScheduler {
|
|
15
|
+
using Job = std::function<void(jsi::Runtime &rt)>;
|
|
16
|
+
|
|
17
|
+
public:
|
|
18
|
+
explicit JSScheduler(
|
|
19
|
+
jsi::Runtime &rnRuntime,
|
|
20
|
+
const std::shared_ptr<CallInvoker> &jsCallInvoker);
|
|
21
|
+
|
|
22
|
+
const std::function<void(Job)> scheduleOnJS = nullptr;
|
|
23
|
+
|
|
24
|
+
protected:
|
|
25
|
+
jsi::Runtime &rnRuntime_;
|
|
26
|
+
const std::shared_ptr<CallInvoker> jsCallInvoker_ = nullptr;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
} // namespace worklets
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <string>
|
|
4
|
-
|
|
5
|
-
namespace worklets {
|
|
6
|
-
|
|
7
|
-
class PlatformLogger {
|
|
8
|
-
public:
|
|
9
|
-
static void log(const char *str);
|
|
10
|
-
static void log(const std::string &str);
|
|
11
|
-
static void log(const double d);
|
|
12
|
-
static void log(const int i);
|
|
13
|
-
static void log(const bool b);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
} // namespace worklets
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <string>
|
|
4
|
+
|
|
5
|
+
namespace worklets {
|
|
6
|
+
|
|
7
|
+
class PlatformLogger {
|
|
8
|
+
public:
|
|
9
|
+
static void log(const char *str);
|
|
10
|
+
static void log(const std::string &str);
|
|
11
|
+
static void log(const double d);
|
|
12
|
+
static void log(const int i);
|
|
13
|
+
static void log(const bool b);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
} // namespace worklets
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
#include <worklets/Tools/ReanimatedJSIUtils.h>
|
|
2
|
-
#include <vector>
|
|
3
|
-
|
|
4
|
-
using namespace facebook;
|
|
5
|
-
|
|
6
|
-
namespace worklets::jsi_utils {
|
|
7
|
-
|
|
8
|
-
jsi::Array convertStringToArray(
|
|
9
|
-
jsi::Runtime &rt,
|
|
10
|
-
const std::string &value,
|
|
11
|
-
const unsigned int expectedSize) {
|
|
12
|
-
std::vector<float> transformMatrixList;
|
|
13
|
-
std::istringstream stringStream(value);
|
|
14
|
-
std::copy(
|
|
15
|
-
std::istream_iterator<float>(stringStream),
|
|
16
|
-
std::istream_iterator<float>(),
|
|
17
|
-
std::back_inserter(transformMatrixList));
|
|
18
|
-
assert(transformMatrixList.size() == expectedSize);
|
|
19
|
-
jsi::Array matrix(rt, expectedSize);
|
|
20
|
-
for (unsigned int i = 0; i < expectedSize; i++) {
|
|
21
|
-
matrix.setValueAtIndex(rt, i, transformMatrixList[i]);
|
|
22
|
-
}
|
|
23
|
-
return matrix;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
} // namespace worklets::jsi_utils
|
|
1
|
+
#include <worklets/Tools/ReanimatedJSIUtils.h>
|
|
2
|
+
#include <vector>
|
|
3
|
+
|
|
4
|
+
using namespace facebook;
|
|
5
|
+
|
|
6
|
+
namespace worklets::jsi_utils {
|
|
7
|
+
|
|
8
|
+
jsi::Array convertStringToArray(
|
|
9
|
+
jsi::Runtime &rt,
|
|
10
|
+
const std::string &value,
|
|
11
|
+
const unsigned int expectedSize) {
|
|
12
|
+
std::vector<float> transformMatrixList;
|
|
13
|
+
std::istringstream stringStream(value);
|
|
14
|
+
std::copy(
|
|
15
|
+
std::istream_iterator<float>(stringStream),
|
|
16
|
+
std::istream_iterator<float>(),
|
|
17
|
+
std::back_inserter(transformMatrixList));
|
|
18
|
+
assert(transformMatrixList.size() == expectedSize);
|
|
19
|
+
jsi::Array matrix(rt, expectedSize);
|
|
20
|
+
for (unsigned int i = 0; i < expectedSize; i++) {
|
|
21
|
+
matrix.setValueAtIndex(rt, i, transformMatrixList[i]);
|
|
22
|
+
}
|
|
23
|
+
return matrix;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
} // namespace worklets::jsi_utils
|