import React from 'react';
import { ScrollView, StyleSheet, View } from 'react-native';
import * as Animatable from 'react-native-animatable';
import { Avatar, Button, Card, Paragraph, useTheme } from 'react-native-paper';
import GENERAL_STYLES from '../../constants/Styles';
import SpeechArrow from './SpeechArrow';
export type MascotSpeechBubbleProps = {
icon: string;
title: string;
message: string;
visible?: boolean;
buttons: {
action?: {
message: string;
icon?: string;
color?: string;
onPress?: () => void;
};
cancel?: {
message: string;
icon?: string;
color?: string;
onPress?: () => void;
};
};
};
type Props = MascotSpeechBubbleProps & {
onDismiss: (callback?: () => void) => void;
speechArrowPos: number;
bubbleMaxHeight: number;
};
const styles = StyleSheet.create({
speechBubbleContainer: {
marginLeft: '10%',
marginRight: '10%',
},
speechBubbleCard: {
borderWidth: 4,
borderRadius: 10,
},
speechBubbleIcon: {
backgroundColor: 'transparent',
},
speechBubbleText: {
marginBottom: 10,
},
actionsContainer: {
marginTop: 10,
marginBottom: 10,
},
button: {
...GENERAL_STYLES.centerHorizontal,
marginBottom: 10,
},
});
export default function MascotSpeechBubble(props: Props) {
const theme = useTheme();
const getButtons = () => {
const { action, cancel } = props.buttons;
return (
{action ? (
) : null}
{cancel != null ? (
) : null}
);
};
return (
(
)
: undefined
}
/>
{props.message}
{getButtons()}
);
}