import React from 'react';
import { Text, View } from 'react-native';
import type { SduiBlock } from '@proulr/sdui-contract';
import { useSduiHybridRenderer } from '../sdui-hybrid-renderer-context';
import { SduiLayoutDebugFrame } from '../sdui-layout-debug';
import type { SduiBlockRenderProps } from './SduiPrimitiveBlocks';
function readStringProp(block: SduiBlock, key: string): string | undefined {
const value = block.props[key];
return typeof value === 'string' ? value : undefined;
}
function NativeBlockShell({
block,
data,
onAction,
rendererKey,
fallbackLabel,
}: SduiBlockRenderProps & {
rendererKey:
| 'renderChatThread'
| 'renderSocialPostFeed'
| 'renderThoughtFeed'
| 'renderProfileView'
| 'renderProfileSelf'
| 'renderProfileSetup'
| 'renderProfileOnboarding'
| 'renderProfileReport'
| 'renderAlbumGrid'
| 'renderAlbumDetail'
| 'renderNewPostComposer'
| 'renderNewStoryComposer'
| 'renderStoryViewersPanel'
| 'renderPostComments'
| 'renderSocialProfile'
| 'renderSettingsHome'
| 'renderSettingsPage'
| 'renderChatGroupCreate'
| 'renderChatGroupInfo'
| 'renderChatGroupAddMembers'
| 'renderChatGroupInvite'
| 'renderDiscoverBrowseLocation'
| 'renderRightNowFeed'
| 'renderRightNowCompose';
fallbackLabel: string;
}) {
const hybrid = useSduiHybridRenderer();
const renderer = hybrid[rendererKey];
if (typeof renderer === 'function') {
return (
{renderer({
block,
data,
onAction,
dataRef: readStringProp(block, 'data_ref'),
conversationIdRef: readStringProp(block, 'conversation_id_ref'),
peerIdRef: readStringProp(block, 'peer_id_ref'),
peerNameRef: readStringProp(block, 'peer_name_ref'),
handleRef: readStringProp(block, 'handle_ref'),
postIdRef: readStringProp(block, 'post_id_ref'),
albumIdRef: readStringProp(block, 'album_id_ref'),
profileIdRef: readStringProp(block, 'profile_id_ref'),
})}
);
}
return (
{fallbackLabel}
);
}
export function SduiChatThreadBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiSocialPostFeedBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiThoughtFeedBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiProfileViewBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiProfileSelfBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiProfileSetupBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiProfileOnboardingBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiProfileReportBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiAlbumGridBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiAlbumDetailBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiNewPostComposerBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiNewStoryComposerBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiStoryViewersPanelBlock(props: SduiBlockRenderProps) {
return (
);
}
export function SduiPostCommentsBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiSocialProfileBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiSettingsHomeBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiSettingsPageBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiChatGroupCreateBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiChatGroupInfoBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiChatGroupAddMembersBlock(props: SduiBlockRenderProps) {
return (
);
}
export function SduiChatGroupInviteBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiDiscoverBrowseLocationBlock(props: SduiBlockRenderProps) {
return (
);
}
export function SduiRightNowFeedBlock(props: SduiBlockRenderProps) {
return ;
}
export function SduiRightNowComposeBlock(props: SduiBlockRenderProps) {
return (
);
}