@@ -40,27 +40,22 @@ void install(jsi::Runtime& runtime,
40
40
jsi::PropNameID::forAscii (runtime, " spawnThreadCallback" ),
41
41
2 ,
42
42
[](jsi::Runtime& runtime, const jsi::Value& thisValue, const jsi::Value* arguments, size_t count) -> jsi::Value {
43
- auto resolver = [&runtime, &arguments]( jsi::Value value) {
44
- manager-> scheduler -> scheduleOnJS ([&runtime, & arguments, &value] () {
45
- arguments[ 0 ]
46
- . asObject (runtime)
47
- . asFunction (runtime)
48
- .call (runtime, value);
43
+ auto resolverValue = std::make_shared< jsi::Value>((arguments[ 0 ]. asObject (runtime)));
44
+ auto rejecterValue = std::make_shared<jsi::Value>(( arguments[ 1 ]. asObject (runtime)));
45
+
46
+ auto resolver = [&runtime, resolverValue](jsi::Value value) {
47
+ manager-> scheduler -> scheduleOnJS ([&runtime, resolverValue, &value] () {
48
+ resolverValue-> asObject (runtime). asFunction (runtime) .call (runtime, value);
49
49
});
50
50
};
51
- auto rejecter = [&runtime, &arguments](std::string message) {
52
- manager->scheduler ->scheduleOnJS ([&runtime, &arguments, message] () {
53
- auto label = runtime.global ().getProperty (runtime, " _LABEL" );
54
- auto l = label.asString (runtime);
55
- arguments[1 ]
56
- .asObject (runtime)
57
- .asFunction (runtime)
58
- .call (runtime, jsi::JSError (runtime, message).value ());
51
+ auto rejecter = [&runtime, rejecterValue](std::string message) {
52
+ manager->scheduler ->scheduleOnJS ([&runtime, rejecterValue, message] () {
53
+ rejecterValue->asObject (runtime).asFunction (runtime).call (runtime, jsi::JSError (runtime, message).value ());
59
54
});
60
55
};
61
56
auto run = reanimated::ShareableValue::adapt (runtime, arguments[0 ], manager.get ());
62
57
63
- pool.enqueue ([& resolver, & rejecter, run]() {
58
+ pool.enqueue ([resolver, rejecter, run]() {
64
59
try {
65
60
auto & runtime = *manager->runtime ;
66
61
auto funcValue = run->getValue (runtime);
0 commit comments