import React from 'react';
import { Platform } from 'react-native';
import Toast from 'react-native-toast-message';
import { toast, ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

export const showToast = (type, title, message) => {
  if (Platform.OS === 'web') {
    toast[type](<><strong>{title}</strong><br />{message}</>);
  } else {
    Toast.show({
      type,
      text1: title,
      text2: message,
    });
  }
};

export const ToastWrapper = () => {
  return Platform.OS === 'web' ? <ToastContainer /> : <Toast />;
};