mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
Fix: Amount needs to be string
This commit is contained in:
parent
3861d04213
commit
a8923c6850
@ -1108,12 +1108,14 @@ export class WalletsCarousel extends Component {
|
||||
export class BlueBitcoinAmount extends Component {
|
||||
static propTypes = {
|
||||
isLoading: PropTypes.bool,
|
||||
amount: PropTypes.string,
|
||||
amount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
onChangeText: PropTypes.func,
|
||||
disabled: PropTypes.bool,
|
||||
};
|
||||
|
||||
render() {
|
||||
const amount = typeof this.props.amount === 'number' ? this.props.amount.toString() : this.props.amount;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<View style={{ flexDirection: 'row', justifyContent: 'center', paddingTop: 16, paddingBottom: 16 }}>
|
||||
@ -1123,7 +1125,7 @@ export class BlueBitcoinAmount extends Component {
|
||||
placeholder="0"
|
||||
maxLength={10}
|
||||
editable={!this.props.isLoading && !this.props.disabled}
|
||||
value={this.props.amount}
|
||||
value={amount}
|
||||
placeholderTextColor={this.props.disabled ? '#99a0ab' : '#0f5cc0'}
|
||||
style={{
|
||||
color: this.props.disabled ? '#99a0ab' : '#0f5cc0',
|
||||
@ -1146,7 +1148,7 @@ export class BlueBitcoinAmount extends Component {
|
||||
</View>
|
||||
<View style={{ alignItems: 'center', marginBottom: 22, marginTop: 4 }}>
|
||||
<Text style={{ fontSize: 18, color: '#d4d4d4', fontWeight: '600' }}>
|
||||
{loc.formatBalance(this.props.amount || 0, BitcoinUnit.LOCAL_CURRENCY)}
|
||||
{loc.formatBalance(amount || 0, BitcoinUnit.LOCAL_CURRENCY)}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
@ -107,35 +107,35 @@ export default class ReceiveAmount extends Component {
|
||||
render() {
|
||||
return (
|
||||
<SafeBlueArea style={{ flex: 1 }}>
|
||||
<View style={{ flex: 1, backgroundColor: '#FFFFFF', justifyContent: 'space-between' }}>
|
||||
<KeyboardAvoidingView behavior="position">
|
||||
<BlueBitcoinAmount
|
||||
amount={this.state.amount || ''}
|
||||
onChangeText={text => this.setState({ amount: text })}
|
||||
disabled={this.state.amountSet}
|
||||
/>
|
||||
{this.state.amountSet ? this.renderWithSetAmount() : this.renderDefault()}
|
||||
</KeyboardAvoidingView>
|
||||
{this.state.amountSet && (
|
||||
<BlueButton
|
||||
buttonStyle={{
|
||||
alignSelf: 'center',
|
||||
marginBottom: 24,
|
||||
}}
|
||||
icon={{
|
||||
name: 'share-alternative',
|
||||
type: 'entypo',
|
||||
color: BlueApp.settings.buttonTextColor,
|
||||
}}
|
||||
onPress={async () => {
|
||||
Share.share({
|
||||
message: bip21.encode(this.state.address, { amount: this.state.amount, label: this.state.label }),
|
||||
});
|
||||
}}
|
||||
title={loc.receive.details.share}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
<View style={{ flex: 1, backgroundColor: '#FFFFFF', justifyContent: 'space-between' }}>
|
||||
<KeyboardAvoidingView behavior="position">
|
||||
<BlueBitcoinAmount
|
||||
amount={this.state.amount || ''}
|
||||
onChangeText={text => this.setState({ amount: text })}
|
||||
disabled={this.state.amountSet}
|
||||
/>
|
||||
{this.state.amountSet ? this.renderWithSetAmount() : this.renderDefault()}
|
||||
</KeyboardAvoidingView>
|
||||
{this.state.amountSet && (
|
||||
<BlueButton
|
||||
buttonStyle={{
|
||||
alignSelf: 'center',
|
||||
marginBottom: 24,
|
||||
}}
|
||||
icon={{
|
||||
name: 'share-alternative',
|
||||
type: 'entypo',
|
||||
color: BlueApp.settings.buttonTextColor,
|
||||
}}
|
||||
onPress={async () => {
|
||||
Share.share({
|
||||
message: bip21.encode(this.state.address, { amount: this.state.amount, label: this.state.label }),
|
||||
});
|
||||
}}
|
||||
title={loc.receive.details.share}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</SafeBlueArea>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user