Skip to content

Commit

Permalink
fix 0 is shown
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Aug 13, 2024
1 parent 420c2a1 commit 7986a7b
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,10 @@ function MoneyRequestPreviewContent({
// If available, retrieve the split share from the splits object of the transaction, if not, display an even share.
const splitShare = useMemo(
() =>
shouldShowSplitShare &&
(transaction?.comment?.splits?.find((split) => split.accountID === sessionAccountID)?.amount ??
IOUUtils.calculateAmount(isPolicyExpenseChat ? 1 : participantAccountIDs.length - 1, requestAmount, requestCurrency ?? '', action.actorAccountID === sessionAccountID)),
shouldShowSplitShare
? transaction?.comment?.splits?.find((split) => split.accountID === sessionAccountID)?.amount ??
IOUUtils.calculateAmount(isPolicyExpenseChat ? 1 : participantAccountIDs.length - 1, requestAmount, requestCurrency ?? '', action.actorAccountID === sessionAccountID)
: 0,
[shouldShowSplitShare, isPolicyExpenseChat, action.actorAccountID, participantAccountIDs.length, transaction?.comment?.splits, requestAmount, requestCurrency, sessionAccountID],
);

Expand Down Expand Up @@ -387,9 +388,9 @@ function MoneyRequestPreviewContent({
<Text style={[styles.textLabelSupporting, styles.textNormal]}>{merchantOrDescription}</Text>
)}
</View>
{splitShare && (
{!!splitShare && (
<Text style={[styles.textLabel, styles.colorMuted, styles.ml1, styles.amountSplitPadding]}>
{translate('iou.yourSplit', {amount: CurrencyUtils.convertToDisplayString(splitShare ?? 0, requestCurrency)})}
{translate('iou.yourSplit', {amount: CurrencyUtils.convertToDisplayString(splitShare, requestCurrency)})}
</Text>
)}
</View>
Expand Down

0 comments on commit 7986a7b

Please sign in to comment.