Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Creating a 'onChangeScrollState' callback function prop… #227

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

alexkb0009
Copy link

…to be called (if exists) in componentDidUpdate when pastState.isScrolling !== this.state.isScrolling. Maybe it should go into componentWillUpdate?

This function prop allows me to set "pointer-events: none" on a parent element while scrolling. In my case, list items (displayables) are within a horizontally scrollable container which causes Chrome to lag/skip slightly during scrolling. Setting pointer-events: none on the element with overflow-x: auto, during vertical scrolling, fixes this.

Another edit included in this PR is changing a couple of defaultProps for function props/properties from function(){} to either null or undefined, so function doesn't get bound to an element at all if not provided/used. Point was to slightly improve performance, if possible.

In near future, would like to convert to ES6 module syntax (class Infinite extends React.Component { ...) if no one else has started on this.

…(if exists) in componentDidUpdate when pastState.isScrolling !== this.state.isScrolling. Also, allowing function props/handlers to be null or undefined to prevent function call/binding when not needed.
@alexkb0009 alexkb0009 closed this Jun 9, 2017
@alexkb0009 alexkb0009 reopened this Jun 9, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 93.249% when pulling 0ba70b7 on alexkb0009:master into 94dc599 on seatgeek:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 93.249% when pulling 15daa64 on alexkb0009:master into 94dc599 on seatgeek:master.

…s to be a more accurate timing as perhaps no need to wait for React to perform update.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 93.249% when pulling 2c71004 on alexkb0009:master into 94dc599 on seatgeek:master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants