Cogoport / cogo-toast

Beautiful, Zero Configuration, Toast Messages for React. Only ~ 4kb gzip, with styles and icons
https://cogoport.github.io/cogo-toast
MIT License
673 stars 1 forks source link

Feature to close the toast manually #4

Closed ratnajeetshyamkunwar closed 5 years ago

FaiChou commented 5 years ago
const closeLoading = cogoToast.loading('uploading..', { hideAfter: 0 });
// after logic
closeLoading();

Isn't this suit for your situation?

yuritoledo commented 5 years ago

Is this working?

anmdotdev commented 5 years ago

@yuritoledo Yes it works :)

yuritoledo commented 5 years ago

amazing, congratz :)

tamert commented 5 years ago

It's working for me

const closeLoading = cogoToast.loading('logining..', { hideAfter: 0 });
        userService.login(username, password).
            then(
                user => {
                    closeLoading();
                    cogoToast.success('Login!.');
                    dispatch(success(username));
                },
                error => {
                    closeLoading();
                    dispatch(failure(error.toString()));
                    cogoToast.error(error.toString());
                }
            );
    };

Unhandled Rejection (TypeError): closeLoading is not a function

how do i?

yuritoledo commented 5 years ago

@tamert what version are you using?

The lib had a breaking change in hide method. Take a look:

https://github.com/Cogoport/cogo-toast#hide-on-click

DedaDev commented 3 years ago
const closeLoading = cogoToast.loading('uploading..', { hideAfter: 0 });
// after logic
closeLoading();

Isn't this suit for your situation?

What if I want a close button inside of toast?