Click on image to get fullscreen #729
kidsie-matt
started this conversation in
General
Replies: 1 comment 1 reply
-
So I used a workaround for this, and idk how good this solution is, but it works for me. I rendered a custom full screen button thats basically as big as the images:
It's not an answer for your inital error, but maybe this helps to implement it in another way! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
`import "../../node_modules/react-image-gallery/styles/css/image-gallery.css";
import ImageGallery from "react-image-gallery";
import { useRef } from "react";
const images = [
{
original: "https://picsum.photos/id/1018/1000/600/",
thumbnail: "https://picsum.photos/id/1018/250/150/",
},
{
original: "https://picsum.photos/id/1015/1000/600/",
thumbnail: "https://picsum.photos/id/1015/250/150/",
},
{
original: "https://picsum.photos/id/1019/1000/600/",
thumbnail: "https://picsum.photos/id/1019/250/150/",
},
];
const Carousel = (props) => {
const imageGalleryRef = useRef(null);
const onClickHandler = () => {
imageGalleryRef.current.toggleFullscreen();
};
return (
);
};
export default Carousel;
`
this returns "imageGalleryRef.current.toggleFullscreen is not a function"
but I can run that function from the console and it works, what am I doing wrong?
also is this the best way to implement clicking on the image and going fullscreen?
Beta Was this translation helpful? Give feedback.
All reactions