Problem
Some of the operations we do in ReportActionsList renderItem are pretty expensive since this function is executed for every items in the render window every time the render window changes. To improve performance of FlatList scrolling we need to move any expensive computation inside a memoized component. This way when FlatList re-renders to display new items but the data did not change only the new rendered items will need to render.
We were already memoizing ReportActionItem, but renderItem still contains some expensive calls, specifically isConsecutiveActionMadeByPreviousActor which has to do some date comparisons. I moved those to a new component ReportActionsListItemRenderer which will prevent any re-renders coming from from FlatList for items that were already rendered. This reduces the number of calls to isConsecutiveActionMadeByPreviousActor from the number of currently rendered item (~100 depending on the FlatList window size) to just the new items being added (usually 10 since this is the batch size).
Problem
Some of the operations we do in ReportActionsList renderItem are pretty expensive since this function is executed for every items in the render window every time the render window changes. To improve performance of FlatList scrolling we need to move any expensive computation inside a memoized component. This way when FlatList re-renders to display new items but the data did not change only the new rendered items will need to render.
We were already memoizing ReportActionItem, but renderItem still contains some expensive calls, specifically
isConsecutiveActionMadeByPreviousActorwhich has to do some date comparisons. I moved those to a new componentReportActionsListItemRendererwhich will prevent any re-renders coming from from FlatList for items that were already rendered. This reduces the number of calls toisConsecutiveActionMadeByPreviousActorfrom the number of currently rendered item (~100 depending on the FlatList window size) to just the new items being added (usually 10 since this is the batch size).