Skip to content

Fix/ Zeros are added to currency that does not support decimal #43816

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

4 changes: 2 additions & 2 deletions src/components/MoneyRequestAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type MoneyRequestAmountInputProps = {
amount?: number;

/** A callback to format the amount number */
onFormatAmount?: (amount: number, currency?: string) => string;
onFormatAmount?: (amount: number, currency: string) => string;

/** Currency chosen by user or saved in Onyx */
currency?: string;
Expand Down Expand Up @@ -106,7 +106,7 @@ const getNewSelection = (oldSelection: Selection, prevLength: number, newLength:
return {start: cursorPosition, end: cursorPosition};
};

const defaultOnFormatAmount = (amount: number, currency?: string) => CurrencyUtils.convertToFrontendAmountAsString(amount, currency ?? CONST.CURRENCY.USD);
const defaultOnFormatAmount = (amount: number, currency: string) => CurrencyUtils.convertToFrontendAmountAsString(amount, currency ?? CONST.CURRENCY.USD);

function MoneyRequestAmountInput(
{
Expand Down
5 changes: 4 additions & 1 deletion src/pages/iou/request/IOURequestStartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ function IOURequestStartPage({
{shouldDisplayDistanceRequest && <TopTab.Screen name={CONST.TAB_REQUEST.DISTANCE}>{() => <IOURequestStepDistance route={route} />}</TopTab.Screen>}
</OnyxTabNavigator>
) : (
<IOURequestStepAmount route={route} />
<IOURequestStepAmount
route={route}
shouldKeepUserInput
/>
)}
</View>
</DragAndDropProvider>
Expand Down
Loading