🍫 React Snackbar Alert

Custom Animation Timeout

The snackbars are displayed with a simple animation. The duration of this animation can be changed in two ways:

  • Specifying the animationTimeout prop on the SnackbarProvider component.
  • Specifying the animationTimeout property on the object passed to createSnackbar
import React from 'react';

import { SnackbarProvider, wrapComponent } from 'react-snackbar-alert';

export default function CustomAnimationTimeoutExample() {
  return (
    <SnackbarProvider animationTimeout={1000}>
      <Container />
    </SnackbarProvider>
  );
}

const Container = wrapComponent(function({ createSnackbar }) {
  function showSnackbar() {
    createSnackbar({
      message: 'Hello Snackbar!'
    });
  }

  return (
    <div>
      <button onClick={showSnackbar}>Show Snackbar</button>
    </div>
  );
});