Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@ class RNIntersectionObserver {
right: this._restrictValueInRange(relativeRect.left, relativeRect.right, observeRect.right),
bottom: this._restrictValueInRange(relativeRect.top, relativeRect.bottom, observeRect.bottom)
}
visibleRect.width = visibleRect.right - visibleRect.left
visibleRect.height = visibleRect.bottom - visibleRect.top

const targetArea = (observeRect.bottom - observeRect.top) * (observeRect.right - observeRect.left)
const visibleArea = (visibleRect.bottom - visibleRect.top) * (visibleRect.right - visibleRect.left)
const visibleArea = visibleRect.width * visibleRect.height
const intersectionRatio = targetArea ? visibleArea / targetArea : 0
const isInsected = isInit ? intersectionRatio > this.initialRatio : !(this._getRatioIndex(intersectionRatio, this.thresholds) === this._getRatioIndex(this.previousIntersectionRatio[observeIndex], this.thresholds))
this.previousIntersectionRatio[observeIndex] = intersectionRatio
Expand Down
Loading