preventScroll not working in v1
Good day,
In versions 0.x I had to set the prop below to stop the page from scrolling to the top whenever the lightbox was opened. This prop has a default value of true.
preventScroll={false}
Unfortunately, this trick no longer works in v1 so even with this prop set I'm still experiencing the automatic scroll to the top of the page.
Is anyone else experiencing this?
Here is my JSX:
<ModalGateway>
{this.state.lightboxIsOpen && (
<Modal
allowFullscreen={false}
onClose={this.closeLightbox}
closeOnBackdropClick={true}
>
<Lightbox
currentIndex={this.state.currentImage}
views={this.props.images}
components={{ View }}
preventScroll={false}
/>
</Modal>
)}
</ModalGateway>
Cheers,
Alec
Update
I had a look at the source code and noticed the prop doesn't exist. Would the project like me to submit a PR to implement it?
I think it should be a one-liner. Changing the line:
<ScrollLock />
To this:
{this.props.preventScroll && <ScrollLock />}
Cheers,
Alec
@alec-francis I attempted your one-liner fix, but it does not work. Did you find a workaround?