mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
FIX: When selecting to send MAX on part or a X is shown in amount. #2412
This commit is contained in:
parent
499b6b4b23
commit
c55cb44b01
3 changed files with 37 additions and 22 deletions
|
@ -2,9 +2,9 @@ import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { Text } from 'react-native-elements';
|
import { Text } from 'react-native-elements';
|
||||||
import { Image, StyleSheet, TextInput, TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native';
|
import { Image, Pressable, StyleSheet, TextInput, TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native';
|
||||||
import { useTheme } from '@react-navigation/native';
|
import { useTheme } from '@react-navigation/native';
|
||||||
|
import confirm from '../helpers/confirm';
|
||||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||||
import loc, { formatBalanceWithoutSuffix, formatBalancePlain, removeTrailingZeros } from '../loc';
|
import loc, { formatBalanceWithoutSuffix, formatBalancePlain, removeTrailingZeros } from '../loc';
|
||||||
const currency = require('../blue_modules/currency');
|
const currency = require('../blue_modules/currency');
|
||||||
|
@ -162,6 +162,12 @@ class AmountInput extends Component {
|
||||||
this.props.onChangeText(text);
|
this.props.onChangeText(text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
resetAmount = async () => {
|
||||||
|
if (await confirm(loc.send.reset_amount, loc.send.reset_amount_confirm)) {
|
||||||
|
this.props.onChangeText();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { colors, disabled, unit } = this.props;
|
const { colors, disabled, unit } = this.props;
|
||||||
const amount = this.props.amount || 0;
|
const amount = this.props.amount || 0;
|
||||||
|
@ -206,6 +212,7 @@ class AmountInput extends Component {
|
||||||
{unit === BitcoinUnit.LOCAL_CURRENCY && amount !== BitcoinUnit.MAX && (
|
{unit === BitcoinUnit.LOCAL_CURRENCY && amount !== BitcoinUnit.MAX && (
|
||||||
<Text style={[styles.localCurrency, stylesHook.localCurrency]}>{currency.getCurrencySymbol() + ' '}</Text>
|
<Text style={[styles.localCurrency, stylesHook.localCurrency]}>{currency.getCurrencySymbol() + ' '}</Text>
|
||||||
)}
|
)}
|
||||||
|
{amount !== BitcoinUnit.MAX ? (
|
||||||
<TextInput
|
<TextInput
|
||||||
{...this.props}
|
{...this.props}
|
||||||
testID="BitcoinAmountInput"
|
testID="BitcoinAmountInput"
|
||||||
|
@ -226,6 +233,11 @@ class AmountInput extends Component {
|
||||||
placeholderTextColor={disabled ? colors.buttonDisabledTextColor : colors.alternativeTextColor2}
|
placeholderTextColor={disabled ? colors.buttonDisabledTextColor : colors.alternativeTextColor2}
|
||||||
style={[styles.input, stylesHook.input]}
|
style={[styles.input, stylesHook.input]}
|
||||||
/>
|
/>
|
||||||
|
) : (
|
||||||
|
<Pressable onPress={this.resetAmount}>
|
||||||
|
<Text style={[styles.input, stylesHook.input]}>{BitcoinUnit.MAX}</Text>
|
||||||
|
</Pressable>
|
||||||
|
)}
|
||||||
{unit !== BitcoinUnit.LOCAL_CURRENCY && amount !== BitcoinUnit.MAX && (
|
{unit !== BitcoinUnit.LOCAL_CURRENCY && amount !== BitcoinUnit.MAX && (
|
||||||
<Text style={[styles.cryptoCurrency, stylesHook.cryptoCurrency]}>{' ' + loc.units[unit]}</Text>
|
<Text style={[styles.cryptoCurrency, stylesHook.cryptoCurrency]}>{' ' + loc.units[unit]}</Text>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -231,6 +231,8 @@
|
||||||
"psbt_tx_scan": "Scan Signed Transaction",
|
"psbt_tx_scan": "Scan Signed Transaction",
|
||||||
"qr_error_no_qrcode": "We were unable to find a QR Code in the selected image. Make sure the image contains only a QR Code and no additional content such as text, or buttons.",
|
"qr_error_no_qrcode": "We were unable to find a QR Code in the selected image. Make sure the image contains only a QR Code and no additional content such as text, or buttons.",
|
||||||
"qr_error_no_wallet": "The selected file doesn’t contain a wallet that can be imported.",
|
"qr_error_no_wallet": "The selected file doesn’t contain a wallet that can be imported.",
|
||||||
|
"reset_amount": "Reset Amount",
|
||||||
|
"reset_amount_confirm": "Would you like to reset the amount?",
|
||||||
"success_done": "Done",
|
"success_done": "Done",
|
||||||
"txSaved": "The transaction file ({filePath}) has been saved in your Downloads folder.",
|
"txSaved": "The transaction file ({filePath}) has been saved in your Downloads folder.",
|
||||||
"problem_with_psbt": "Problem with PSBT"
|
"problem_with_psbt": "Problem with PSBT"
|
||||||
|
|
|
@ -861,6 +861,7 @@ const SendDetails = () => {
|
||||||
id: SendDetails.actionKeys.AddRecipient,
|
id: SendDetails.actionKeys.AddRecipient,
|
||||||
text: loc.send.details_add_rec_add,
|
text: loc.send.details_add_rec_add,
|
||||||
icon: SendDetails.actionIcons.AddRecipient,
|
icon: SendDetails.actionIcons.AddRecipient,
|
||||||
|
disabled: isSendMaxUsed,
|
||||||
});
|
});
|
||||||
actions.push({
|
actions.push({
|
||||||
id: SendDetails.actionKeys.RemoveRecipient,
|
id: SendDetails.actionKeys.RemoveRecipient,
|
||||||
|
|
Loading…
Add table
Reference in a new issue