captivationsoftware / react-sticky

<Sticky /> component for awesome React apps
MIT License
2.64k stars 385 forks source link

[Violation] 'requestIdleCallback' in console with v6.0.1 #186

Closed aribronstein closed 6 years ago

aribronstein commented 7 years ago

I'm getting a large number of [Violation] 'requestIdleCallback' handler took [x]ms when scrolling up and down my page in chrome once I have activated my sticky element.

mock code

class CartItem extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <StickyContainer key={this.props.item.item_id}
           ref={(ref) => this.item_ref = ref}
           className={this.props.item.isRemoving ? styles.item_removing : styles.item}
           onTransitionEnd={this.transitionEnd}>
        <Sticky>
          {({style}) => {
            return (
              <div className={styles.table} style={ this.state.toggleAlternatives ? style: {} }>
                .....
              </div>
            )
          }}
        </Sticky>
         .....
      </StickyContainer>
    );
  }
};