react-photo-gallery
react-photo-gallery copied to clipboard
Lightbox image not centering
Hey, just wondering if anyone has come across the issue with the lightbox image not being centered?
Same with mine, any idea?
same with my case, does anyone solve this?
Hi, i was solved it.
I was passing custom style in props of Carousel component with below code
const customStyles = {
view: () => ({
// none of react-images styles are passed to <View />
position: 'relative',
'& > img': {
position: 'relative',
margin: '0 auto'
},
})
};
..........
<div className={'px-20'}>
<Gallery photos={photos} onClick={openLightbox} />
<ModalGateway>
{viewerIsOpen ? (
<Modal onClose={closeLightbox}>
<Carousel
currentIndex={currentImage}
styles={customStyles}
views={photos.map(x => ({
...x,
srcset: x.srcSet,
caption: x.title
}))}
/>
</Modal>
) : null}
</ModalGateway>
</div>