MCPcopy Create free account
hub / github.com/PatoSala/react-native-blocks / RenderTree

Function RenderTree

packages/core/src/components/Editor.tsx:49–73  ·  view source on GitHub ↗
(props: RenderTreeProps)

Source from the content-addressed store, hash-verified

47 onBlankSpacePress: () => void
48}
49function RenderTree(props: RenderTreeProps) {
50 const {
51 onBlankSpacePress
52 } = props;
53 const { blockTypes, defaultBlockType } = useBlockRegistrationContext();
54 const { blocks, blocksOrder } = useBlocksContext();
55
56 return (
57 <>
58 {/* We concat the "root" content (should be just one item) with the content of its only child. */}
59 {blocksOrder.map((blockId: string, index: number) => {
60 const Component = blockTypes[blocks[blockId].type].component;
61 return (
62 <LayoutProvider blockId={blockId} key={`block-${blockId}`}>
63 <View style={{ backgroundColor: "transparent" }}>
64 <Component blockId={blockId} />
65 </View>
66 </LayoutProvider>
67 )
68 })}
69
70 <BlankSpace onBlankSpacePress={onBlankSpacePress}/>
71 </>
72 )
73}
74
75interface EditorProps {
76 children: React.ReactNode

Callers

nothing calls this directly

Calls 2

useBlocksContextFunction · 0.90

Tested by

no test coverage detected