mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
FIX: Don't allow more than one leading zero.
This commit is contained in:
parent
974b00e4f2
commit
50efce8b84
@ -1988,12 +1988,22 @@ export class BlueBitcoinAmount extends Component {
|
||||
{...this.props}
|
||||
keyboardType="numeric"
|
||||
onChangeText={text => {
|
||||
text = text.trim();
|
||||
text = text.replace(',', '.');
|
||||
const split = text.split('.');
|
||||
if (split.length >= 2) {
|
||||
text = `${parseInt(split[0], 10)}.${split[1]}`;
|
||||
}
|
||||
text = this.props.unit === BitcoinUnit.BTC ? text.replace(/[^0-9.]/g, '') : text.replace(/[^0-9]/g, '');
|
||||
text = text.replace(/(\..*)\./g, '$1');
|
||||
|
||||
if (text.startsWith('.')) {
|
||||
text = '0.';
|
||||
}
|
||||
text = text.replace(/(0{1,}.)\./g, '$1');
|
||||
if (this.props.unit !== BitcoinUnit.BTC) {
|
||||
text = text.replace(/[^0-9.]/g, '');
|
||||
}
|
||||
this.props.onChangeText(text);
|
||||
}}
|
||||
onBlur={() => {
|
||||
|
Loading…
Reference in New Issue
Block a user