what onEndReachedThreshold really means in react-native

前端 未结 4 925
轮回少年
轮回少年 2021-02-18 13:07

from documentation:

onEndReachedThreshold number

Threshold in pixels (virtual, not physical) for calling onEndReached. so I just w

4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-18 13:43

    For anyone using FlatList INSTEAD of ListView, note that the parameter units have changed.

    For ListView it was in pixels from the bottom, but according to docs for FlatList, it is instead units of length from the bottom in list items.

    How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.

    Thus, if you want the list to update when the user is halfway down the current dataset, set the value to 0.5

提交回复
热议问题