I am trying to create a "load more" functionality to my ScollView. Currently I have a button, which when pressed loads more elements into the ScrollView. This all works as expected. However, I am now trying to trigger this when the user is close to the end of the ScrollView, but unfortunately the function is not triggering. I have tried changing the values of onEndReachedThreshold (bigger and smaller), with no luck. I have pasted my module return below. All help is much appreciated.
return (
<View style={{ width: "100%", height: "100%" }}>
<ScrollView showsVerticalScrollIndicator={false} onEndReachedThreshold={10} onEndReached={() => { console.log("end reached"); this.props.pEnd ? this.props.loadMore() : null }} refreshControl={<RefreshControl refreshing={this.props.refreshing} onRefresh={() => { this.props.getData(0) }} />} style={{ width: "100%", flexDirection: "column" }}>
<View style={{ height: 10, width: "100%" }}></View>
{scrollables}
{this.props.pEnd ? null : <View style={{ height: 25, width: "100%", flexDirection: "row", justifyContent: "center", alignItems: "center" }}>
<TouchableOpacity
style={{ height: "100%", width: 100, backgroundColor: "white", borderRadius: 20, padding: 2, justifyContent: "center", alignItems: "center" }}
onPress={() => { this.props.loadMore() }}>
<Text>Load Older...</Text>
</TouchableOpacity>
</View>}
<View style={{ width: "100%", height: "10%", paddingBottom: "20%" }}></View>
</ScrollView>
</View>);