-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathRNFBoxedHybridObject.cpp
More file actions
31 lines (24 loc) · 1.06 KB
/
RNFBoxedHybridObject.cpp
File metadata and controls
31 lines (24 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// BoxedHybridObject.cpp
// NitroModules
//
// Created by Marc Rousavy on 17.09.24.
//
#include "RNFBoxedHybridObject.h"
namespace margelo {
std::vector<jsi::PropNameID> RNFBoxedHybridObject::getPropertyNames(facebook::jsi::Runtime& runtime) {
return jsi::PropNameID::names(runtime, "unbox");
}
jsi::Value RNFBoxedHybridObject::get(jsi::Runtime& runtime, const jsi::PropNameID& propName) {
std::string name = propName.utf8(runtime);
if (name == "unbox") {
return jsi::Function::createFromHostFunction(
runtime, jsi::PropNameID::forUtf8(runtime, "unbox"), 0,
[hybridObject = _hybridObject](jsi::Runtime& runtime, const jsi::Value&, const jsi::Value*, size_t) -> jsi::Value {
return JSIConverter<std::shared_ptr<HybridObject>>::toJSI(runtime, hybridObject);
// return jsi::Object::createFromHostObject(runtime, hybridObject);
});
}
return jsi::Value::undefined();
}
} // namespace margelo::nitro