mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-23 20:56:54 +00:00
Fix BrewRenderer scrolling to 0
This commit is contained in:
1 parent
3388fccad7
commit
85401ba71b
1 file changed
+1
-1
@@ -93,7 +93,7 @@ const BrewRenderer = (props)=>{
|
||||
const updateCurrentPage = useCallback(_.throttle((e)=>{
|
||||
const { scrollTop, clientHeight, scrollHeight } = e.target;
|
||||
const totalScrollableHeight = scrollHeight - clientHeight;
|
||||
const currentPageNumber = Math.ceil(((scrollTop + 1) / totalScrollableHeight) * rawPages.length);
|
||||
const currentPageNumber = Math.max(Math.ceil((scrollTop / totalScrollableHeight) * rawPages.length), 1);
|
||||
|
||||
props.onPageChange(currentPageNumber);
|
||||
}, 200), []);
|
||||
|
||||
Reference in new issue
Block a user