Closed resting closed 5 years ago
I read the Medium post but things are still not clear. getItemLayout
comes with 2 arguments data
and index
which is not mentioned in the medium post.
Also please answer these questions as well.
this.getItemLayout
is defined in the constructor?rawData
and rowIndex
?@resting No particular reason, I just copied this code from an app I was working on. It means the first item has height 100, all others 50. This library isn't necessary if all you're using is a FlatList. It won't work with that. scrollToLocation
has all kinds of bugs, lots of people seem to have trouble with it.
@smitthakkar1 sectionListGetItemLayout
is a higher order function that takes some arguments and returns the getItemLayout
function you pass as a prop to SectionList
. No particular reason it's called in the constructor, you could also call it outside of your component.
getItemHeight: (rowData, sectionIndex, rowIndex) => sectionIndex === 0 ? 100 : 50,
Do you only set for sectionIndex 0?
listHeaderHeight
not necessary if we're usingSectionList
instead ofFlatList
? Ie, if there's agetSectionHeaderHeight
set, thenlistHeaderHeight
is not necessary?Reason for asking is because
scrollToLocation
is not accurate when I implemented this.Quoting the example: