mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add a BinaryTreeNode example for Cxx TMs (#41767)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41767 Changelog: [Internal] Adds a simple example showing a direct recursive node 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. Direct recursive nodes, can't be value types - it would require infinite memory. Hence they are nullable and managed by a smart pointer. Reviewed By: rshest Differential Revision: D51784136 fbshipit-source-id: f6f0710d03583bdf1e6e72ba42d8df7f8ff8d915
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5754b4a123
commit
ead73de464
@@ -56,6 +56,12 @@ export type ValueStruct = {|
|
||||
|
||||
export type CustomHostObject = {};
|
||||
|
||||
export type BinaryTreeNode = {
|
||||
left?: BinaryTreeNode,
|
||||
value: number,
|
||||
right?: BinaryTreeNode,
|
||||
};
|
||||
|
||||
export type GraphNode = {
|
||||
label: string,
|
||||
neighbors?: Array<GraphNode>,
|
||||
@@ -68,6 +74,7 @@ export interface Spec extends TurboModule {
|
||||
+getCustomEnum: (arg: EnumInt) => EnumInt;
|
||||
+getCustomHostObject: () => CustomHostObject;
|
||||
+consumeCustomHostObject: (customHostObject: CustomHostObject) => string;
|
||||
+getBinaryTreeNode: (arg: BinaryTreeNode) => BinaryTreeNode;
|
||||
+getGraphNode: (arg: GraphNode) => GraphNode;
|
||||
+getNumEnum: (arg: EnumInt) => EnumFloat;
|
||||
+getStrEnum: (arg: EnumNone) => EnumStr;
|
||||
|
||||
Reference in New Issue
Block a user