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

Allow customizing exit animation when user manually dismisses toast #323

Open
viveleroi opened this issue Oct 30, 2023 · 2 comments
Open

Comments

@viveleroi
Copy link

I have customized the ToastBar per the docs so that we have a dismiss button. When a user clicks this button, our design team wants the toast to animate differently than it does when it's automatically dismissed.

I don't see any way to customize the animate when it's dismissed by clicking the button. I could probably wrap the entire toast bar in a new component and do a custom useState but am hoping there's another system I can use.

Driving animations based on states like entering, expiring, dismissed, moving etc would be far nicer.

<ToastBar
  toast={t}
  style={{
    ...t.style,
    animation: t.visible ? 'slide-in-left 3s ease 0s 1 both' : 'slide-out-right 3s ease 0s 1 both',
    transition: 'all 0.3s cubic-bezier(0.040, 0.800, 0.200, 0.970)'
  }}>
  {({ icon, message }): JSX.Element => (
    <>
      {icon}
      {message}
      {t.type !== 'loading' && (
        <Button
          Icon={IconClose}
          onClick={(): void => {
            toast.dismiss(t.id)
          }}
        />
      )}
    </>
  )}
</ToastBar>
@sameer920
Copy link

Is this still an issue and have you tried modifying the exit animation?

@viveleroi
Copy link
Author

Yes it's still an issue. I can't modify the exit animation because it doesn't allow me to determine how the toast was dismissed.

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

No branches or pull requests

2 participants