Fix autoscroll issue

Summary:
Noticed a regression in sticky scrolling not being sticky. I suspect this is caused by pixel inaccuracy + rounding, but our offset from bottom calculation consistently now reports `1` when being at the end of the scrollable region.

Too bad it is really hard to protect against these kind of regressions automated.

Reviewed By: passy

Differential Revision: D28095803

fbshipit-source-id: 1dbd57d84fb308023c2300c543aca344bf27ec28
This commit is contained in:
Michel Weststrate
2021-04-29 11:44:24 -07:00
committed by Facebook GitHub Bot
parent 65d008c5da
commit 1a8943e903

View File

@@ -232,7 +232,7 @@ export const DataSourceRenderer: <T extends object, C>(
return; return;
} }
const fromEnd = elem.scrollHeight - elem.scrollTop - elem.clientHeight; const fromEnd = elem.scrollHeight - elem.scrollTop - elem.clientHeight;
if (autoScroll && fromEnd >= 1) { if (autoScroll && fromEnd > 1) {
onUpdateAutoScroll?.(false); onUpdateAutoScroll?.(false);
} else if (!autoScroll && fromEnd < 1) { } else if (!autoScroll && fromEnd < 1) {
onUpdateAutoScroll?.(true); onUpdateAutoScroll?.(true);