I have a Text
with long text inside a ScrollView
and I want to detect when the user has scrolled to the end of the text so I can enable a button.>
@Henrik R's right. But you should use Math.ceil() too.
function handleInfinityScroll(event) {
let mHeight = event.nativeEvent.layoutMeasurement.height;
let cSize = event.nativeEvent.contentSize.height;
let Y = event.nativeEvent.contentOffset.y;
if(Math.ceil(mHeight + Y) >= cSize) return true;
return false;
}