Skip to main content

useProductImages

This hook is used to get the product images and handle the image swiper actions. Used in the product detail page.

ParamTypeDescription
swiperRefobjectImage swiper ref
onActionfunctionFunction to handle the action
indexnumberIndex of current image
imageListarrayVisible image list
appmakerActionobjectAppmaker action
customDotColorstringImage swiper dot color
imageRationumberRatio of image
shareProductfunctionShareProduct function for sharing product url if share button is placed above images
currentImageIndexnumberCurrent image index
setImageIndexfunctionSet image index function for moving the image to the index of the new image Eg: setImageIndex(2)
openImagefunctionOpenimage function helps to click the current image detail.

Usage


import { useProductImages } from '@appmaker/shopify';

const ProductImages = (props) => {
const {
swiperRef,
onAction,
index,
imageList,
appmakerAction,
customDotColor,
imageRatio,
shareProduct,
currentImageIndex,
setImageIndex,
openImage,
} = useProductImages(props);
};