mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
REF: BlueUseAllFundsButton hooks
This commit is contained in:
parent
f4cdccf948
commit
f76a00c94c
1 changed files with 54 additions and 56 deletions
|
@ -962,15 +962,14 @@ export const BlueSpacing10 = props => {
|
||||||
return <View {...props} style={{ height: 10, opacity: 0 }} />;
|
return <View {...props} style={{ height: 10, opacity: 0 }} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class BlueUseAllFundsButton extends Component {
|
export const BlueUseAllFundsButton = ({ balance, canUseAll, onUseAllPressed }) => {
|
||||||
static InputAccessoryViewID = 'useMaxInputAccessoryViewID';
|
const { colors } = useTheme();
|
||||||
static propTypes = {
|
BlueUseAllFundsButton.InputAccessoryViewID = 'useMaxInputAccessoryViewID';
|
||||||
|
BlueUseAllFundsButton.propTypes = {
|
||||||
balance: PropTypes.string.isRequired,
|
balance: PropTypes.string.isRequired,
|
||||||
canUseAll: PropTypes.bool.isRequired,
|
canUseAll: PropTypes.bool.isRequired,
|
||||||
onUseAllPressed: PropTypes.func.isRequired,
|
onUseAllPressed: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
|
||||||
const inputView = (
|
const inputView = (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
|
@ -979,13 +978,13 @@ export class BlueUseAllFundsButton extends Component {
|
||||||
maxHeight: 44,
|
maxHeight: 44,
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
backgroundColor: BlueCurrentTheme.colors.inputBackgroundColor,
|
backgroundColor: colors.inputBackgroundColor,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={{ flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'flex-start' }}>
|
<View style={{ flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'flex-start' }}>
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
color: BlueCurrentTheme.colors.alternativeTextColor,
|
color: colors.alternativeTextColor,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
marginLeft: 8,
|
marginLeft: 8,
|
||||||
marginRight: 0,
|
marginRight: 0,
|
||||||
|
@ -997,16 +996,16 @@ export class BlueUseAllFundsButton extends Component {
|
||||||
>
|
>
|
||||||
{loc.send.input_total}
|
{loc.send.input_total}
|
||||||
</Text>
|
</Text>
|
||||||
{this.props.canUseAll ? (
|
{canUseAll ? (
|
||||||
<BlueButtonLink
|
<BlueButtonLink
|
||||||
onPress={this.props.onUseAllPressed}
|
onPress={onUseAllPressed}
|
||||||
style={{ marginLeft: 8, paddingRight: 0, paddingLeft: 0, paddingTop: 12, paddingBottom: 12 }}
|
style={{ marginLeft: 8, paddingRight: 0, paddingLeft: 0, paddingTop: 12, paddingBottom: 12 }}
|
||||||
title={`${this.props.balance} ${BitcoinUnit.BTC}`}
|
title={`${balance} ${BitcoinUnit.BTC}`}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
color: BlueCurrentTheme.colors.alternativeTextColor,
|
color: colors.alternativeTextColor,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
marginLeft: 8,
|
marginLeft: 8,
|
||||||
marginRight: 0,
|
marginRight: 0,
|
||||||
|
@ -1016,7 +1015,7 @@ export class BlueUseAllFundsButton extends Component {
|
||||||
paddingBottom: 12,
|
paddingBottom: 12,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{this.props.balance} {BitcoinUnit.BTC}
|
{balance} {BitcoinUnit.BTC}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
@ -1024,7 +1023,7 @@ export class BlueUseAllFundsButton extends Component {
|
||||||
<BlueButtonLink
|
<BlueButtonLink
|
||||||
style={{ paddingRight: 8, paddingLeft: 0, paddingTop: 12, paddingBottom: 12 }}
|
style={{ paddingRight: 8, paddingLeft: 0, paddingTop: 12, paddingBottom: 12 }}
|
||||||
title={loc.send.input_done}
|
title={loc.send.input_done}
|
||||||
onPress={() => Keyboard.dismiss()}
|
onPress={Keyboard.dismiss}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -1035,8 +1034,7 @@ export class BlueUseAllFundsButton extends Component {
|
||||||
} else {
|
} else {
|
||||||
return <KeyboardAvoidingView style={{ height: 44 }}>{inputView}</KeyboardAvoidingView>;
|
return <KeyboardAvoidingView style={{ height: 44 }}>{inputView}</KeyboardAvoidingView>;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
export const BlueDismissKeyboardInputAccessory = () => {
|
export const BlueDismissKeyboardInputAccessory = () => {
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
|
|
Loading…
Add table
Reference in a new issue