Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD] Implement Uneven Splits #40386

Merged
merged 118 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
d99170a
Add TS definitions
youssef-lr Apr 15, 2024
99efbb6
Set split shares when first creating the split
youssef-lr Apr 15, 2024
cf65044
Add IOU functions to set split shares and adjust them
youssef-lr Apr 16, 2024
97ac991
Allow configuring split amounts
youssef-lr Apr 17, 2024
4bc7142
Use temporary amount input
youssef-lr Apr 17, 2024
e9cc173
Pass custom styles
youssef-lr Apr 17, 2024
b24ff87
Temporary updates to the amount input
youssef-lr Apr 18, 2024
6afe0e5
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 18, 2024
9e53204
Allow setting individual shares
youssef-lr Apr 18, 2024
00db6ff
Show a form error if sum of shares don't match total
youssef-lr Apr 18, 2024
23d8693
Prevent submitting form if total doesn't match
youssef-lr Apr 18, 2024
cc3de14
Adjust shares automatically
youssef-lr Apr 18, 2024
d98103f
Revert changes
youssef-lr Apr 18, 2024
14c9ead
Use temporary input
youssef-lr Apr 18, 2024
f032df0
Show even splits for workspace chat splits
youssef-lr Apr 18, 2024
3d2e12e
Send uneven splits to backend
youssef-lr Apr 18, 2024
eb5c8f1
Save splits array in the transaction optimistically
youssef-lr Apr 18, 2024
39fa362
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 19, 2024
2001821
Copy changes to MoneyRequestConfirmationList
youssef-lr Apr 19, 2024
f8116b3
Allow excluding group chat users from splits by setting amount to 0
youssef-lr Apr 19, 2024
756d11a
Reset split shares when amount changes
youssef-lr Apr 20, 2024
1cd5bd1
Display read only shares in splti details page
youssef-lr Apr 20, 2024
2cb1d95
Show split share in split preview card
youssef-lr Apr 20, 2024
959d6d0
Allow easy tab navigation for inputs
youssef-lr Apr 20, 2024
e75e56f
Refactoring and TS fixes
youssef-lr Apr 20, 2024
7baa777
wip: Reset button
youssef-lr Apr 20, 2024
6712733
Allow resetting the amounts
youssef-lr Apr 20, 2024
327624e
Bug fix
youssef-lr Apr 21, 2024
e915d7c
Debounce form error in splits page
youssef-lr Apr 22, 2024
845d1a6
Bug fix
youssef-lr Apr 22, 2024
6d5762f
Lint
youssef-lr Apr 22, 2024
5c1758e
Hide inputs for Smartscan splits
youssef-lr Apr 22, 2024
1579091
Fix currency not shown in split amounts in details page
youssef-lr Apr 23, 2024
bca161b
Bug fix
youssef-lr Apr 23, 2024
f5b0c10
Filter out participants with shares equal to 0
youssef-lr Apr 23, 2024
db455e5
Prevent creating a split containing a single participant
youssef-lr Apr 23, 2024
cbe5d36
Prevent submitting form if there's an error
youssef-lr Apr 23, 2024
5dd0aed
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 23, 2024
66c367d
Lint
youssef-lr Apr 23, 2024
dc7f13d
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 23, 2024
a22f42d
Add margin next to participant emails
youssef-lr Apr 23, 2024
57610d7
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 25, 2024
ec56107
Always show confirmation for uneven splits
youssef-lr Apr 25, 2024
6cd30c2
Fix input style
youssef-lr Apr 25, 2024
4e71237
Clean up code for section button
youssef-lr Apr 25, 2024
076d99a
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 25, 2024
e064698
TS lint
youssef-lr Apr 25, 2024
e7ff3dc
More lint
youssef-lr Apr 25, 2024
8f33768
Skip confirmation screen for smartscanned splits
youssef-lr Apr 25, 2024
d5da181
Remove workaround for removing participants
youssef-lr Apr 25, 2024
7eba6d0
Bring back effect
youssef-lr Apr 25, 2024
23e41fe
Lint
youssef-lr Apr 25, 2024
061fcf1
Don't run unneeded logic unless we have modified shares
youssef-lr Apr 25, 2024
946d75f
Translation
youssef-lr Apr 25, 2024
6590eb4
TS
youssef-lr Apr 25, 2024
ed6f2e3
More TS
youssef-lr Apr 25, 2024
624bad4
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 25, 2024
af91070
TS and comment imporvement
youssef-lr Apr 25, 2024
2d0d0ba
Remove unintended changes
youssef-lr Apr 25, 2024
17c172b
One last TS fix
youssef-lr Apr 25, 2024
64a8525
Remove unintended change
youssef-lr Apr 26, 2024
58da039
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 26, 2024
d49ab6d
Cleanup
youssef-lr Apr 26, 2024
d0ce531
Cleanup
youssef-lr Apr 26, 2024
4df0953
Header new copy
youssef-lr Apr 26, 2024
dd6005f
Add comment
youssef-lr Apr 26, 2024
e46a6ce
Show current user's share in the split preview
youssef-lr Apr 26, 2024
1599a86
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 26, 2024
0daec60
Fix form error disappearing
youssef-lr Apr 26, 2024
9a74508
Fix merchant error missing when completing a split bill
youssef-lr Apr 26, 2024
9dee700
Cleanup
youssef-lr Apr 26, 2024
742e4e3
Rename variable
youssef-lr Apr 26, 2024
44ad9e1
Clean up code
youssef-lr Apr 26, 2024
f3db250
Fix selection always moving to the end
youssef-lr Apr 26, 2024
f2b7bf6
Proper fix for selection moving when amount changes
youssef-lr Apr 28, 2024
7afaca5
Add comment
youssef-lr Apr 28, 2024
5c594aa
Clarify comment
youssef-lr Apr 28, 2024
fbad80a
Copy update
youssef-lr Apr 28, 2024
4deb9ec
Clean up code
youssef-lr Apr 28, 2024
14d5775
Format amounts
youssef-lr Apr 28, 2024
09cde3c
Cleanup
youssef-lr Apr 28, 2024
51041d8
Fix keyboard disabled on native
youssef-lr Apr 29, 2024
d00fb89
Update MoneyRequestAmountInput.tsx
youssef-lr Apr 29, 2024
cea2cf8
Rename callback
youssef-lr Apr 29, 2024
4431b47
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 29, 2024
dc97bfd
Bug fix
youssef-lr Apr 29, 2024
4b64601
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr Apr 30, 2024
3ac8cb3
TS fix
youssef-lr Apr 30, 2024
9641c4d
Fix input flickering
youssef-lr May 1, 2024
dbe50b9
Bug fixes and add logic to native
youssef-lr May 1, 2024
ce825c9
Style
youssef-lr May 1, 2024
b3c6539
Add autoGrowDirection
youssef-lr May 1, 2024
eb81dff
Cleanup
youssef-lr May 1, 2024
36c5e35
Add a missing change to native
youssef-lr May 1, 2024
fc3768b
Cleanup
youssef-lr May 1, 2024
c2303f0
TS
youssef-lr May 1, 2024
516f2de
Bug fix
youssef-lr May 1, 2024
9657b24
Show dot in numeric keyboard
youssef-lr May 1, 2024
1061dfd
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr May 1, 2024
0397b60
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr May 2, 2024
37deba6
Add accessibility hit slope
youssef-lr May 3, 2024
626ecda
Revert implementation of autgrow with direction to the left
youssef-lr May 3, 2024
7305b68
Revert unintended changes
youssef-lr May 3, 2024
f745d48
Don't format amount when text input is focused
youssef-lr May 3, 2024
c4bc1fd
Don't break other existing amount inputs
youssef-lr May 3, 2024
188e7a2
Remove unneeded prop
youssef-lr May 3, 2024
1332a1c
Remove unused param
youssef-lr May 3, 2024
0d04ae4
Update styles and right-align input
youssef-lr May 3, 2024
ceb81ed
Adjust padding based on prefix length relating to uppercase letters
youssef-lr May 3, 2024
ca87ee5
Replace comma input with period for native keyboards that show a comma
youssef-lr May 3, 2024
c397762
Calculate exact width of the input based on total amount length
youssef-lr May 6, 2024
8af33a4
Add callback removed by mistake
youssef-lr May 6, 2024
672e3ec
Allow editing formatted amount
youssef-lr May 6, 2024
2b296bb
Use fixed width for inputs and max length
youssef-lr May 6, 2024
2056fb0
Don't format amount on blur if it exceeds max length
youssef-lr May 6, 2024
d5ce4cf
Reset selection on blur on mobile
youssef-lr May 6, 2024
209cac2
Merge branch 'main' into youssef_uneven_splits_2
youssef-lr May 6, 2024
c9021df
Fix paidBy section being sticky
youssef-lr May 7, 2024
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
18 changes: 15 additions & 3 deletions src/components/AmountTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ type AmountTextInputProps = {
} & Pick<BaseTextInputProps, 'autoFocus'>;

function AmountTextInput(
{formattedAmount, onChangeAmount, placeholder, selection, onSelectionChange, style, touchableInputWrapperStyle, onKeyPress, ...rest}: AmountTextInputProps,
{
formattedAmount,
onChangeAmount,
placeholder,
selection,
onSelectionChange,
style,
touchableInputWrapperStyle = null,
inputStyle = null,
textInputContainerStyles,
onKeyPress,
...rest
}: AmountTextInputProps,
ref: ForwardedRef<BaseTextInputRef>,
) {
const styles = useThemeStyles();
Expand All @@ -44,8 +56,8 @@ function AmountTextInput(
autoGrow
hideFocusedState
shouldInterceptSwipe
inputStyle={[styles.iouAmountTextInput, styles.p0, styles.noLeftBorderRadius, styles.noRightBorderRadius, style]}
textInputContainerStyles={[styles.borderNone, styles.noLeftBorderRadius, styles.noRightBorderRadius]}
inputStyle={inputStyle ?? [styles.iouAmountTextInput, styles.p0, styles.noLeftBorderRadius, styles.noRightBorderRadius, style]}
textInputContainerStyles={textInputContainerStyles ?? [styles.borderNone, styles.noLeftBorderRadius, styles.noRightBorderRadius]}
onChangeText={onChangeAmount}
ref={ref}
value={formattedAmount}
Expand Down
206 changes: 206 additions & 0 deletions src/components/MoneyRequestAmountInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import React, {useCallback, useEffect, useRef, useState} from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I copied and pasted code from MoneyRequestAmountForm, we're working on making the underlying amount input reusable here #40382

import type {ForwardedRef} from 'react';
import type {NativeSyntheticEvent, TextInputSelectionChangeEventData} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import * as Browser from '@libs/Browser';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import getOperatingSystem from '@libs/getOperatingSystem';
import type {MaybePhraseKey} from '@libs/Localize';
import * as MoneyRequestUtils from '@libs/MoneyRequestUtils';
import CONST from '@src/CONST';
import type {SelectedTabRequest} from '@src/types/onyx';
import type {BaseTextInputRef} from './TextInput/BaseTextInput/types';
import TextInputWithCurrencySymbol from './TextInputWithCurrencySymbol';

type MoneyRequestAmountFormProps = {
/** IOU amount saved in Onyx */
amount?: number;

/** Currency chosen by user or saved in Onyx */
currency?: string;

/** Whether the currency symbol is pressable */
isCurrencyPressable?: boolean;

hideCurrencySymbol?: boolean;

prefixCharacter?: string;

/** Fired when back button pressed, navigates to currency selection page */
onCurrencyButtonPress?: () => void;

/** The current tab we have navigated to in the request modal. String that corresponds to the request type. */
selectedTab?: SelectedTabRequest;
};

type Selection = {
start: number;
end: number;
};

/**
* Returns the new selection object based on the updated amount's length
*/
const getNewSelection = (oldSelection: Selection, prevLength: number, newLength: number): Selection => {
const cursorPosition = oldSelection.end + (newLength - prevLength);
return {start: cursorPosition, end: cursorPosition};
};

function MoneyRequestAmountTextInput(
{
amount = 0,
currency = CONST.CURRENCY.USD,
isCurrencyPressable = true,
onCurrencyButtonPress,
prefixCharacter,
hideCurrencySymbol,
inputStyle = null,
textInputContainerStyles = null,
selectedTab = CONST.TAB_REQUEST.MANUAL,
}: MoneyRequestAmountFormProps,
forwardedRef: ForwardedRef<BaseTextInputRef>,
) {
const {toLocaleDigit, numberFormat} = useLocalize();
const textInput = useRef<BaseTextInputRef | null>(null);

const decimals = CurrencyUtils.getCurrencyDecimals(currency);
const selectedAmountAsString = amount ? CurrencyUtils.convertToFrontendAmount(amount).toString() : '';

const [currentAmount, setCurrentAmount] = useState(selectedAmountAsString);
const [formError, setFormError] = useState<MaybePhraseKey>('');

const [selection, setSelection] = useState({
start: selectedAmountAsString.length,
end: selectedAmountAsString.length,
});

const forwardDeletePressedRef = useRef(false);

const initializeAmount = useCallback((newAmount: number) => {
const frontendAmount = newAmount ? CurrencyUtils.convertToFrontendAmount(newAmount).toString() : '';
setCurrentAmount(frontendAmount);
setSelection({
start: frontendAmount.length,
end: frontendAmount.length,
});
}, []);

useEffect(() => {
if (!currency || typeof amount !== 'number') {
return;
}
initializeAmount(amount);
// we want to re-initialize the state only when the amount changes
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [amount]);

/**
* Sets the selection and the amount accordingly to the value passed to the input
* @param {String} newAmount - Changed amount from user input
*/
const setNewAmount = useCallback(
(newAmount: string) => {
// Remove spaces from the newAmount value because Safari on iOS adds spaces when pasting a copied value
// More info: https://github.com/Expensify/App/issues/16974
const newAmountWithoutSpaces = MoneyRequestUtils.stripSpacesFromAmount(newAmount);
// Use a shallow copy of selection to trigger setSelection
// More info: https://github.com/Expensify/App/issues/16385
if (!MoneyRequestUtils.validateAmount(newAmountWithoutSpaces, decimals)) {
setSelection((prevSelection) => ({...prevSelection}));
return;
}
if (formError) {
setFormError('');
}

// setCurrentAmount contains another setState(setSelection) making it error-prone since it is leading to setSelection being called twice for a single setCurrentAmount call. This solution introducing the hasSelectionBeenSet flag was chosen for its simplicity and lower risk of future errors https://github.com/Expensify/App/issues/23300#issuecomment-1766314724.

let hasSelectionBeenSet = false;
setCurrentAmount((prevAmount) => {
const strippedAmount = MoneyRequestUtils.stripCommaFromAmount(newAmountWithoutSpaces);
const isForwardDelete = prevAmount.length > strippedAmount.length && forwardDeletePressedRef.current;
if (!hasSelectionBeenSet) {
hasSelectionBeenSet = true;
setSelection((prevSelection) => getNewSelection(prevSelection, isForwardDelete ? strippedAmount.length : prevAmount.length, strippedAmount.length));
}
return strippedAmount;
});
},
[decimals, formError],
);

useEffect(() => {});

// Modifies the amount to match the decimals for changed currency.
useEffect(() => {
// If the changed currency supports decimals, we can return
if (MoneyRequestUtils.validateAmount(currentAmount, decimals)) {
return;
}

// If the changed currency doesn't support decimals, we can strip the decimals
setNewAmount(MoneyRequestUtils.stripDecimalsFromAmount(currentAmount));

// we want to update only when decimals change (setNewAmount also changes when decimals change).
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [setNewAmount]);

/**
* Input handler to check for a forward-delete key (or keyboard shortcut) press.
*/
const textInputKeyPress = ({nativeEvent}: NativeSyntheticEvent<KeyboardEvent>) => {
const key = nativeEvent?.key.toLowerCase();
if (Browser.isMobileSafari() && key === CONST.PLATFORM_SPECIFIC_KEYS.CTRL.DEFAULT) {
// Optimistically anticipate forward-delete on iOS Safari (in cases where the Mac Accessiblity keyboard is being
// used for input). If the Control-D shortcut doesn't get sent, the ref will still be reset on the next key press.
forwardDeletePressedRef.current = true;
return;
}
// Control-D on Mac is a keyboard shortcut for forward-delete. See https://support.apple.com/en-us/HT201236 for Mac keyboard shortcuts.
// Also check for the keyboard shortcut on iOS in cases where a hardware keyboard may be connected to the device.
const operatingSystem = getOperatingSystem();
forwardDeletePressedRef.current = key === 'delete' || ((operatingSystem === CONST.OS.MAC_OS || operatingSystem === CONST.OS.IOS) && nativeEvent?.ctrlKey && key === 'd');
};

const formattedAmount = MoneyRequestUtils.replaceAllDigits(currentAmount, toLocaleDigit);

useEffect(() => {
setFormError('');
}, [selectedTab]);

return (
<TextInputWithCurrencySymbol
formattedAmount={formattedAmount}
onChangeAmount={setNewAmount}
onCurrencyButtonPress={onCurrencyButtonPress}
placeholder={numberFormat(0)}
ref={(ref) => {
if (typeof forwardedRef === 'function') {
forwardedRef(ref);
} else if (forwardedRef?.current) {
// eslint-disable-next-line no-param-reassign
forwardedRef.current = ref;
}
textInput.current = ref;
}}
selectedCurrencyCode={currency}
selection={selection}
onSelectionChange={(e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => {
const maxSelection = formattedAmount.length;
const start = Math.min(e.nativeEvent.selection.start, maxSelection);
const end = Math.min(e.nativeEvent.selection.end, maxSelection);
setSelection({start, end});
}}
onKeyPress={textInputKeyPress}
isCurrencyPressable={isCurrencyPressable}
hideCurrencySymbol={hideCurrencySymbol}
prefixCharacter={prefixCharacter}
inputStyle={inputStyle}
textInputContainerStyles={textInputContainerStyles}
/>
);
}

MoneyRequestAmountTextInput.displayName = 'MoneyRequestAmountTextInput';

export default React.forwardRef(MoneyRequestAmountTextInput);
90 changes: 26 additions & 64 deletions src/components/MoneyTemporaryForRefactorRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useIsFocused} from '@react-navigation/native';
import {format} from 'date-fns';
import Str from 'expensify-common/lib/str';
import React, {useCallback, useEffect, useMemo, useReducer, useRef, useState} from 'react';
import React, {useCallback, useEffect, useMemo, useReducer, useState} from 'react';
import {View} from 'react-native';
import type {StyleProp, ViewStyle} from 'react-native';
import {withOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -190,7 +190,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
hasMultipleParticipants,
selectedParticipants: pickedParticipants,
payeePersonalDetails,
canModifyParticipants = false,
currencyList,
session,
isReadOnly = false,
bankAccountRoute = '',
Expand Down Expand Up @@ -339,17 +339,6 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
IOU.setMoneyRequestTaxAmount(transaction?.transactionID ?? '', amountInSmallestCurrencyUnits, true);
}, [taxRates?.defaultValue, transaction, previousTransactionAmount]);

/**
* Returns the participants with amount
*/
const getParticipantsWithAmount = useCallback(
(participantsList: Participant[]) => {
const amount = IOUUtils.calculateAmount(participantsList.length, iouAmount, iouCurrencyCode ?? '');
return OptionsListUtils.getIOUConfirmationOptionsFromParticipants(participantsList, amount > 0 ? CurrencyUtils.convertToDisplayString(amount, iouCurrencyCode) : '');
},
[iouAmount, iouCurrencyCode],
);

// If completing a split bill fails, set didConfirm to false to allow the user to edit the fields again
if (isEditingSplitBill && didConfirm) {
setDidConfirm(false);
Expand Down Expand Up @@ -380,45 +369,32 @@ function MoneyTemporaryForRefactorRequestConfirmationList({

const selectedParticipants = useMemo(() => pickedParticipants.filter((participant) => participant.selected), [pickedParticipants]);
const personalDetailsOfPayee = useMemo(() => payeePersonalDetails ?? currentUserPersonalDetails, [payeePersonalDetails, currentUserPersonalDetails]);
const userCanModifyParticipants = useRef(!isReadOnly && canModifyParticipants && hasMultipleParticipants);
useEffect(() => {
userCanModifyParticipants.current = !isReadOnly && canModifyParticipants && hasMultipleParticipants;
}, [isReadOnly, canModifyParticipants, hasMultipleParticipants]);
const shouldDisablePaidBySection = userCanModifyParticipants.current;

const optionSelectorSections = useMemo(() => {
const sections = [];
const unselectedParticipants = pickedParticipants.filter((participant) => !participant.selected);
if (hasMultipleParticipants) {
const formattedSelectedParticipants = getParticipantsWithAmount(selectedParticipants);
let formattedParticipantsList = [...new Set([...formattedSelectedParticipants, ...unselectedParticipants])];

if (!canModifyParticipants) {
formattedParticipantsList = formattedParticipantsList.map((participant) => ({
...participant,
isDisabled: ReportUtils.isOptimisticPersonalDetail(participant.accountID ?? -1),
}));
}

const myIOUAmount = IOUUtils.calculateAmount(selectedParticipants.length, iouAmount, iouCurrencyCode ?? '', true);
const formattedPayeeOption = OptionsListUtils.getIOUConfirmationOptionsFromPayeePersonalDetail(
personalDetailsOfPayee,
iouAmount > 0 ? CurrencyUtils.convertToDisplayString(myIOUAmount, iouCurrencyCode) : '',
);

sections.push(
{
title: translate('moneyRequestConfirmationList.paidBy'),
data: [formattedPayeeOption],
shouldShow: true,
isDisabled: shouldDisablePaidBySection,
},
{
title: translate('moneyRequestConfirmationList.splitWith'),
data: formattedParticipantsList,
shouldShow: true,
const payeeOption = OptionsListUtils.getIOUConfirmationOptionsFromPayeePersonalDetail(personalDetailsOfPayee);
const formattedParticipantsList = [payeeOption, ...selectedParticipants].map((participantOption) => ({
...participantOption,
descriptiveText: null,
amountProps: {
amount: transaction?.splitShares?.[participantOption.accountID]?.amount,
currency: iouCurrencyCode,
prefixCharacter: currencyList?.[iouCurrencyCode]?.symbol ?? iouCurrencyCode,
isCurrencyPressable: false,
hideCurrencySymbol: true,
inputStyle: [{width: 100}],
textInputContainerStyles: [],
prefixStyle: [{paddingTop: 0, paddingBottom: 0}],
onAmountChange: (value) => {},
},
);
}));

sections.push({
title: translate('moneyRequestConfirmationList.splitWith'),
data: formattedParticipantsList,
shouldShow: true,
});
} else {
const formattedSelectedParticipants = selectedParticipants.map((participant) => ({
...participant,
Expand All @@ -431,18 +407,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
});
}
return sections;
}, [
selectedParticipants,
pickedParticipants,
hasMultipleParticipants,
iouAmount,
iouCurrencyCode,
getParticipantsWithAmount,
personalDetailsOfPayee,
translate,
shouldDisablePaidBySection,
canModifyParticipants,
]);
}, [transaction?.splitShares, currencyList, selectedParticipants, hasMultipleParticipants, iouCurrencyCode, personalDetailsOfPayee, translate]);

const selectedOptions = useMemo(() => {
if (!hasMultipleParticipants) {
Expand Down Expand Up @@ -957,18 +922,14 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
// @ts-expect-error This component is deprecated and will not be migrated to TypeScript (context: https://expensify.slack.com/archives/C01GTK53T8Q/p1709232289899589?thread_ts=1709156803.359359&cid=C01GTK53T8Q)
<OptionsSelector
sections={optionSelectorSections}
onSelectRow={userCanModifyParticipants.current ? selectParticipant : navigateToReportOrUserDetail}
onSelectRow={navigateToReportOrUserDetail}
onAddToSelection={selectParticipant}
onConfirmSelection={confirm}
selectedOptions={selectedOptions}
canSelectMultipleOptions={userCanModifyParticipants.current}
disableArrowKeysActions={!userCanModifyParticipants.current}
boldStyle
showTitleTooltip
shouldTextInputAppearBelowOptions
shouldShowTextInput={false}
shouldUseStyleForChildren={false}
optionHoveredStyle={userCanModifyParticipants.current ? styles.hoveredComponentBG : {}}
footerContent={!isEditingSplitBill && footerContent}
listStyles={listStyles}
shouldAllowScrollingChildren
Expand Down Expand Up @@ -1050,4 +1011,5 @@ export default withOnyx<MoneyRequestConfirmationListProps, MoneyRequestConfirmat
policy: {
key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
},
currencyList: {key: ONYXKEYS.CURRENCY_LIST},
})(MoneyTemporaryForRefactorRequestConfirmationList);
Loading
Loading