captivationsoftware/react-sticky

jumpy scroll when sticky disabled & cleaner way to disable sticky

Closed this issue · 3 comments

I have passed in an empty style object based on the suggestion here to disable the sticky.
#170

I'm seeing a jump/flash when I scroll up with this approach.

Also it would be nice to have a single prop to disable the sticky. I was depending on the isSticky prop for a lot of styles, and I have to set that to false as well as pass in the empty style object to mimic the sticky being disabled.
Even with this approach isSticky is still set to true in the components state, and I would prefer to not have to manage this myself.

It looks like there is an inline style for padding-bottom on the Sticky component that's causing the jump. I cannot override this style because the component isn't taking in className or style props.

Can the component take in a className so it can be styled?

Look at the disableCompensation property in the README - that should give you what you are looking for.

that worked great, thanks!