Skip to content

Commit

Permalink
Toast msgs won't show success toast if passed false in config
Browse files Browse the repository at this point in the history
  • Loading branch information
sirajalam049 committed Mar 10, 2021
1 parent 0fbafb8 commit 97d7fad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dist/components/Toast/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ class Toast extends React.Component {
Toast.withToast = async (cb, config) => {
try {
const res = await cb();
if (config?.showSuccessMessage === false)
return res;
const msg = config?.successToastMessage || 'Success';
Toast.toastInstance.showSuccessToast({ ...config, successToastMessage: msg });
return res;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rn-themist",
"version": "0.0.39",
"version": "0.0.40",
"description": "Material-UI way of theming RN Components",
"main": "./dist/index.js",
"_location": "/rn-themist",
Expand Down
1 change: 1 addition & 0 deletions src/components/Toast/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Toast extends React.Component<ToastProps, ToastState> {
static withToast = async <T extends any>(cb: () => Promise<T>, config?: ToastState['toastConfig']) => {
try {
const res = await cb();
if (config?.showSuccessMessage === false) return res;
const msg = config?.successToastMessage || 'Success';
Toast.toastInstance.showSuccessToast({ ...config, successToastMessage: msg });
return res;
Expand Down

0 comments on commit 97d7fad

Please sign in to comment.