Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/EmptyStateComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function EmptyStateComponent({
<View style={[styles.gap2, styles.mt5, !shouldUseNarrowLayout ? styles.flexRow : styles.mhAuto]}>
{buttons?.map(({buttonText, buttonAction, success, icon, isDisabled, style}) => (
<Button
key={buttonText}
success={success}
onPress={buttonAction}
text={buttonText}
Expand Down
8 changes: 5 additions & 3 deletions src/pages/AddUnreportedExpense.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SelectionList from '@components/SelectionList';
import type {ListItem, SectionListDataType, SelectionListHandle} from '@components/SelectionList/types';
import UnreportedExpensesSkeleton from '@components/Skeletons/UnreportedExpensesSkeleton';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import {fetchUnreportedExpenses} from '@libs/actions/UnreportedExpenses';
import interceptAnonymousUser from '@libs/interceptAnonymousUser';
Expand All @@ -31,12 +32,13 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) {
const {translate} = useLocalize();
const [errorMessage, setErrorMessage] = useState<string>('');
const [offset, setOffset] = useState(0);
const {isOffline} = useNetwork();

const {reportID, backToReport} = route.params;
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true});
const [hasMoreUnreportedTransactionsResults] = useOnyx(ONYXKEYS.HAS_MORE_UNREPORTED_TRANSACTIONS_RESULTS, {canBeMissing: true});
const [isLoadingUnreportedTransactions] = useOnyx(ONYXKEYS.IS_LOADING_UNREPORTED_TRANSACTIONS, {canBeMissing: true});

const shouldShowUnreportedTransactionsSkeletons = isLoadingUnreportedTransactions && hasMoreUnreportedTransactionsResults && !isOffline;
function getUnreportedTransactions(transactions: OnyxCollection<Transaction>) {
if (!transactions) {
return [];
Expand Down Expand Up @@ -174,8 +176,8 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) {
setErrorMessage('');
}}
onEndReached={fetchMoreUnreportedTransactions}
onEndReachedThreshold={0.9}
listFooterContent={isLoadingUnreportedTransactions ? <UnreportedExpensesSkeleton fixedNumberOfItems={3} /> : undefined}
onEndReachedThreshold={0.75}
listFooterContent={shouldShowUnreportedTransactionsSkeletons ? <UnreportedExpensesSkeleton fixedNumberOfItems={3} /> : undefined}
>
{!!errorMessage && (
<FormHelpMessage
Expand Down