added useEffect logic

This commit is contained in:
Batyr 2025-06-02 18:51:47 +05:00
parent f78d16181f
commit 506e327884
1 changed files with 12 additions and 0 deletions

View File

@ -32,6 +32,18 @@ export const MediaModal: FC<Props> = ({ className, setIsOpen, activeItem }) => {
useEffect(() => {
if (!emblaApi) return;
const onSelect = () => {
setCanScrollPrev(emblaApi.canScrollPrev());
setCanScrollNext(emblaApi.canScrollNext());
};
emblaApi.on("select", onSelect);
onSelect();
return () => {
emblaApi.off("select", onSelect);
};
}, [emblaApi]);
useEffect(() => {