Skip to content

Commit

Permalink
adjust bottom viewability math
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldchen committed Feb 16, 2024
1 parent aeae355 commit 667d5b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"**/node_modules": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.validate": ["typescript", "typescriptreact"],
"editor.formatOnSave": true,
Expand Down
6 changes: 2 additions & 4 deletions src/viewability/ViewabilityHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,9 @@ class ViewabilityHelper {
if (itemLayout === undefined) {
return false;
}
const itemTop = (horizontal ? itemLayout.x : itemLayout.y) - scrollOffset;
const itemTop = (horizontal ? itemLayout.x : itemLayout.y) - scrollOffset + bottomViewabilityInset;

Check failure on line 137 in src/viewability/ViewabilityHelper.ts

View workflow job for this annotation

GitHub Actions / Lint Typescript

Replace `·(horizontal·?·itemLayout.x·:·itemLayout.y)·-·scrollOffset·+` with `⏎······(horizontal·?·itemLayout.x·:·itemLayout.y)·-⏎······scrollOffset·+⏎·····`
const itemSize = horizontal ? itemLayout.width : itemLayout.height;
const listMainSize = horizontal
? listSize.width
: listSize.height - bottomViewabilityInset;
const listMainSize = horizontal ? listSize.width : listSize.height;
const pixelsVisible =
Math.min(itemTop + itemSize, listMainSize) - Math.max(itemTop, 0);

Expand Down

0 comments on commit 667d5b7

Please sign in to comment.