mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 06:52:41 +01:00
OPS: Expanded BlueBitcoinAmount to support sats
This commit is contained in:
parent
b6ad5fdc12
commit
7f4887d5c7
2 changed files with 18 additions and 4 deletions
|
@ -1116,6 +1116,11 @@ export class BlueBitcoinAmount extends Component {
|
|||
amount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
onChangeText: PropTypes.func,
|
||||
disabled: PropTypes.bool,
|
||||
unit: PropTypes.string,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
unit: BitcoinUnit.BTC,
|
||||
};
|
||||
|
||||
render() {
|
||||
|
@ -1127,7 +1132,13 @@ export class BlueBitcoinAmount extends Component {
|
|||
<View style={{ flexDirection: 'row', justifyContent: 'center', paddingTop: 16, paddingBottom: 16 }}>
|
||||
<TextInput
|
||||
keyboardType="numeric"
|
||||
onChangeText={text => this.props.onChangeText(text.replace(',', '.'))}
|
||||
onChangeText={text =>
|
||||
this.props.onChangeText(
|
||||
this.props.unit === BitcoinUnit.BTC
|
||||
? text.replace(new RegExp('[^0-9.]'), '', '.')
|
||||
: text.replace(new RegExp('[^0-9]'), ''),
|
||||
)
|
||||
}
|
||||
placeholder="0"
|
||||
maxLength={10}
|
||||
ref={textInput => (this.textInput = textInput)}
|
||||
|
@ -1150,12 +1161,15 @@ export class BlueBitcoinAmount extends Component {
|
|||
alignSelf: 'flex-end',
|
||||
}}
|
||||
>
|
||||
{' ' + BitcoinUnit.BTC}
|
||||
{' ' + this.props.unit}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ alignItems: 'center', marginBottom: 22, marginTop: 4 }}>
|
||||
<Text style={{ fontSize: 18, color: '#d4d4d4', fontWeight: '600' }}>
|
||||
{loc.formatBalance(amount || 0, BitcoinUnit.LOCAL_CURRENCY)}
|
||||
{loc.formatBalance(
|
||||
this.props.unit === BitcoinUnit.BTC ? amount || 0 : loc.formatBalanceWithoutSuffix(amount || 0, BitcoinUnit.BTC),
|
||||
BitcoinUnit.LOCAL_CURRENCY,
|
||||
)}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
|
|
@ -53,7 +53,7 @@ export default class RBF extends Component {
|
|||
} else {
|
||||
// DESTINATION address
|
||||
|
||||
destinationAddress = o.addresses && o.addresses[0] || '';
|
||||
destinationAddress = (o.addresses && o.addresses[0]) || '';
|
||||
console.log('dest = ', destinationAddress);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue