import * as React from 'react' import { ActivityIndicator, Image, ImageSourcePropType, ScrollView, StyleSheet, Text, View, } from 'react-native' import Modal from 'src/components/Modal' import TextButton from 'src/components/TextButton' import colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' interface Props { image?: ImageSourcePropType title?: string | React.ReactNode children: React.ReactNode actionText?: string | null isActionHighlighted?: boolean actionPress?: () => void secondaryActionText?: string | null secondaryActionDisabled?: boolean secondaryActionPress?: () => void isVisible: boolean showLoading?: boolean testID?: string onBackgroundPress?: () => void onDialogHide?: () => void } export default function Dialog({ title, children, actionPress, actionText, isActionHighlighted = true, secondaryActionText, secondaryActionDisabled, secondaryActionPress, showLoading = false, image, isVisible, testID, onBackgroundPress, onDialogHide, }: Props) { return ( {!!image && } {!!title && {title}} {children} {!!secondaryActionText && ( {secondaryActionText} )} {showLoading ? ( ) : ( <> {!!actionText && ( {actionText} )} )} ) } const styles = StyleSheet.create({ root: { alignItems: 'center', }, title: { textAlign: 'center', marginBottom: 12, ...typeScale.titleSmall, }, body: { textAlign: 'center', ...typeScale.bodyMedium, marginBottom: 24, }, actions: { flexDirection: 'row', justifyContent: 'space-around', maxWidth: '100%', flexWrap: 'wrap', }, secondary: { color: colors.contentSecondary, paddingTop: 16, }, primary: { paddingTop: 16, }, imageContainer: { marginBottom: 12, width: 100, height: 100, }, })