mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
[LOCAL] Do not use NativeState as JSC does not implement it
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ jsi::Value RuntimeSchedulerBinding::get(
|
||||
jsi::Runtime &runtime,
|
||||
jsi::Value const &,
|
||||
jsi::Value const *arguments,
|
||||
size_t) noexcept -> jsi::Value {
|
||||
size_t count) noexcept -> jsi::Value {
|
||||
SchedulerPriority priority = fromRawValue(arguments[0].getNumber());
|
||||
auto callback = arguments[1].getObject(runtime).getFunction(runtime);
|
||||
|
||||
|
||||
@@ -13,12 +13,17 @@
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
struct TaskWrapper : public jsi::HostObject {
|
||||
TaskWrapper(std::shared_ptr<Task> const &task) : task(task) {}
|
||||
|
||||
std::shared_ptr<Task> task;
|
||||
};
|
||||
|
||||
inline static jsi::Value valueFromTask(
|
||||
jsi::Runtime &runtime,
|
||||
std::shared_ptr<Task> task) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setNativeState(runtime, std::move(task));
|
||||
return obj;
|
||||
return jsi::Object::createFromHostObject(
|
||||
runtime, std::make_shared<TaskWrapper>(task));
|
||||
}
|
||||
|
||||
inline static std::shared_ptr<Task> taskFromValue(
|
||||
@@ -28,7 +33,7 @@ inline static std::shared_ptr<Task> taskFromValue(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return value.getObject(runtime).getNativeState<Task>(runtime);
|
||||
return value.getObject(runtime).getHostObject<TaskWrapper>(runtime)->task;
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
|
||||
Reference in New Issue
Block a user