import React, {Fragment} from 'react'; import {ScrollView, Text, View} from 'react-native'; import {Examples, Sample} from './types'; export default function composeComponents( components: Sample[] | Examples, renderInView?: boolean, ) { const Wrapper = renderInView ? View : ScrollView; return function ComposedComponent() { return ( {Array.isArray(components) ? components.map((Component, index) => ( {index !== components.length - 1 && } )) : null} ); }; } function ComponentTitle({title}: {title?: string}) { if (!title) return null; return ( {title} ); } function Separator() { return ( ); }