Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
fa74ef0
Bring overLimitForwardsTo configuration into New Expensify
abzokhattab Nov 25, 2025
b6cf974
cleaning up
abzokhattab Nov 25, 2025
b383474
refactoring
abzokhattab Nov 25, 2025
1fcfb7a
refactoring comments
abzokhattab Nov 25, 2025
be2c8ea
fixing eslint
abzokhattab Nov 25, 2025
caa2cd3
fixing other translations
abzokhattab Nov 25, 2025
6af9552
code refactoring
abzokhattab Nov 25, 2025
b8d5cbe
fixing some bugs and fix eslint errs
abzokhattab Nov 25, 2025
1721985
feat: Add approval limit editing support for workflow approvers
abzokhattab Dec 2, 2025
dfd89f8
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 2, 2025
60077c3
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 2, 2025
8ddb742
fixing eslint
abzokhattab Dec 2, 2025
00a9d4f
fixing tests
abzokhattab Dec 2, 2025
09f7b3e
fixing tests
abzokhattab Dec 2, 2025
4067eb2
revert podfile.lock
abzokhattab Dec 2, 2025
546e9fb
minor edit
abzokhattab Dec 2, 2025
f3eebde
code refactoring
abzokhattab Dec 2, 2025
3843aec
refactoring
abzokhattab Dec 2, 2025
0b454c3
code refactoring
abzokhattab Dec 2, 2025
cff931f
raising workflowsutils test coverage
abzokhattab Dec 2, 2025
1144b86
code refactoring
abzokhattab Dec 2, 2025
ad84c7b
fixing workflowApprovalLimitText bottom padding
abzokhattab Dec 2, 2025
0eb9343
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 3, 2025
9908852
refactor the approver limit page
abzokhattab Dec 3, 2025
1841e82
fixing goback naviagtion bug in approver page
abzokhattab Dec 3, 2025
195cd84
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 3, 2025
398e0ac
code refactoring
abzokhattab Dec 4, 2025
be5caaa
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 4, 2025
f634b5b
fixing goback in the approver page
abzokhattab Dec 4, 2025
e9fe538
resetting the limit and additional approver when the main approval is…
abzokhattab Dec 4, 2025
b5934d1
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 5, 2025
cc3ff22
making approvel description same as exisitng hittext
abzokhattab Dec 5, 2025
8ffd7e1
cleanup: revert circularRferenceError
abzokhattab Dec 5, 2025
354709e
fix navigation bugs
abzokhattab Dec 5, 2025
80a4a04
fixing eslint
abzokhattab Dec 5, 2025
550bb14
Replace useEffect with render-phase sync in NumberWithSymbolForm
abzokhattab Dec 6, 2025
1ca54ed
refactor: simplify approvals navigation and remove `backTo` usage
abzokhattab Dec 6, 2025
d439983
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 6, 2025
b636f8d
fixing eslint
abzokhattab Dec 6, 2025
356c8b2
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 8, 2025
ce7e410
NumberWithSymbolForm refactor
abzokhattab Dec 8, 2025
6806522
using useMemoizedLazyExpensifyIcons for icons
abzokhattab Dec 8, 2025
f8de83b
fixing eslint and icons refactoring
abzokhattab Dec 8, 2025
5d3e709
Allow skipping approval limit when both fields are empty
abzokhattab Dec 9, 2025
fee6666
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 9, 2025
7ac599c
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 9, 2025
7e71aa0
code refactoring
abzokhattab Dec 10, 2025
8c29485
refactor: states optimizations
abzokhattab Dec 13, 2025
ee27996
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 13, 2025
3af0865
Remove manual memoization for React Compiler compliance
abzokhattab Dec 13, 2025
3de91ed
minor edit
abzokhattab Dec 13, 2025
09e0230
fix: clear approval limit when additional approver is removed
abzokhattab Dec 13, 2025
09b32a5
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 14, 2025
26a6dc9
refactor: use Onyx state instead of backTo param for approval workflo…
abzokhattab Dec 14, 2025
d109bfe
Merge branch 'main' into add-overlimitforwardsto-approval-workflow
abzokhattab Dec 15, 2025
12399d9
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 16, 2025
c872aad
fixing pipeline
abzokhattab Dec 16, 2025
ce5b1be
fixing ts
abzokhattab Dec 16, 2025
b36fe09
enable submit on enter + fix nav issue when having one approval and u…
abzokhattab Dec 17, 2025
5eed61e
Merge remote-tracking branch 'origin/main' into add-overlimitforwards…
abzokhattab Dec 17, 2025
2eaadc3
fixing react complience pipeline
abzokhattab Dec 17, 2025
fdae2c6
fixing ts
abzokhattab Dec 17, 2025
903aff9
fixing enterApproverError msg
abzokhattab Dec 17, 2025
c3e9f40
fixing number change bug
abzokhattab Dec 18, 2025
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
20 changes: 14 additions & 6 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1709,15 +1709,23 @@ const ROUTES = {
},
WORKSPACE_WORKFLOWS_APPROVALS_EXPENSES_FROM: {
route: 'workspaces/:policyID/workflows/approvals/expenses-from',

// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/workflows/approvals/expenses-from` as const, backTo),
getRoute: (policyID: string) => `workspaces/${policyID}/workflows/approvals/expenses-from` as const,
},
WORKSPACE_WORKFLOWS_APPROVALS_APPROVER: {
route: 'workspaces/:policyID/workflows/approvals/approver',
getRoute: (policyID: string, approverIndex: number, backTo?: string) =>
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
getUrlWithBackToParam(`workspaces/${policyID}/workflows/approvals/approver?approverIndex=${approverIndex}` as const, backTo),
getRoute: (policyID: string, approverIndex: number) => `workspaces/${policyID}/workflows/approvals/approver?approverIndex=${approverIndex}` as const,
},
WORKSPACE_WORKFLOWS_APPROVALS_APPROVER_CHANGE: {
route: 'workspaces/:policyID/workflows/approvals/approver-change',
getRoute: (policyID: string, approverIndex: number) => `workspaces/${policyID}/workflows/approvals/approver-change?approverIndex=${approverIndex}` as const,
},
WORKSPACE_WORKFLOWS_APPROVALS_APPROVAL_LIMIT: {
route: 'workspaces/:policyID/workflows/approvals/approval-limit',
getRoute: (policyID: string, approverIndex: number) => `workspaces/${policyID}/workflows/approvals/approval-limit?approverIndex=${approverIndex}` as const,
},
WORKSPACE_WORKFLOWS_APPROVALS_OVER_LIMIT_APPROVER: {
route: 'workspaces/:policyID/workflows/approvals/over-limit-approver',
getRoute: (policyID: string, approverIndex: number) => `workspaces/${policyID}/workflows/approvals/over-limit-approver?approverIndex=${approverIndex}` as const,
},
WORKSPACE_WORKFLOWS_PAYER: {
route: 'workspaces/:policyID/workflows/payer',
Expand Down
3 changes: 3 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,9 @@ const SCREENS = {
WORKFLOWS_APPROVALS_EDIT: 'Workspace_Approvals_Edit',
WORKFLOWS_APPROVALS_EXPENSES_FROM: 'Workspace_Workflows_Approvals_Expenses_From',
WORKFLOWS_APPROVALS_APPROVER: 'Workspace_Workflows_Approvals_Approver',
WORKFLOWS_APPROVALS_APPROVER_CHANGE: 'Workspace_Workflows_Approvals_Approver_Change',
WORKFLOWS_APPROVALS_APPROVAL_LIMIT: 'Workspace_Workflows_Approvals_Approval_Limit',
WORKFLOWS_APPROVALS_OVER_LIMIT_APPROVER: 'Workspace_Workflows_Approvals_Over_Limit_Approver',
WORKFLOWS_AUTO_REPORTING_FREQUENCY: 'Workspace_Workflows_Auto_Reporting_Frequency',
WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET: 'Workspace_Workflows_Auto_Reporting_Monthly_Offset',
WORKFLOWS_CONNECT_EXISTING_BANK_ACCOUNT: 'Workspace_Workflows_Connect_Existing_Bank_Account',
Expand Down
10 changes: 10 additions & 0 deletions src/components/AmountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ type AmountFormProps = {
/** Whether to hide the currency symbol */
hideCurrencySymbol?: boolean;

/** Whether the input should be disabled */
disabled?: boolean;

/** Reference to the outer element */
ref?: ForwardedRef<BaseTextInputRef>;

/** Callback when the user presses the submit key (Enter) */
onSubmitEditing?: () => void;
} & Pick<BaseTextInputProps, 'autoFocus' | 'autoGrowExtraSpace' | 'autoGrowMarginSide'>;

/**
Expand All @@ -62,9 +68,11 @@ function AmountForm({
label,
decimals: decimalsProp,
hideCurrencySymbol = false,
disabled = false,
autoFocus,
autoGrowExtraSpace,
autoGrowMarginSide,
onSubmitEditing,
ref,
}: AmountFormProps) {
const styles = useThemeStyles();
Expand Down Expand Up @@ -99,6 +107,8 @@ function AmountForm({
autoFocus={autoFocus}
autoGrowExtraSpace={autoGrowExtraSpace}
autoGrowMarginSide={autoGrowMarginSide}
onSubmitEditing={onSubmitEditing}
disabled={disabled}
/>
);
}
Expand Down
39 changes: 23 additions & 16 deletions src/components/ApprovalWorkflowSection.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import {Str} from 'expensify-common';
import React, {useCallback, useMemo} from 'react';
import React from 'react';
import {View} from 'react-native';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {sortAlphabetically} from '@libs/OptionsListUtils';
import {getApprovalLimitDescription} from '@libs/WorkflowUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import {personalDetailsByEmailSelector} from '@src/selectors/PersonalDetails';
import type ApprovalWorkflow from '@src/types/onyx/ApprovalWorkflow';
import Icon from './Icon';
import MenuItem from './MenuItem';
Expand All @@ -19,30 +24,30 @@ type ApprovalWorkflowSectionProps = {

/** A function that is called when the section is pressed */
onPress: () => void;

/** Currency used for formatting approval limits */
currency?: string;
};

function ApprovalWorkflowSection({approvalWorkflow, onPress}: ApprovalWorkflowSectionProps) {
function ApprovalWorkflowSection({approvalWorkflow, onPress, currency = CONST.CURRENCY.USD}: ApprovalWorkflowSectionProps) {
const icons = useMemoizedLazyExpensifyIcons(['ArrowRight', 'Lightbulb', 'Users', 'UserCheck']);
const styles = useThemeStyles();
const theme = useTheme();
const {translate, toLocaleOrdinal, localeCompare} = useLocalize();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const [personalDetailsByEmail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
canBeMissing: true,
selector: personalDetailsByEmailSelector,
});

const approverTitle = useCallback(
(index: number) =>
approvalWorkflow.approvers.length > 1 ? `${toLocaleOrdinal(index + 1, true)} ${translate('workflowsPage.approver').toLowerCase()}` : `${translate('workflowsPage.approver')}`,
[approvalWorkflow.approvers.length, toLocaleOrdinal, translate],
);

const members = useMemo(() => {
if (approvalWorkflow.isDefault) {
return translate('workspace.common.everyone');
}
const approverTitle = (index: number) =>
approvalWorkflow.approvers.length > 1 ? `${toLocaleOrdinal(index + 1, true)} ${translate('workflowsPage.approver').toLowerCase()}` : `${translate('workflowsPage.approver')}`;

return sortAlphabetically(approvalWorkflow.members, 'displayName', localeCompare)
.map((m) => Str.removeSMSDomain(m.displayName))
.join(', ');
}, [approvalWorkflow.isDefault, approvalWorkflow.members, translate, localeCompare]);
const members = approvalWorkflow.isDefault
? translate('workspace.common.everyone')
: sortAlphabetically(approvalWorkflow.members, 'displayName', localeCompare)
.map((m) => Str.removeSMSDomain(m.displayName))
.join(', ');

return (
<PressableWithoutFeedback
Expand Down Expand Up @@ -100,6 +105,8 @@ function ApprovalWorkflowSection({approvalWorkflow, onPress}: ApprovalWorkflowSe
iconFill={theme.icon}
onPress={onPress}
shouldRemoveBackground
helperText={getApprovalLimitDescription({approver, currency, translate, personalDetailsByEmail})}
helperTextStyle={styles.workflowApprovalLimitText}
/>
</View>
))}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/chunks/expensify-icons.chunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ import Phone from '@assets/images/phone.svg';
import Pin from '@assets/images/pin.svg';
import Plane from '@assets/images/plane.svg';
import Play from '@assets/images/play.svg';
import PlusMinus from '@assets/images/plus-minus.svg';
import Plus from '@assets/images/plus.svg';
import Printer from '@assets/images/printer.svg';
import Profile from '@assets/images/profile.svg';
Expand Down Expand Up @@ -363,6 +364,7 @@ const Expensicons = {
Pin,
Play,
Plus,
PlusMinus,
Printer,
Profile,
QBOSquare,
Expand Down
130 changes: 71 additions & 59 deletions src/components/NumberWithSymbolForm.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {useIsFocused} from '@react-navigation/native';
import type {ForwardedRef} from 'react';
import React, {useCallback, useEffect, useImperativeHandle, useRef, useState} from 'react';
import React, {useEffect, useImperativeHandle, useRef, useState} from 'react';
import type {NativeSyntheticEvent} from 'react-native';
import {View} from 'react-native';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import {useMouseContext} from '@hooks/useMouseContext';
import usePrevious from '@hooks/usePrevious';
Expand All @@ -25,7 +26,6 @@
import BigNumberPad from './BigNumberPad';
import Button from './Button';
import FormHelpMessage from './FormHelpMessage';
import * as Expensicons from './Icon/Expensicons';
import ScrollView from './ScrollView';
import TextInput from './TextInput';
import isTextInputFocused from './TextInput/BaseTextInput/isTextInputFocused';
Expand Down Expand Up @@ -84,6 +84,9 @@

/** Reference to the outer element */
ref?: ForwardedRef<BaseTextInputRef>;

/** Callback when the user presses the submit key (Enter) */
onSubmitEditing?: () => void;
} & Omit<TextInputWithSymbolProps, 'formattedAmount' | 'onAmountChange' | 'placeholder' | 'onSelectionChange' | 'onKeyPress' | 'onMouseDown' | 'onMouseUp'>;

type NumberWithSymbolFormRef = {
Expand Down Expand Up @@ -145,15 +148,29 @@
clearNegative,
ref,
disabled,
onSubmitEditing,
...props
}: NumberWithSymbolFormProps) {
const styles = useThemeStyles();
const {toLocaleDigit, numberFormat, translate} = useLocalize();
const icons = useMemoizedLazyExpensifyIcons(['DownArrow', 'PlusMinus'] as const);

const textInput = useRef<BaseTextInputRef | null>(null);
const numberRef = useRef<string | undefined>(undefined);
const [currentNumber, setCurrentNumber] = useState(typeof number === 'string' ? number : '');

// sync currentNumber with number prop when it changes externally
useEffect(() => {
const newNumber = typeof number === 'string' ? number : '';

if (newNumber === currentNumber || (newNumber && currentNumber && Number(newNumber) === Number(currentNumber))) {
return;
}
Comment on lines +164 to +168
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any way to optimize this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mmmm will check but let me know if y have other suggestions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Overall i think it's doesnt cause a performance degradation so for me i believe its fine to proceed with that

Copy link
Copy Markdown
Contributor

@aimane-chnaif aimane-chnaif Dec 23, 2025

Choose a reason for hiding this comment

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

This effect still has issues. #78353 #78330

Extra 0 is added when change currency to VND

Screen.Recording.2025-12-23.at.12.14.37.pm.mov

Double negative

Screen.Recording.2025-12-23.at.12.22.17.pm.mov


setCurrentNumber(newNumber);
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [number]);

const [shouldUpdateSelection, setShouldUpdateSelection] = useState(true);

const isFocused = useIsFocused();
Expand All @@ -178,9 +195,9 @@
setMouseUp();
};

const clearSelection = useCallback(() => {
const clearSelection = () => {

Check warning on line 198 in src/components/NumberWithSymbolForm.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

The 'clearSelection' function makes the dependencies of useEffect Hook (at line 287) change on every render. To fix this, wrap the definition of 'clearSelection' in its own useCallback() Hook

Check warning on line 198 in src/components/NumberWithSymbolForm.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

The 'clearSelection' function makes the dependencies of useEffect Hook (at line 287) change on every render. To fix this, wrap the definition of 'clearSelection' in its own useCallback() Hook
setSelection({start: selection.end, end: selection.end});
}, [selection.end]);
};

/**
* Event occurs when a user presses a mouse button over an DOM element.
Expand All @@ -206,39 +223,36 @@
* Sets the selection and the number accordingly to the number passed to the input
* @param newNumber - Changed number from user input
*/
const setNewNumber = useCallback(
(newNumber: string) => {
// Remove spaces from the newNumber number because Safari on iOS adds spaces when pasting a copied number
// More info: https://github.com/Expensify/App/issues/16974
const newNumberWithoutSpaces = stripSpacesFromAmount(newNumber);
const rawFinalNumber = newNumberWithoutSpaces.includes('.') ? stripCommaFromAmount(newNumberWithoutSpaces) : replaceCommasWithPeriod(newNumberWithoutSpaces);

const finalNumber = handleNegativeAmountFlipping(rawFinalNumber, allowFlippingAmount, toggleNegative);

// Use a shallow copy of selection to trigger setSelection
// More info: https://github.com/Expensify/App/issues/16385
if (!validateAmount(finalNumber, decimals, maxLength)) {
setSelection((prevSelection) => ({...prevSelection}));
return;
}
const setNewNumber = (newNumber: string) => {
// Remove spaces from the newNumber number because Safari on iOS adds spaces when pasting a copied number
// More info: https://github.com/Expensify/App/issues/16974
const newNumberWithoutSpaces = stripSpacesFromAmount(newNumber);
const rawFinalNumber = newNumberWithoutSpaces.includes('.') ? stripCommaFromAmount(newNumberWithoutSpaces) : replaceCommasWithPeriod(newNumberWithoutSpaces);

willSelectionBeUpdatedManually.current = true;
let hasSelectionBeenSet = false;
const strippedNumber = stripCommaFromAmount(finalNumber);
numberRef.current = strippedNumber;
setCurrentNumber((prevNumber) => {
const isForwardDelete = prevNumber.length > strippedNumber.length && forwardDeletePressedRef.current;
if (!hasSelectionBeenSet) {
hasSelectionBeenSet = true;
setSelection((prevSelection) => getNewSelection(prevSelection, isForwardDelete ? strippedNumber.length : prevNumber.length, strippedNumber.length));
willSelectionBeUpdatedManually.current = false;
}
return strippedNumber;
});
onInputChange?.(strippedNumber);
},
[decimals, maxLength, onInputChange, allowFlippingAmount, toggleNegative],
);
const finalNumber = handleNegativeAmountFlipping(rawFinalNumber, allowFlippingAmount, toggleNegative);

// Use a shallow copy of selection to trigger setSelection
// More info: https://github.com/Expensify/App/issues/16385
if (!validateAmount(finalNumber, decimals, maxLength)) {
setSelection((prevSelection) => ({...prevSelection}));
return;
}

willSelectionBeUpdatedManually.current = true;
let hasSelectionBeenSet = false;
const strippedNumber = stripCommaFromAmount(finalNumber);
numberRef.current = strippedNumber;
setCurrentNumber((prevNumber) => {
const isForwardDelete = prevNumber.length > strippedNumber.length && forwardDeletePressedRef.current;
if (!hasSelectionBeenSet) {
hasSelectionBeenSet = true;
setSelection((prevSelection) => getNewSelection(prevSelection, isForwardDelete ? strippedNumber.length : prevNumber.length, strippedNumber.length));
willSelectionBeUpdatedManually.current = false;
}
return strippedNumber;
});
onInputChange?.(strippedNumber);
};

/**
* Set a new number number properly formatted, used for the TextInput
Expand Down Expand Up @@ -290,37 +304,34 @@
* Update number with number or Backspace pressed for BigNumberPad.
* Validate new number with decimal number regex up to 6 digits and 2 decimal digit to enable Next button
*/
const updateValueNumberPad = useCallback(
(key: string) => {
if (shouldUpdateSelection && !isTextInputFocused(textInput)) {
textInput.current?.focus();
}
// Backspace button is pressed
if (key === '<' || key === 'Backspace') {
if (currentNumber.length > 0) {
const selectionStart = selection.start === selection.end ? selection.start - 1 : selection.start;
const newNumber = `${currentNumber.substring(0, selectionStart)}${currentNumber.substring(selection.end)}`;
setNewNumber(addLeadingZero(newNumber));
}
return;
const updateValueNumberPad = (key: string) => {
if (shouldUpdateSelection && !isTextInputFocused(textInput)) {
textInput.current?.focus();
}
// Backspace button is pressed
if (key === '<' || key === 'Backspace') {
if (currentNumber.length > 0) {
const selectionStart = selection.start === selection.end ? selection.start - 1 : selection.start;
const newNumber = `${currentNumber.substring(0, selectionStart)}${currentNumber.substring(selection.end)}`;
setNewNumber(addLeadingZero(newNumber));
}
const newNumber = addLeadingZero(`${currentNumber.substring(0, selection.start)}${key}${currentNumber.substring(selection.end)}`);
setNewNumber(newNumber);
},
[currentNumber, selection.start, selection.end, shouldUpdateSelection, setNewNumber],
);
return;
}
const newNumber = addLeadingZero(`${currentNumber.substring(0, selection.start)}${key}${currentNumber.substring(selection.end)}`);
setNewNumber(newNumber);
};

/**
* Update long press number, to remove items pressing on <
*
* @param value - Changed text from user input
*/
const updateLongPressHandlerState = useCallback((value: boolean) => {
const updateLongPressHandlerState = (value: boolean) => {
setShouldUpdateSelection(!value);
if (!value && !isTextInputFocused(textInput)) {
textInput.current?.focus();
}
}, []);
};

/**
* Input handler to check for a forward-delete key (or keyboard shortcut) press.
Expand Down Expand Up @@ -386,6 +397,7 @@
autoFocus={props.autoFocus}
autoGrowExtraSpace={props.autoGrowExtraSpace}
autoGrowMarginSide={props.autoGrowMarginSide}
onSubmitEditing={onSubmitEditing}
/>
);
}
Expand Down Expand Up @@ -472,7 +484,7 @@
<Button
shouldShowRightIcon
small
iconRight={Expensicons.DownArrow}
iconRight={icons.DownArrow}
onPress={onSymbolButtonPress}
style={styles.minWidth18}
isContentCentered
Expand All @@ -497,7 +509,7 @@
<Button
shouldShowRightIcon
small
iconRight={Expensicons.DownArrow}
iconRight={icons.DownArrow}
onPress={onSymbolButtonPress}
style={styles.minWidth18}
isContentCentered
Expand All @@ -508,7 +520,7 @@
<Button
shouldShowRightIcon
small
iconRight={Expensicons.PlusMinus}
iconRight={icons.PlusMinus}
onPress={toggleNegative}
style={styles.minWidth18}
isContentCentered
Expand Down
Loading
Loading