Encrypted-Chat-Client/components/toastwrapper.jsx
2024-12-15 06:40:35 -08:00

21 lines
569 B
JavaScript

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 />;
};