react-photo-gallery icon indicating copy to clipboard operation
react-photo-gallery copied to clipboard

Lightbox image not centering

Open MindsetZack opened this issue 3 years ago • 3 comments

Hey, just wondering if anyone has come across the issue with the lightbox image not being centered?

MindsetZack avatar May 27 '21 12:05 MindsetZack

Same with mine, any idea?

foodaka avatar Jul 08 '21 18:07 foodaka

same with my case, does anyone solve this?

muh-hizbe avatar Jul 28 '21 03:07 muh-hizbe

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>

muh-hizbe avatar Jul 28 '21 04:07 muh-hizbe