FIX: Toolbar now visible for Android

This commit is contained in:
Marcos Rodriguez 2019-08-05 18:25:36 -04:00 committed by Overtorment
parent 21d8bf59c6
commit fa29c645cc
3 changed files with 56 additions and 33 deletions

View file

@ -11,6 +11,7 @@ import {
Animated,
ActivityIndicator,
View,
KeyboardAvoidingView,
UIManager,
StyleSheet,
Dimensions,
@ -765,30 +766,35 @@ export class BlueUseAllFundsButton extends Component {
};
render() {
return (
<InputAccessoryView nativeID={BlueUseAllFundsButton.InputAccessoryViewID}>
<View
style={{
flex: 1,
flexDirection: 'row',
maxHeight: 44,
justifyContent: 'space-between',
alignItems: 'center',
backgroundColor: '#eef0f4',
}}
>
<View style={{ flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center' }}>
<Text style={{ color: BlueApp.settings.alternativeTextColor, fontSize: 16, marginHorizontal: 8 }}>
Total: {this.props.wallet.getBalance()} {BitcoinUnit.BTC}
</Text>
{this.props.wallet.allowSendMax() && <BlueButtonLink title="Use All" onPress={this.props.onUseAllPressed} />}
</View>
<View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'flex-end' }}>
<BlueButtonLink title="Done" onPress={Keyboard.dismiss} />
</View>
const inputView = (
<View
style={{
flex: 1,
flexDirection: 'row',
maxHeight: 44,
justifyContent: 'space-between',
alignItems: 'center',
backgroundColor: '#eef0f4',
}}
>
<View style={{ flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center' }}>
<Text style={{ color: BlueApp.settings.alternativeTextColor, fontSize: 16, marginHorizontal: 8 }}>
Total: {this.props.wallet.getBalance()} {BitcoinUnit.BTC}
</Text>
{this.props.wallet.allowSendMax() && this.props.wallet.balance > 0 && (
<BlueButtonLink title="Use All" onPress={this.props.onUseAllPressed} />
)}
</View>
</InputAccessoryView>
<View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'flex-end' }}>
<BlueButtonLink title="Done" onPress={Keyboard.dismiss} />
</View>
</View>
);
if (Platform.OS === 'ios') {
return <InputAccessoryView nativeID={BlueUseAllFundsButton.InputAccessoryViewID}>{inputView}</InputAccessoryView>;
} else {
return <KeyboardAvoidingView style={{ height: 44 }}>{inputView}</KeyboardAvoidingView>;
}
}
}

4
package-lock.json generated
View file

@ -3956,8 +3956,8 @@
"integrity": "sha512-SfD7WfmueKrtKeHUESLczuANgnpdnfrSz3ZzerLdtmZf2UBZmAB3z9Q525zI5p3n9I7ii/lllUlyKHm2pIG7QQ=="
},
"electrum-client": {
"version": "git+https://github.com/Overtorment/rn-electrum-client.git#d194ff69195ccc86f72088ea3712179b4be9cbb4",
"from": "git+https://github.com/Overtorment/rn-electrum-client.git"
"version": "git+https://github.com/BlueWallet/rn-electrum-client.git#d194ff69195ccc86f72088ea3712179b4be9cbb4",
"from": "git+https://github.com/BlueWallet/rn-electrum-client.git"
},
"elliptic": {
"version": "6.5.0",

View file

@ -22,7 +22,6 @@ import {
BlueAddressInput,
BlueDismissKeyboardInputAccessory,
BlueLoading,
BlueButtonLink,
BlueUseAllFundsButton,
} from '../../BlueComponents';
import Slider from '@react-native-community/slider';
@ -73,7 +72,7 @@ export default class SendDetails extends Component {
fromSecret = fromWallet.getSecret();
}
this.state = {
isLoading: true,
isLoading: false,
showSendMax: false,
isFeeSelectionModalVisible: false,
fromAddress,
@ -636,6 +635,8 @@ export default class SendDetails extends Component {
amount={this.state.amount.toString()}
onChangeText={text => this.setState({ amount: text })}
inputAccessoryViewID={this.state.fromWallet.allowSendMax() ? BlueUseAllFundsButton.InputAccessoryViewID : null}
onFocus={() => this.setState({ isAmountToolbarVisibleForAndroid: true })}
onBlur={() => this.setState({ isAmountToolbarVisibleForAndroid: false })}
/>
<BlueAddressInput
onChangeText={text => {
@ -720,13 +721,29 @@ export default class SendDetails extends Component {
</KeyboardAvoidingView>
</View>
<BlueDismissKeyboardInputAccessory />
<BlueUseAllFundsButton
onUseAllPressed={() => {
this.setState({ amount: 'MAX' });
Keyboard.dismiss();
}}
wallet={this.state.fromWallet}
/>
{Platform.select({
ios: (
<BlueUseAllFundsButton
onUseAllPressed={() => {
this.setState({ amount: 'MAX' });
Keyboard.dismiss();
}}
wallet={this.state.fromWallet}
visi
/>
),
android: this.state.isAmountToolbarVisibleForAndroid && (
<BlueUseAllFundsButton
onUseAllPressed={() => {
this.setState({ amount: 'MAX' });
Keyboard.dismiss();
}}
wallet={this.state.fromWallet}
visi
/>
),
})}
{this.renderWalletSelectionButton()}
</View>
</TouchableWithoutFeedback>