react-sticky icon indicating copy to clipboard operation
react-sticky copied to clipboard

Add support for measuring arbitrary nodes as the container

Open bolora opened this issue 7 years ago • 1 comments

I don't want to use <StickyContainer> It would be great if you could assign a selector as wrapper to the Sticky element. Example:

<div id="some-id-that-wraps-sticky-object">
     ...
     <Sticky wrapper="#some-id-that-wraps-sticky-object">
         ...
     </Sticky>

     ...
</div>

Reason: <div id="some-id-that-wraps-sticky-object"> is outside the react root. Should also be able to do something like <Sticky wrapper="body">

bolora avatar Jan 31 '18 23:01 bolora

I see your use case, but I'm not a fan of reaching outside of the component arbitrarily. Would something like

<StickyContainer measureNode={domRef}>
  {/* ... */}
</StickyContainer>

work for you? I'm not sure I like that either, but I'd prefer it over an arbitrary selector.

vcarl avatar Feb 21 '18 18:02 vcarl