Skip to content

Commit

Permalink
SendFlow/CustomGas: fix button not disabling and error not showing wh…
Browse files Browse the repository at this point in the history
…en updating gas limit
  • Loading branch information
EtDu committed May 22, 2020
1 parent 72cb781 commit c401cf4
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions app/components/Views/SendFlow/CustomGas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,11 @@ class CustomGas extends PureComponent {
renderGasError = () => {
const { warningGasLimit, warningGasPrice } = this.state;
const { gasError } = this.props;
let gasErrorMessage;
if (warningGasPrice) {
gasErrorMessage = warningGasPrice;
} else if (warningGasLimit) {
gasErrorMessage = warningGasLimit;
}
const hideError = !gasError && !warningGasLimit && !warningGasPrice;
const gasErrorMessage = warningGasPrice || warningGasLimit;
return (
<View style={styles.warningWrapper}>
<View style={[styles.warningTextWrapper, !gasError ? styles.invisible : null]}>
<View style={[styles.warningTextWrapper, hideError ? styles.invisible : null]}>
<Text style={styles.warningText}>{gasErrorMessage}</Text>
</View>
</View>
Expand All @@ -546,7 +542,7 @@ class CustomGas extends PureComponent {

render = () => {
if (this.state.ready) {
const { advancedCustomGas } = this.state;
const { advancedCustomGas, warningGasLimit, warningGasPrice } = this.state;
const { toggleCustomGasModal, handleSetGasFee, gasError } = this.props;
return (
<View style={styles.root}>
Expand Down Expand Up @@ -578,7 +574,7 @@ class CustomGas extends PureComponent {
{advancedCustomGas ? this.renderGasError() : null}
<View style={styles.footerContainer}>
<StyledButton
disabled={!!gasError}
disabled={!!gasError || !!warningGasLimit || !!warningGasPrice}
type={'confirm'}
containerStyle={styles.buttonNext}
onPress={handleSetGasFee}
Expand Down

0 comments on commit c401cf4

Please sign in to comment.