captivationsoftware/react-sticky

isSticky is always true

Closed this issue · 3 comments

I'm submitting a ...

  • bug report
  • feature request
  • support request

Code snippet

const style = ({ theme }) => ({
    minHeight: '100vh',
    backgroundColor: theme.colors.black,
});

const IndexPage = () => (
    <FelaComponent style={style}>
        <StickyContainer>
            <Sticky>
                {({ style }) => (
                    <div
                        style={{
                            ...style,
                            zIndex: 999,
                        }}
                    >
                        <Header withBackground={false} />
                    </div>
                )}
            </Sticky>
            <Main />
            <Footer />
        </StickyContainer>
    </FelaComponent>
);

What is the current behavior?

isSticky flag is always true.

What is the expected or desired behavior?

false if element is in its position and true if sticky.

Why do you want this? What use case do you have?

I need it to change styles when element is sticky.

What is your environment?

  • Version: 6.0.3
  • Browser: Chrome 72.0.3626.121
vcarl commented

The demo deployed from master seems to work correctly. Going to close this since I can't reproduce, if you can get a reproduction working (with no external dependencies) then I can reopen.

https://react-sticky.netlify.com/#/basic

https://gfycat.com/FairEnviousKitfox

The example works because there is a content before Sticky, I have Sticky as a top component which looks like its unable to recognize is it is at the top of container or not.

vcarl commented

Could you please set up a reproduction I can poke around?