import React, { isValidElement } from 'react'; import { Image } from 'react-native'; import { Box } from '../Box'; import { Button } from '../Button'; import { Text } from '../Text'; import { useTheme } from '../../theme/ThemeProvider'; import type { WithSecondaryButton, WithPrimaryButton, WithoutButton, } from './messageview'; /** * MessageView * @typeof WithSecondaryButton | WithPrimaryButton | WithoutButton * * @example * MessageView example WithSecondaryButton * ``` * console.warn('Clicked secondary!')} * handleSecondaryBtn={() => console.warn('Secondary clicked!')} * /> * ``` */ export const MessageView = ({ title, subTitle, headerComponent, imgUri, svgIcon, imgHeight = 240, innerComponent, labelPrimaryBtn, handlePrimaryBtn, labelSecondaryBtn, handleSecondaryBtn, withoutButton = false, }: WithPrimaryButton | WithSecondaryButton | WithoutButton) => { const { fonts } = useTheme(); const source = typeof imgUri === 'number' ? imgUri : { uri: imgUri }; return ( {headerComponent ? ( {headerComponent} ) : ( {imgUri && ( )} {svgIcon && ( {svgIcon} )} )} {title} {typeof subTitle === 'string' ? ( {subTitle} ) : isValidElement(subTitle) ? ( {subTitle} ) : null} {innerComponent && {innerComponent}} {!withoutButton && labelPrimaryBtn && handlePrimaryBtn ? (