showActionSheet(params: Object)

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

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

Description

Show an action sheet

Parameters

PropertyTypeRequiredDescriptionBaseKit Since
alertTextstringNoWarning text-
itemListstring[]YesArray of button texts, up to 6 items-
itemColorstringYesButton text color-
itemColorsstring[]NoButton text colorv3.6.8
complete() => voidNoCompletion callback (executed on both success and failure)-
success(params: Object) => voidNoCallback on successful API call-
fail(params: Object) => voidNoFailure callback-
success callback parameters
PropertyTypeDescriptionBaseKit Since
tapIndexnumberIndex of the button the user tapped, ordered top to bottom, starting from 0v3.2.6
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

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

// Show an action sheet; the callback returns the button index tapIndex
showActionSheet({
  alertText: "Please select an action",
  itemList: ["Option 1", "Option 2", "Option 3"],
  itemColor: "#000000",
  success: data => console.log("Tapped index:", data.tapIndex),
  fail: error => console.error(error),
});