Scrolling issues with FlatList when rows are variable height

后端 未结 4 2129
时光说笑
时光说笑 2021-02-01 08:11

I\'m using a FlatList where each row can be of different height (and may contain a mix of both text and zero or more images from a remote server).

I cannot

4条回答
  •  南旧
    南旧 (楼主)
    2021-02-01 08:33

    So what I think you can do and what you already have the outlets for is to store a collection by the index of the rows layouts onLayout. You'll want to store the attributes that's returned by getItemLayout: {length: number, offset: number, index: number}.

    Then when you implement getItemLayout which passes an index you can return the layout that you've stored. This should resolve the issues with scrollToIndex. Haven't tested this, but this seems like the right approach.

提交回复
热议问题