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

Fix toast timeout bug #1542

Merged
merged 2 commits into from
Feb 2, 2018
Merged

Fix toast timeout bug #1542

merged 2 commits into from
Feb 2, 2018

Conversation

alexrussell
Copy link
Contributor

Save the timeout ID when a toast is shown so that we can clear any existing timeout when a new toast is shown so that an old timeout doesn't close a new toast prematurely.


Replaces #1324 as I accidentally deleted my branch when trying to tidy up. Also I have redone the work on top of the latest master.

@jswxwxf you should now follow this issue.

…isting timeout when a new toast is shown so that an old timeout doesn't close a new toast prematurely.
@SupriyaKalghatgi
Copy link
Contributor

@alexrussell Thank you for the update!

@SupriyaKalghatgi SupriyaKalghatgi merged commit 0ba7626 into GeekyAnts:master Feb 2, 2018
@eassymo
Copy link

eassymo commented Mar 10, 2018

Another Toast timeout bug is when duration is not defined or is zero (0), Toast should be sticky or permanent but Toast auto-close after shown, otherwise add a property called "sticky" or "closeByButton", anything, but we could not have a sticky toast.

Out of "timeout" toping, Toast should be "swipeable" and call "onClose" event when timeout or swiped, and buttonText should have another action like "onPress" not call onClose.

@SupriyaKalghatgi
Copy link
Contributor

@eassymo Toast takes default value of 1500 for duration

@alexrussell
Copy link
Contributor Author

@eassymo You should open up some issues from what you said here as some make sense to me. I think I can see at least three separate issues you can open here:

  1. There should be some way to make a permanent (i.e. must be dismissed) toast. Either setting timeout to a special value (0, -1) or using a specific config of permanent: true or autohide: false, etc.
  2. Toasts to be swipeable to dismiss
  3. Separate callbacks for the way that a toast was closed. In order to conserve BC I imagine we need to leave the current onClose as happening when the toast closes through click or timeout, but introduce two more: onDismiss that only gets called if the toast was user-dismissed and onAutoClose that only gets called if the toast closed due to the timeout expiring.

@ahartzog
Copy link

Created a PR for onDismiss --> https://github.com/GeekyAnts/NativeBase/pull/2678/files

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

Successfully merging this pull request may close these issues.

4 participants