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
@@ -42,6 +42,8 @@ type Examples =
|
||||
| 'getBool'
|
||||
| 'getConstants'
|
||||
| 'getCustomEnum'
|
||||
| 'getCustomHostObject'
|
||||
| 'getGraphNode'
|
||||
| 'getNumEnum'
|
||||
| 'getStrEnum'
|
||||
| 'getMap'
|
||||
@@ -102,6 +104,11 @@ class NativeCxxModuleExampleExample extends React.Component<{||}, State> {
|
||||
NativeCxxModuleExample?.consumeCustomHostObject(
|
||||
NativeCxxModuleExample?.getCustomHostObject(),
|
||||
),
|
||||
getGraphNode: () =>
|
||||
NativeCxxModuleExample?.getGraphNode({
|
||||
label: 'root',
|
||||
neighbors: [{label: 'left'}, {label: 'right'}],
|
||||
}),
|
||||
getNumEnum: () => NativeCxxModuleExample?.getNumEnum(EnumInt.IB),
|
||||
getStrEnum: () => NativeCxxModuleExample?.getStrEnum(EnumNone.NB),
|
||||
getNumber: () => NativeCxxModuleExample?.getNumber(99.95),
|
||||
|
||||
Reference in New Issue
Block a user