mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add GraphNode example for Cxx TMs (#41766)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41766 Changelog: [Internal] Adds a simple example showing a recursive node, stored inside a collection in a Cxx TM. Currently we can't auto-generate [the necessary C++ Types](https://reactnative.dev/docs/next/the-new-architecture/cxx-custom-types#struct-generator) - but we can add it later if this scenarios becomes really common. Reviewed By: rshest Differential Revision: D51783974 fbshipit-source-id: 7352db1a354cd7da32febc650f7cc5e10dd16d2d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
385473522c
commit
5754b4a123
@@ -65,6 +65,16 @@ std::string NativeCxxModuleExample::consumeCustomHostObject(
|
||||
return value->a_ + std::to_string(value->b_);
|
||||
}
|
||||
|
||||
GraphNode NativeCxxModuleExample::getGraphNode(
|
||||
jsi::Runtime& rt,
|
||||
GraphNode arg) {
|
||||
if (arg.neighbors) {
|
||||
arg.neighbors->emplace_back(GraphNode{.label = "top"});
|
||||
arg.neighbors->emplace_back(GraphNode{.label = "down"});
|
||||
}
|
||||
return arg;
|
||||
}
|
||||
|
||||
NativeCxxModuleExampleCxxEnumFloat NativeCxxModuleExample::getNumEnum(
|
||||
jsi::Runtime& rt,
|
||||
NativeCxxModuleExampleCxxEnumInt arg) {
|
||||
|
||||
Reference in New Issue
Block a user