captivationsoftware/react-sticky

Event is reused for performance reasons

szujak opened this issue · 1 comments

Hello,

I find one bug (or maybe I did something wrong :) in this new version of react-sicky. When I have scrollable content inside Sticky component then I getting this warnings

warning.js:36 Warning: This synthetic event is reused for performance reasons. If you're seeing this, you're accessing the method `currentTarget` on a released/nullified synthetic event. This is a no-op function. If you must keep the original synthetic event around, use event.persist(). See https://fb.me/react-event-pooling for more information.

printWarning	@	warning.js:36
warning	@	warning.js:60
warn	@	SyntheticEvent.js:265
get	@	SyntheticEvent.js:259
(anonymous)	@	Container.js:64
(anonymous)	@	Container.js:60

var _this$node$getBoundin = _this.node.getBoundingClientRect(),
    top = _this$node$getBoundin.top,
    bottom = _this$node$getBoundin.bottom;

_this.subscribers.forEach(function (handler) {
  return handler({
    distanceFromTop: top,
    distanceFromBottom: bottom,
    eventSource: evt.currentTarget === window ? document.body : _this.node <------ here
  });
});

Closed by #178