React Native ListView: Prepend Items

后端 未结 1 677
遇见更好的自我
遇见更好的自我 2021-02-09 15:20

Is it possible to prepend items to React Native\'s ListView on an onTopReached event similar to the way one appends items on an onEndReached event? Cur

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-09 16:19

    You should use FlatList

    Try adding the new items to the data source and use the 'scrolltoindex' method.

    FlatList

    scrollToIndex(params: object) Scrolls to the item at the specified index such that it is positioned in the viewable area such that viewPosition 0 places it at the top, 1 at the bottom, and 0.5 centered in the middle. viewOffset is a fixed number of pixels to offset the final target position.

    0 讨论(0)
提交回复
热议问题