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: 0 additions & 1 deletion config/oxlint/oxlint.seatbelt.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@
"../../src/components/OptionRow.tsx" "@typescript-eslint/no-unsafe-type-assertion" 3
"../../src/components/OptionRow.tsx" "react-hooks/set-state-in-effect" 1
"../../src/components/ParentNavigationSubtitle.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/components/ParticipantPicker/BaseParticipantPicker.tsx" "no-restricted-imports" 1
"../../src/components/PDFView/index.native.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/components/PDFView/index.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/components/PDFView/index.tsx" "react-hooks/set-state-in-effect" 1
Expand Down
6 changes: 4 additions & 2 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,9 @@ const DYNAMIC_ROUTES = {
reportID: string | undefined;
isWorkspacesOnly?: boolean;
shouldExcludeWorkspaces?: boolean;
isFromConfirmation?: boolean;
}) => {
const {action, iouType, transactionID, reportID, isWorkspacesOnly, shouldExcludeWorkspaces} = params;
const {action, iouType, transactionID, reportID, isWorkspacesOnly, shouldExcludeWorkspaces, isFromConfirmation} = params;
// `getUrlWithParams` drops falsy values, so the flag is only sent when it is on.
return getUrlWithParams('expense-participants', {
action,
Expand All @@ -651,9 +652,10 @@ const DYNAMIC_ROUTES = {
reportID,
isWorkspacesOnly: isWorkspacesOnly ? 'true' : undefined,
shouldExcludeWorkspaces: shouldExcludeWorkspaces ? 'true' : undefined,
isFromConfirmation: isFromConfirmation ? 'true' : undefined,
});
},
queryParams: ['action', 'iouType', 'transactionID', 'reportID', 'isWorkspacesOnly', 'shouldExcludeWorkspaces'],
queryParams: ['action', 'iouType', 'transactionID', 'reportID', 'isWorkspacesOnly', 'shouldExcludeWorkspaces', 'isFromConfirmation'],
},
MONEY_REQUEST_STEP_SCAN: {
path: 'expense-scan',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ function useConfirmationListDataWithPolicy({
isEditingSplitBill,
expensesNumber = 0,
receiptOptions,
isParticipantPickerVisible = false,
onToggleBillable,
onToggleReimbursable,
isConfirmed,
Expand Down Expand Up @@ -293,7 +292,6 @@ function useConfirmationListDataWithPolicy({
shouldShowCategories,
shouldShowTax,
hasParticipantSection: sections.length > 0,
isParticipantPickerVisible,
};
const errorState = {shouldDisplayFieldError, formError, clearFormErrors, setFormError};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {canUseTouchScreen} from '@libs/DeviceCapabilities';
import {calculateAmount, isMovingTransactionFromTrackExpense, isP2PRecipient, isParticipantP2P} from '@libs/IOUUtils';
import {isConfirmationAmountMissing} from '@libs/MoneyRequestUtils';
import Navigation from '@libs/Navigation/Navigation';
import navigationRef from '@libs/Navigation/navigationRef';
import {shouldEnableNegative} from '@libs/ReportUtils';
import {calculateTaxAmount, getTaxCode, getTaxValue, hasAnyManuallyEnteredScanField} from '@libs/TransactionUtils';

Expand All @@ -33,10 +34,12 @@ import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
import type * as OnyxTypes from '@src/types/onyx';

import type {OnyxEntry} from 'react-native-onyx';

import {useIsFocused, useNavigation} from '@react-navigation/native';
import React, {useEffect, useRef, useState} from 'react';
import {View} from 'react-native';

Expand All @@ -58,7 +61,6 @@ type AmountFieldProps = {
policy: OnyxEntry<OnyxTypes.Policy>;
clearFormErrors: (errors: string[]) => void;
setFormError: (error: TranslationPaths | '') => void;
isParticipantPickerVisible?: boolean;
};

function AmountField({
Expand All @@ -73,8 +75,9 @@ function AmountField({
policy,
clearFormErrors,
setFormError,
isParticipantPickerVisible = false,
}: AmountFieldProps) {
const isScreenFocused = useIsFocused();
const navigation = useNavigation();
const {isEditingSplitBill, canEnterScanFieldsManually, isPolicyExpenseChat, isReadOnly, didConfirm, transactionID, action, iouType, reportID, reportActionID} = useConfirmationFields();
// Filled by the forms that offer a receipt from beside the amount field rather than from a full-width empty
// state, with their compact add-receipt button.
Expand Down Expand Up @@ -150,12 +153,20 @@ function AmountField({
const allowNegative =
shouldEnableNegative(report, policy, iouType, transactionSlice?.participants) && !isP2PRecipient(transactionSlice?.participants?.at(0), currentUserPersonalDetails.accountID);

// `autoFocus` on our TextInput only runs on mount. Closing and reopening the RHP often keeps the same mounted
// instance, so autofocus does not run again. We re-focus when the parent-owned participant picker closes
// (visible → hidden) so the amount input gains focus once the user selects a participant. The setTimeout defers
// focus past the RHP entry / picker close animation so the input reliably receives focus.
// Focus the amount on mount and after picking a participant. Other pages leave focus on the row the user edited.
const shouldFocusOnScreenFocusRef = useRef(true);
useEffect(
() =>
navigation.addListener('blur', () => {
shouldFocusOnScreenFocusRef.current = navigationRef.getCurrentRoute()?.name === SCREENS.MONEY_REQUEST.DYNAMIC_STEP_PARTICIPANTS;
}),
[navigation],
);

// `autoFocus` only runs on mount and the RHP often keeps this instance mounted, so focus again when the screen
// regains focus. The timeout waits out the RHP animation.
useEffect(() => {
if (!shouldAutoFocusOnMount || isAmountFieldDisabled || isParticipantPickerVisible) {
if (!shouldAutoFocusOnMount || isAmountFieldDisabled || !isScreenFocused || !shouldFocusOnScreenFocusRef.current) {
return;
}

Expand All @@ -167,7 +178,7 @@ function AmountField({
}
clearTimeout(focusTimeoutRef.current);
};
}, [shouldAutoFocusOnMount, isAmountFieldDisabled, isParticipantPickerVisible]);
}, [shouldAutoFocusOnMount, isAmountFieldDisabled, isScreenFocused]);

const showCurrencyPicker = () => {
setIsCurrencyPickerVisible(true);
Expand Down
3 changes: 0 additions & 3 deletions src/components/MoneyRequestConfirmationList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ type MoneyRequestConfirmationListProps = {
/** Opens the participant picker owned by the page. */
onOpenParticipantPicker: () => void;

/** Whether the page participant picker is open. */
isParticipantPickerVisible?: boolean;

/** The payment method the SettlementButton chose. */
onSendMoney?: (paymentMethod: PaymentMethodType | undefined) => void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ type VisibilityFlags = {
shouldShowCategories: boolean;
shouldShowTax: boolean;

/** Whether the parent-owned participant picker modal is currently open (new manual expense flow). Drives amount autofocus on picker close. */
isParticipantPickerVisible?: boolean;

/**
* Whether the list renders a participant section ("To" / "Paid by") above the footer. The manual form draws a
* divider under it so the workspace row reads as its own section rather than as the first expense detail.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ type ManualDetailsFieldsProps = {

/** Error state */
errorState: ErrorState;

/** Whether the parent-owned participant picker modal is currently open (new manual expense flow) */
isParticipantPickerVisible?: boolean;
};

/**
* The expense-type-driven fields for a manual, scanned or invoice confirmation: Amount, Merchant and Description.
*/
function ManualDetailsFields({policy, amountDisplay, requiredFlags, errorState, isParticipantPickerVisible = false}: ManualDetailsFieldsProps) {
function ManualDetailsFields({policy, amountDisplay, requiredFlags, errorState}: ManualDetailsFieldsProps) {
const {fieldVisibility, isCompactMode, iouCurrencyCode} = useDetailsFields();

return (
Expand All @@ -43,7 +40,6 @@ function ManualDetailsFields({policy, amountDisplay, requiredFlags, errorState,
isDistanceRequest={false}
shouldShowTimeRequestFields={false}
policy={policy}
isParticipantPickerVisible={isParticipantPickerVisible}
{...errorState}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function InvoiceFooter({policy, policyTags, selectedParticipants, amountDisplay,
amountDisplay={amountDisplay}
requiredFlags={requiredFlags}
errorState={errorState}
isParticipantPickerVisible={visibilityFlags.isParticipantPickerVisible}
/>
</ConfirmationFieldList>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function ManualFooter({policy, policyTags, selectedParticipants, amountDisplay,
amountDisplay={amountDisplay}
requiredFlags={requiredFlags}
errorState={errorState}
isParticipantPickerVisible={visibilityFlags.isParticipantPickerVisible}
/>
</ConfirmationFieldList>
</ExpenseFormFooterLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ function ScanFooter({
amountDisplay={amountDisplay}
requiredFlags={requiredFlags}
errorState={errorState}
isParticipantPickerVisible={visibilityFlags.isParticipantPickerVisible}
/>
</ConfirmationFieldList>
</View>
Expand Down
76 changes: 0 additions & 76 deletions src/components/ParticipantPicker/BaseParticipantPicker.tsx

This file was deleted.

39 changes: 0 additions & 39 deletions src/components/ParticipantPicker/OverlayHost.tsx

This file was deleted.

50 changes: 0 additions & 50 deletions src/components/ParticipantPicker/index.ios.tsx

This file was deleted.

39 changes: 0 additions & 39 deletions src/components/ParticipantPicker/index.tsx

This file was deleted.

Loading
Loading