mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-22 14:27:10 +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:
1 parent
5ab7c29b9d
commit
f6b058f3c9
1 file changed
+2
-1
@@ -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)
|
||||
}));
|
||||
},
|
||||
|
||||
|
||||
Reference in new issue
Block a user