import { useToastStyles } from '@Components/ToastWrapper.styled' import { useProgressBar } from '@Root/Hooks/useProgessBar' import React, { FC, useContext } from 'react' import { Animated, StyleSheet, View } from 'react-native' import Toast, { ErrorToast, InfoToast, SuccessToast, ToastConfig } from 'react-native-toast-message' import { ThemeContext } from 'styled-components' export const ToastWrapper: FC = () => { const theme = useContext(ThemeContext) const styles = useToastStyles(theme) const { updateProgressBar, progressBarWidth } = useProgressBar() const toastStyles: ToastConfig = { info: props => { const percentComplete = props.props?.percentComplete || 0 updateProgressBar(percentComplete) return ( {props.props?.percentComplete !== undefined ? ( ) : null} ) }, success: props => { const percentComplete = props.props?.percentComplete || 0 updateProgressBar(percentComplete) return }, error: props => { const percentComplete = props.props?.percentComplete || 0 updateProgressBar(percentComplete) return }, } return }