You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shouldn't the key value that is passed back from the itemKey function be passed into the itemSize function or am I not understanding this properly? In a perfect world, it would make sense to have the itemKey passed into the itemSize and in addition to that, have the data passed in as a second parameter to the itemSize function as well so that if someone wanted to run calculations based off of the data, they could. As it stands right now, my list gets rendering issues when i make any changes to my data when I merge my data.
constgetItemKey=(idx,data)=>{const{ uniqueId }=data[idx];returnuniqueId;};constgetItemSize=(idx)=>{// 1) idx is zero based array index and NOT my uniqueId from getItemKey// 2) FEATURE REQUEST: Add data as a parameter, like getItemSize, so that math could be done// to determine the height of the item.// ....};<AutoSizer>{({ height, width })=>(<VariableSizeListheight={height}width={width}estimatedItemSize={88}itemKey={getItemKey}itemSize={getItemSize}itemCount={dataCount}itemData={data}>{ListRowItem}</VariableSizeList>)}</AutoSizer>
The text was updated successfully, but these errors were encountered:
I think this issue is a misunderstanding 😄 Hopefully the below answer helps clear things up.
Shouldn't the key value that is passed back from the itemKey function be passed into the itemSize function or am I not understanding this properly? In a perfect world, it would make sense to have the itemKey passed into the itemSize
The itemSize function accepts an index. It can convert that value to a key, if that's useful, by calling your own e.g. getItemKey function, but I don't think this is generally required. itemSize function is responsible for determining the size of a specific item within the array. The key is something React uses to efficiently re-render when things move around within the array. These are different concerns.
and in addition to that, have the data passed in as a second parameter to the itemSize function as well so that if someone wanted to run calculations based off of the data, they could.
Shouldn't the key value that is passed back from the
itemKey
function be passed into theitemSize
function or am I not understanding this properly? In a perfect world, it would make sense to have the itemKey passed into the itemSize and in addition to that, have the data passed in as a second parameter to the itemSize function as well so that if someone wanted to run calculations based off of the data, they could. As it stands right now, my list gets rendering issues when i make any changes to my data when I merge my data.The text was updated successfully, but these errors were encountered: