setTabBarItem

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

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

Method signature
setTabBarItem(params: )

Description

Dynamically set a tabBar item’s content

Parameters

PropertyTypeRequiredDescription
indexnumberYesWhich tabBar item, counting from the left
textstringYesButton text on the tab
iconPathstringYesImage path
selectedIconPathstringYesImage path when selected
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 { setTabBarItem } from '@ray-js/ray'

setTabBarItem({
  index: 0,
  text: "Home",
  iconPath: "/assets/tab_home.png",
  selectedIconPath: "/assets/tab_home_selected.png",
  success: data => { console.log(data); },
  fail: error => { console.error(error); },
});