Add jsi::HostObject example to rn-tester (#36909)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36909

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D44978689

fbshipit-source-id: 0e31b5c37a7890744694706994ea672c3e619341
This commit is contained in:
Christoph Purrer
2023-04-14 13:58:39 -07:00
committed by Facebook GitHub Bot
parent adb210306d
commit f5c0606185
4 changed files with 51 additions and 0 deletions
@@ -40,6 +40,19 @@ CustomEnumInt NativeCxxModuleExample::getCustomEnum(
return arg;
}
std::shared_ptr<CustomHostObject> NativeCxxModuleExample::getCustomHostObject(
jsi::Runtime &rt) {
return std::make_shared<CustomHostObject>(
std::make_shared<CustomHostObjectRef>("answer", 42));
}
std::string NativeCxxModuleExample::consumeCustomHostObject(
jsi::Runtime &rt,
std::shared_ptr<CustomHostObject> arg) {
auto value = arg->getValue();
return value->a_ + std::to_string(value->b_);
}
NativeCxxModuleExampleCxxEnumFloat NativeCxxModuleExample::getNumEnum(
jsi::Runtime &rt,
NativeCxxModuleExampleCxxEnumInt arg) {