useProductImages
This hook is used to get the product images and handle the image swiper actions. Used in the product detail page.
| Param | Type | Description |
|---|---|---|
| swiperRef | object | Image swiper ref |
| onAction | function | Function to handle the action |
| index | number | Index of current image |
| imageList | array | Visible image list |
| appmakerAction | object | Appmaker action |
| customDotColor | string | Image swiper dot color |
| imageRatio | number | Ratio of image |
| shareProduct | function | ShareProduct function for sharing product url if share button is placed above images |
| currentImageIndex | number | Current image index |
| setImageIndex | function | Set image index function for moving the image to the index of the new image Eg: setImageIndex(2) |
| openImage | function | Openimage 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);
};