1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-12 22:15:55 +00:00

brewRenderer: Capture event properties while still in event loop.

React [pools events](https://github.com/facebook/react/issues/2850),
which means that once the lambda runs later on the properties we want
to read will be null. Instead, we capture the properties in the event
loop.
This commit is contained in:
Rae Che
2018-08-20 17:20:13 +01:00
committed by Trevor Buckner
parent 5ab7c29b9d
commit f6b058f3c9

View File

@@ -58,8 +58,9 @@ const BrewRenderer = createClass({
},
handleScroll : function(e){
let target = e.target;
this.setState((prevState)=>({
viewablePageNumber : Math.floor(e.target.scrollTop / e.target.scrollHeight * prevState.pages.length)
viewablePageNumber : Math.floor(target.scrollTop / target.scrollHeight * prevState.pages.length)
}));
},