This library provides Reason bindings for react-sticky.
These bindings should be complete and working, I use them in production without problems. If, however, you encounter any problems, feel free to open an issue.
Run:
yarn add react-sticky @jsiebern/bs-react-sticky
to add the library to your project dependencies. And add @jsiebern/bs-react-sticky
to the bs-dependencies
node of your bsconfig.json
.
See this link for the full example.
let component = ReasonReact.statelessComponent("App");
let make = _children => {
...component,
render: _self =>
<ReactSticky.StickyContainer>
<ReactSticky.Sticky>
...(
stickyProps =>
ReactSticky.Sticky.RenderProps.(
<div style=(stickyProps |. style)>
((stickyProps |. isSticky ? "Moving" : "Not Moving") |. ReasonReact.string)
</div>
)
)
</ReactSticky.Sticky>
</ReactSticky.StickyContainer>,
};
Important: The bindings use an abstract object type, so the easiest thing to access the stickyProps
is to open ReactSticky.Sticky.RenderProps
and then access the render functions props by the chain operator (e.g. stickyProps |. isSticky
).