setTabBarBadge

Requires:
MiniKit≥1.0.0@ray-js/ray≥0.3.23
Platforms:
iOSAndroid
import { setTabBarBadge } from '@ray-js/ray';

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

Method signature
setTabBarBadge(params: )

Description

Add text to the top-right corner of a tabBar item

Parameters

PropertyTypeRequiredDescription
indexnumberYesWhich tabBar item, counting from the left
textstringYesText to display; if longer than 4 characters, it shows as ...
complete() => voidNoCompletion callback (executed on both success and failure)
success() => voidNoCallback on successful API call
fail(params: Object) => voidNoFailure callback
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

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

setTabBarBadge({
  index: 0,
  text: "99",
  success: data => { console.log(data); },
  fail: error => { console.error(error); },
});