Super Toast

Types

Every type exported by react-native-super-toast.

All types are exported from the package root.

import type { ToastOptions, ToastHostProps } from 'react-native-super-toast';

ToastId

type ToastId = string | number;

ToastVariant

type ToastVariant = 'default' | 'success' | 'error' | 'warning' | 'info' | 'loading';

ToastPosition

type ToastPosition = 'top-center' | 'bottom-center' | 'center';

ToastTheme

type ToastTheme = 'light' | 'dark' | 'system';

ToastSwipeDirection

type ToastSwipeDirection = 'up' | 'down' | 'left' | 'right';

ToastIcon

type ToastIcon = string | ToastTextIcon | ToastFontIcon | ToastImageIcon;

type ToastTextIcon = { type: 'text'; value: string; size?: number; color?: string };

type ToastFontIcon = {
  type: 'font';
  /** A single glyph character or a codepoint from an icon glyph map. */
  glyph: string | number;
  /** The consuming app must bundle the font. */
  fontFamily: string;
  size?: number;
  color?: string;
};

type ToastImageIcon = {
  type: 'image';
  /** require('./icon.png'), { uri }, data URI, file URI, or content URI. */
  source: ImageSourcePropType;
  size?: number;
  width?: number;
  height?: number;
  tintColor?: string;
  cornerRadius?: number;
};

ToastAction

type ToastAction = { label: string; onClick: () => void };

ToastViewStyle

type ToastViewStyle = {
  backgroundColor?: string;
  borderColor?: string;
  borderWidth?: number;
  borderRadius?: number;
  padding?: number;
  paddingHorizontal?: number;
  paddingVertical?: number;
};

ToastTextStyle

type ToastTextStyle = {
  color?: string;
  fontSize?: number;
  fontFamily?: string;
  fontWeight?: TextStyle['fontWeight'];
  lineHeight?: number;
};

ToastStyles

type ToastStyles = {
  toast?: ToastViewStyle;
  title?: ToastTextStyle;
  description?: ToastTextStyle;
  icon?: { color?: string };
  closeButtonIcon?: { color?: string };
};

ToastHostToastOptions

type ToastHostToastOptions = {
  style?: ToastViewStyle;
  titleStyle?: ToastTextStyle;
  descriptionStyle?: ToastTextStyle;
  actionButtonStyle?: ToastViewStyle;
  actionButtonTextStyle?: ToastTextStyle;
  cancelButtonStyle?: ToastViewStyle;
  cancelButtonTextStyle?: ToastTextStyle;
} & Partial<Record<ToastVariant, ToastViewStyle>>;

ToastOptions, PromiseOptions, ToastHostProps

See toast and ToastHost.

On this page