noeldelgado / react-gemini-scrollbar

:last_quarter_moon: React component for custom overlay-scrollbars with native scrolling mechanism.
MIT License
133 stars 24 forks source link

add context support #28

Open hhhonzik opened 8 years ago

hhhonzik commented 8 years ago

I am using react-gemini-scrollbar library in my project and i find it very helpful.

But today I was adding react-scroll library which needs a containerId - which can be obtained with scrollbar.getViewElement().

I added context support to the component, so now you can get the instance like this:

class Button extends React.Component {
  static contextTypes = {
    geminiScrollbar: React.PropTypes.object
  };

  onClick() {
    console.log(this.context.geminiScrollbar.get().getViewElement);
  }

I also refactored the component as Class while doing that.

JakubKontra commented 8 years ago

+1

milan182 commented 8 years ago

+1

This will really helpful - We need to add our own scroll event listener on the scrollbar.getViewElement() to implement a infinite scroll feature.

neolectron commented 7 years ago

up ? :)