FlatList
there is a getItemLayout
method
this is how the Chinese website is introduced
getItemLayout
is an optional optimization to avoid the overhead of dynamically sizing content, but only if you know the height of the content in advance. If your row height is fixed,getItemLayout
is both efficient and simple to use, like this:
getItemLayout={(data, index) => (
{length: ITEM_HEIGHT, offset: ITEM_HEIGHT * index, index}
)}
it is necessary to know the size of the content in advance. What if the size of the content is not fixed?
my idea is to get it through the onLayout
method, but I don"t know if it is similar to the "need to know the height of the content in advance" mentioned above, because at this time the content and rendering
is there any good solution?