mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
FIX: disable create button if total exceeds balance.
This commit is contained in:
parent
34fc84cbdc
commit
7b3a6e2e13
2 changed files with 11 additions and 2 deletions
|
@ -1161,6 +1161,12 @@ const SendDetails = () => {
|
|||
},
|
||||
});
|
||||
|
||||
const calculateTotalAmount = () => {
|
||||
const totalAmount = addresses.reduce((total, item) => total + Number(item.amountSats || 0), 0);
|
||||
const totalWithFee = totalAmount + (feePrecalc.current || 0);
|
||||
return totalWithFee;
|
||||
};
|
||||
|
||||
const renderFeeSelectionModal = () => {
|
||||
const nf = networkTransactionFees;
|
||||
const options = [
|
||||
|
@ -1320,12 +1326,15 @@ const SendDetails = () => {
|
|||
};
|
||||
|
||||
const renderCreateButton = () => {
|
||||
const totalWithFee = calculateTotalAmount();
|
||||
const isDisabled = totalWithFee === 0 || totalWithFee > balance || balance === 0 || isLoading || addresses.length === 0;
|
||||
|
||||
return (
|
||||
<View style={styles.createButton}>
|
||||
{isLoading ? (
|
||||
<ActivityIndicator />
|
||||
) : (
|
||||
<Button onPress={createTransaction} title={loc.send.details_next} testID="CreateTransactionButton" />
|
||||
<Button onPress={createTransaction} disabled={isDisabled} title={loc.send.details_next} testID="CreateTransactionButton" />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
|
|
|
@ -666,7 +666,7 @@ const styles = StyleSheet.create({
|
|||
},
|
||||
listHeaderTextRow: {
|
||||
flex: 1,
|
||||
marginHorizontal: 16,
|
||||
margin: 16,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue