diff --git a/src/components/SelectionList/Search/ReportListItem.tsx b/src/components/SelectionList/Search/ReportListItem.tsx index f35880e6077f..b463cabbe960 100644 --- a/src/components/SelectionList/Search/ReportListItem.tsx +++ b/src/components/SelectionList/Search/ReportListItem.tsx @@ -79,6 +79,10 @@ function ReportListItem({ const {isLargeScreenWidth} = useWindowDimensions(); const StyleUtils = useStyleUtils(); + if (reportItem.transactions.length === 0) { + return; + } + const listItemPressableStyle = [styles.selectionListPressableItemWrapper, styles.pv3, item.isSelected && styles.activeComponentBG, isFocused && styles.sidebarLinkActive]; const handleOnButtonPress = () => { @@ -95,18 +99,14 @@ function ReportListItem({ return null; } - const participantFrom = reportItem.transactions[0]?.from; - const participantTo = reportItem.transactions[0]?.to; + const participantFrom = reportItem.transactions[0].from; + const participantTo = reportItem.transactions[0].to; // These values should come as part of the item via SearchUtils.getSections() but ReportListItem is not yet 100% handled // This will be simplified in future once sorting of ReportListItem is done const participantFromDisplayName = participantFrom?.name ?? participantFrom?.displayName ?? participantFrom?.login ?? ''; const participantToDisplayName = participantTo?.name ?? participantTo?.displayName ?? participantTo?.login ?? ''; - if (reportItem.transactions.length === 0) { - return; - } - if (reportItem.transactions.length === 1) { const transactionItem = reportItem.transactions[0];