import { Toast, Portal } from '@ant-design/react-native' const myToast = (now) => ({ tKey: '', loading() { const { tKey } = now() if (!tKey) { const newKey = Toast.loading('Loading...', 0) now({ tKey: newKey, }) } }, success(title) { const { clearLoading } = now() clearLoading() Toast.success(title, 2) }, warnning(title) { const { clearLoading } = now() clearLoading() Toast.info(title, 2) }, clearLoading() { const { tKey } = now() if (tKey) { Portal.remove(tKey) now({ tKey: '', }) } }, }) export default myToast