We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
onStickyChange
<Sticky/>
If I want to lift the isSticky state of a certain <Sticky/> to the parent component, I can't do it.
isSticky
(setting an ancestor's state within the <Sticky/>'s "children as a function" call yields a React warning (render should not have side-effects)
My use-case is that when the <Sticky/> gets sticky, I want to render it in some other container (not with position: fixed.
position: fixed
Another use-case could be, styling the <StickyContainer/> (Or another ancestor of the <Sticky/>) differently when the content isSticky=true.
<StickyContainer/>
isSticky=true
I like this lib.
The text was updated successfully, but these errors were encountered:
I agree this might be useful functionality to add to StickyContainer. To implement something like it for now, you can have render a component like
StickyContainer
class App extends React.Component { render() { return ( <StickyContainer> <Sticky> {stickyProps => ( <CustomStickyElement onStickyChange={handleStickyChange} stickyProps={stickyProps} /> )} </Sticky> </StickyContainer> ); } }
where CustomStickyElement checks for changes to isSticky and calls the handler accordingly.
CustomStickyElement
Sorry, something went wrong.
No branches or pull requests
I'm submitting a ...
What is the current behavior?
If I want to lift the
isSticky
state of a certain<Sticky/>
to the parent component, I can't do it.(setting an ancestor's state within the
<Sticky/>
's "children as a function" call yields a React warning (render should not have side-effects)What is the expected or desired behavior?
Why do you want this? What use case do you have?
My use-case is that when the
<Sticky/>
gets sticky, I want to render it in some other container (not withposition: fixed
.Another use-case could be, styling the
<StickyContainer/>
(Or another ancestor of the<Sticky/>
) differently when the contentisSticky=true
.Is there anything else I should know?
I like this lib.
The text was updated successfully, but these errors were encountered: