// src/components/ScreenBuilder/index.tsx import { ThemedText } from '@components/ThemedText'; import Tile from '@components/Tile'; import React from 'react'; import { View, ScrollView, StyleSheet } from 'react-native'; import { styles } from './styles'; // Define the configuration types export interface ComponentConfig { type: string; props?: Record; style?: Record; } export interface ScreenConfig { components: ComponentConfig[]; scrollable?: boolean; style?: Record; } interface ScreenBuilderProps { config: ScreenConfig; screenWidth: number; } const ScreenBuilder: React.FC = ({ config, screenWidth }) => { // Component registry - maps component types to actual components const componentRegistry: Record> = { // Tile wrapper components 'AccountCard': (props: any) => , 'CreditCard': (props: any) => , 'ServiceCard': (props: any) => , 'ServiceGrid': (props: any) => , 'PromotionalCard': (props: any) => , // Simple components 'SectionHeader': ({ title }: { title: string }) => ( {title} ), // Placeholder for animated horse - we'll create this next 'AnimatedHorse': () => ( 🐎 Animated Horse Coming Soon ), }; const renderComponent = (componentConfig: ComponentConfig, index: number) => { const { type, props = {}, style = {} } = componentConfig; const Component = componentRegistry[type]; if (!Component) { console.warn(`Component type "${type}" not found in registry`); return null; } return ( ); }; const content = ( {config.components.map((componentConfig, index) => renderComponent(componentConfig, index) )} ); // Return scrollable or non-scrollable version based on config if (config.scrollable !== false) { return ( {content} ); } return content; }; export default ScreenBuilder;