previewImage(params: Object)

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

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

Description

Preview images in full screen on a new page

Parameters

PropertyTypeRequiredDescription
urlsstring[]YesList of image URLs to preview
currentnumberYesIndex of the currently previewed image in urls, starting from 0
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 { previewImage } from '@ray-js/ray'

// Preview network images in full screen
previewImage({
  urls: [
    "https://airtake-public-data-1254153901.cos.ap-shanghai.myqcloud.com/ttttestfile/test_image.jpg",
  ],
  current: 0,
  success: () => console.log("Preview opened"),
  fail: error => console.error(error),
});