Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlled hiding of Toasts #1287

Closed
LonelyGriffin opened this issue Oct 9, 2017 · 11 comments
Closed

Controlled hiding of Toasts #1287

LonelyGriffin opened this issue Oct 9, 2017 · 11 comments
Assignees
Labels

Comments

@LonelyGriffin
Copy link

Hi guys! I want to hide all Toasts by my action or other event.
For example:

const toastId = Toast.show(config);
Toast.hide(toastId)

// or

Toast.hideAll();

Is it possible?

@akhil-ga akhil-ga self-assigned this Oct 10, 2017
@akhil-ga
Copy link
Contributor

@LonelyGriffin currently NativeBase does not support this. Will raise a feature request.

@alexrussell
Copy link
Contributor

alexrussell commented Oct 24, 2017

This kinda thing would be useful. FWIW the "hide all" should be as simple as adding the following code to ToastContainer:

static hide() {
	this.toastInstance._root.cloaseToast();
}

However, the larger idea of being able to have multiple toasts (and being able to refer to each) is something I'm interested in in general.

@alexrussell
Copy link
Contributor

(Just seen your PR adding the hide method done exactly the way I describe. D'oh.)

@SupriyaKalghatgi
Copy link
Contributor

@alexrussell @LonelyGriffin Could you please share the PR link

@SupriyaKalghatgi
Copy link
Contributor

Found it
#1304

@SupriyaKalghatgi
Copy link
Contributor

@LonelyGriffin Having multiple Toast popping up for a single screen, this is something inappropriate as per design guidelines / use-case
Hence rejecting your request and PR same

@remon-nashid
Copy link

remon-nashid commented Jun 30, 2018

@SupriyaKalghatgi having multiple toasts simultaneously might not be best UX. However, I don't see why can't we still enable hiding the single toast using hide() method?

Implementation provided by @LonelyGriffin is quite appropriate and in fact, it cleans NB Toast implementation a bit.

I'd suggest giving this PR another chance since it was closed abruptly.

@SupriyaKalghatgi
Copy link
Contributor

Added with 2.7.2

@gianpaj
Copy link

gianpaj commented Sep 22, 2018

This function should be added to the documentation. And specified how it's intended to work. Because it doesn't work as expected for me.

I also don't see tests for hiding a Toast or, for example, showing one, hiding, showing a 2nd; which is what I'm trying to do.

@SupriyaKalghatgi
Copy link
Contributor

GeekyAnts/native-base-docs#131

@suvenduchhatoi
Copy link
Contributor

hide(), show() have been added to config table of Toast in latest docs versions...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants