diff --git a/src/components/MoneyRequestSkeletonView.js b/src/components/MoneyRequestSkeletonView.js new file mode 100644 index 000000000000..50a7b56b91e3 --- /dev/null +++ b/src/components/MoneyRequestSkeletonView.js @@ -0,0 +1,40 @@ +import React from 'react'; +import {Rect} from 'react-native-svg'; +import SkeletonViewContentLoader from 'react-content-loader/native'; +import variables from '../styles/variables'; +import themeColors from '../styles/themes/default'; +import styles from '../styles/styles'; + +function MoneyRequestSkeletonView() { + return ( + + + + + + ); +} + +MoneyRequestSkeletonView.displayName = 'MoneyRequestSkeletonView'; +export default MoneyRequestSkeletonView; diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js index fa14c3dee4f5..637302f7d4f0 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview.js +++ b/src/components/ReportActionItem/MoneyRequestPreview.js @@ -33,6 +33,7 @@ import * as ReceiptUtils from '../../libs/ReceiptUtils'; import ReportActionItemImages from './ReportActionItemImages'; import transactionPropTypes from '../transactionPropTypes'; import colors from '../../styles/colors'; +import MoneyRequestSkeletonView from '../MoneyRequestSkeletonView'; const propTypes = { /** The active IOUReport, used for Onyx subscription */ @@ -234,77 +235,81 @@ function MoneyRequestPreview(props) { isHovered={isScanning} /> )} - - - - {getPreviewHeaderText()} - {Boolean(getSettledMessage()) && ( - <> - - {getSettledMessage()} - + {_.isEmpty(props.transaction) ? ( + + ) : ( + + + + {getPreviewHeaderText()} + {Boolean(getSettledMessage()) && ( + <> + + {getSettledMessage()} + + )} + + {hasFieldErrors && ( + )} - {hasFieldErrors && ( - - )} - - - - {getDisplayAmountText()} - {ReportUtils.isSettled(props.iouReport.reportID) && !props.isBillSplit && ( - - + + {getDisplayAmountText()} + {ReportUtils.isSettled(props.iouReport.reportID) && !props.isBillSplit && ( + + + + )} + + {props.isBillSplit && ( + + )} - {props.isBillSplit && ( - - + {shouldShowMerchant && ( + + {requestMerchant} )} - - {shouldShowMerchant && ( - {requestMerchant} - - )} - - - {!isCurrentUserManager && props.shouldShowPendingConversionMessage && ( - {props.translate('iou.pendingConversionMessage')} + + {!isCurrentUserManager && props.shouldShowPendingConversionMessage && ( + {props.translate('iou.pendingConversionMessage')} + )} + {shouldShowDescription && {description}} + + {props.isBillSplit && !_.isEmpty(participantAccountIDs) && ( + + {props.translate('iou.amountEach', { + amount: CurrencyUtils.convertToDisplayString( + IOUUtils.calculateAmount(isPolicyExpenseChat ? 1 : participantAccountIDs.length - 1, requestAmount, requestCurrency), + requestCurrency, + ), + })} + )} - {shouldShowDescription && {description}} - {props.isBillSplit && !_.isEmpty(participantAccountIDs) && ( - - {props.translate('iou.amountEach', { - amount: CurrencyUtils.convertToDisplayString( - IOUUtils.calculateAmount(isPolicyExpenseChat ? 1 : participantAccountIDs.length - 1, requestAmount, requestCurrency), - requestCurrency, - ), - })} - - )} - + )} diff --git a/src/styles/variables.ts b/src/styles/variables.ts index f584e657c693..3b6dbf47970e 100644 --- a/src/styles/variables.ts +++ b/src/styles/variables.ts @@ -152,4 +152,6 @@ export default { qrShareHorizontalPadding: 32, baseMenuItemHeight: 64, + + moneyRequestSkeletonHeight: 107, } as const;