Skip to content

Commit

Permalink
Add FlashList props to prevent blank space when scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
jiji14 committed Feb 22, 2024
1 parent 034bee2 commit 6f101d1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions www/js/diary/list/TimelineScrollList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ const TimelineScrollList = ({
}
ListFooterComponent={isLoading == 'prepend' ? smallSpinner : footer}
ItemSeparatorComponent={separator}
/* Percent of viewport that must be covered for a partially occluded item to count as "viewable", 0-100.
a single pixel in the viewport makes the item viewable */
viewabilityConfig={{
viewAreaCoveragePercentThreshold: 0,
itemVisiblePercentThreshold: 0,
waitForInteraction: false,
}}
// 'getItemType' prop is used when FlashList has different types of cell components and these are vastly different
getItemType={(item) => {
if (item.origin_key.includes('trip')) {
return 'trip';
} else if (item.origin_key.includes('place')) {
return 'place';
} else if (item.origin_key.includes('untracked')) {
return 'untracked';
} else {
return 'unknown';
}
}}
/>
);
} else {
Expand Down

0 comments on commit 6f101d1

Please sign in to comment.