showToast(params: Object)

Requires:
BaseKit≥2.0.1@ray-js/ray≥0.3.23
Platforms:
iOSAndroid
import { showToast } from '@ray-js/ray';

// Promise usage
try {
  const res = await showToast({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Show a toast message

Parameters

PropertyTypeRequiredDefaultDescription
titlestringYes-Message content
iconstringNo"success"Icon: 'success' / 'error' / 'loading' / 'none'
imagestringNo-Local path to a custom icon; image has higher priority than icon
durationnumberNo1500Delay for the message (iOS only)
maskbooleanNofalseWhether to show a transparent mask to prevent touch-through
complete() => voidNo-Completion callback (executed on both success and failure)
success() => voidNo-Callback on successful API call
fail(params: Object) => voidNo-Failure callback
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { showToast } from '@ray-js/ray'

// Show a toast
showToast({
  title: "Success",
  icon: "success",
  duration: 1500,
  mask: false,
  success: () => console.log("Toast displayed"),
  fail: error => console.error(error),
});