From c61076c983fe238e3435fed67547aeb2b816d4f0 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Tue, 15 Sep 2020 10:09:23 -0300 Subject: [PATCH] [FIX] Read receipt crashing in some cases (#2464) --- app/views/ReadReceiptView/index.js | 41 +++++++++++++++-------------- app/views/ReadReceiptView/styles.js | 3 +-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/views/ReadReceiptView/index.js b/app/views/ReadReceiptView/index.js index 9ec188d0..9cb916ed 100644 --- a/app/views/ReadReceiptView/index.js +++ b/app/views/ReadReceiptView/index.js @@ -100,6 +100,9 @@ class ReadReceiptView extends React.Component { Message_TimeFormat, user: { id: userId, token }, baseUrl, theme } = this.props; const time = moment(item.ts).format(Message_TimeFormat); + if (!item?.user?.username) { + return null; + } return ( - {item.user.name} + {item?.user?.name} {time} @@ -142,25 +145,23 @@ class ReadReceiptView extends React.Component { return ( - - {loading - ? - : ( - item._id} - /> - )} - + {loading + ? + : ( + item._id} + /> + )} ); } diff --git a/app/views/ReadReceiptView/styles.js b/app/views/ReadReceiptView/styles.js index c9375429..828e814c 100644 --- a/app/views/ReadReceiptView/styles.js +++ b/app/views/ReadReceiptView/styles.js @@ -29,7 +29,6 @@ export default StyleSheet.create({ padding: 10 }, list: { - ...sharedStyles.separatorVertical, - marginVertical: 10 + ...sharedStyles.separatorVertical } });