-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for negative amounts in BaseTextInputWithCurrencySymbol
- Loading branch information
1 parent
588d50c
commit 278761a
Showing
2 changed files
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import AmountTextInput from '@components/AmountTextInput'; | |
import CurrencySymbolButton from '@components/CurrencySymbolButton'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import Text from '@src/components/Text'; | ||
Check failure on line 7 in src/components/TextInputWithCurrencySymbol/BaseTextInputWithCurrencySymbol.tsx
|
||
import * as CurrencyUtils from '@libs/CurrencyUtils'; | ||
Check failure on line 8 in src/components/TextInputWithCurrencySymbol/BaseTextInputWithCurrencySymbol.tsx
|
||
import * as MoneyRequestUtils from '@libs/MoneyRequestUtils'; | ||
Check failure on line 9 in src/components/TextInputWithCurrencySymbol/BaseTextInputWithCurrencySymbol.tsx
|
||
import type {BaseTextInputRef} from '@src/components/TextInput/BaseTextInput/types'; | ||
|
@@ -22,6 +23,7 @@ function BaseTextInputWithCurrencySymbol( | |
isCurrencyPressable = true, | ||
hideCurrencySymbol = false, | ||
extraSymbol, | ||
isNegative = false, | ||
style, | ||
...rest | ||
}: BaseTextInputWithCurrencySymbolProps, | ||
|
@@ -67,9 +69,12 @@ function BaseTextInputWithCurrencySymbol( | |
/> | ||
); | ||
|
||
const negativeSymbol = <Text style={[styles.iouAmountText]}>-</Text>; | ||
|
||
if (isCurrencySymbolLTR) { | ||
return ( | ||
<> | ||
{isNegative && negativeSymbol} | ||
{currencySymbolButton} | ||
{amountTextInput} | ||
{extraSymbol} | ||
|
@@ -79,6 +84,7 @@ function BaseTextInputWithCurrencySymbol( | |
|
||
return ( | ||
<> | ||
{isNegative && negativeSymbol} | ||
{amountTextInput} | ||
{currencySymbolButton} | ||
{extraSymbol} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters