mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 10:22:38 +00:00
move stuff around for minimal changes
This commit is contained in:
@@ -115,6 +115,14 @@ const BrewRenderer = (props)=>{
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const updateCurrentPage = useCallback(_.throttle((e)=>{
|
||||||
|
const { scrollTop, clientHeight, scrollHeight } = e.target;
|
||||||
|
const totalScrollableHeight = scrollHeight - clientHeight;
|
||||||
|
const currentPageNumber = Math.max(Math.ceil((scrollTop / totalScrollableHeight) * rawPages.length), 1);
|
||||||
|
|
||||||
|
props.onPageChange(currentPageNumber);
|
||||||
|
}, 200), []);
|
||||||
|
|
||||||
const frameDidMount = ()=>{ //This triggers when iFrame finishes internal "componentDidMount"
|
const frameDidMount = ()=>{ //This triggers when iFrame finishes internal "componentDidMount"
|
||||||
setTimeout(()=>{ //We still see a flicker where the style isn't applied yet, so wait 100ms before showing iFrame
|
setTimeout(()=>{ //We still see a flicker where the style isn't applied yet, so wait 100ms before showing iFrame
|
||||||
renderPages(); //Make sure page is renderable before showing
|
renderPages(); //Make sure page is renderable before showing
|
||||||
@@ -126,14 +134,6 @@ const BrewRenderer = (props)=>{
|
|||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateCurrentPage = useCallback(_.throttle((e)=>{
|
|
||||||
const { scrollTop, clientHeight, scrollHeight } = e.target;
|
|
||||||
const totalScrollableHeight = scrollHeight - clientHeight;
|
|
||||||
const currentPageNumber = Math.max(Math.ceil((scrollTop / totalScrollableHeight) * rawPages.length), 1);
|
|
||||||
|
|
||||||
props.onPageChange(currentPageNumber);
|
|
||||||
}, 200), []);
|
|
||||||
|
|
||||||
const isInView = (index)=>{
|
const isInView = (index)=>{
|
||||||
if(!state.isMounted)
|
if(!state.isMounted)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user