Skip to content

Commit 44ea065

Browse files
committed
fix on bottom not triggering when zoomed when not using body as scroll
1 parent 3240df8 commit 44ea065

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ class BottomScrollListener extends Component<Props> {
7575
if (this.props.children instanceof Function) {
7676
const scrollNode = this.optionalScrollContainerRef.current
7777

78-
if (
79-
scrollNode != null &&
80-
scrollNode.scrollHeight - this.props.offset <= scrollNode.scrollTop + scrollNode.clientHeight
81-
) {
82-
this.props.onBottom()
78+
if (scrollNode != null) {
79+
const scrollContainerBottomPosition = Math.round(scrollNode.scrollTop + scrollNode.clientHeight)
80+
const scrollPosition = Math.round(scrollNode.scrollHeight - this.props.offset)
81+
82+
if (scrollPosition <= scrollContainerBottomPosition) {
83+
this.props.onBottom()
84+
}
8385
}
8486
} else {
8587
const scrollNode = document.scrollingElement || document.documentElement

0 commit comments

Comments
 (0)