Skip to content

Commit

Permalink
Merge pull request #47303 from bernhardoj/fix/46710-zero-is-shown-whe…
Browse files Browse the repository at this point in the history
…n-split-share-is-zero

Fix "0" is shown if the user split share is 0
  • Loading branch information
marcochavezf authored Aug 13, 2024
2 parents 4496333 + 7986a7b commit 4db189b
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 4db189b

Please sign in to comment.