import { useColors } from './Provider';
import React, { useEffect, useState } from 'react';
import { Dimensions, View } from 'react-native';
import { Text, Snackbar } from 'react-native-paper';
import { Ionicons } from '@expo/vector-icons';
declare type Props = {
message: string;
type: 'error' | 'success' | 'info' | 'warning';
// eslint-disable-next-line react/no-unused-prop-types
title?: string;
isVisible: boolean;
};
const CustomSnackbar = (props: Props) => {
const { getColor } = useColors();
const [isVisible, setIsVisible] = useState(false);
useEffect(() => {
setIsVisible(props.isVisible);
}, [props.isVisible, setIsVisible]);
const icons = {
success: (
),
error: (
),
info: (
),
warning: (
),
};
return (
{}}
style={{ backgroundColor: 'white' }}
>
{icons[props.type]}
{props.message}
);
};
export default CustomSnackbar;