Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lightbox image not centering #200

Open
MindsetZack opened this issue May 27, 2021 · 3 comments
Open

Lightbox image not centering #200

MindsetZack opened this issue May 27, 2021 · 3 comments

Comments

@MindsetZack
Copy link

MindsetZack commented May 27, 2021

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

@foodaka
Copy link

foodaka commented Jul 8, 2021

Same with mine, any idea?

@muh-hizbe
Copy link

same with my case, does anyone solve this?

@muh-hizbe
Copy link

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants