Skip to content

Commit

Permalink
Merge pull request #11257 from Expensify/Rory-ExtraSpaceAdditionalDet…
Browse files Browse the repository at this point in the history
…ails

Fix extra space on AdditionalDetailsPage
  • Loading branch information
AndrewGable authored Sep 29, 2022
2 parents cebd727 + da98b2e commit 60d933e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
5 changes: 2 additions & 3 deletions src/pages/EnablePayments/ActivateStep.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import ScreenWrapper from '../../components/ScreenWrapper';
import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
import Navigation from '../../libs/Navigation/Navigation';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
Expand Down Expand Up @@ -79,7 +78,7 @@ class ActivateStep extends React.Component {

render() {
return (
<ScreenWrapper>
<>
<HeaderWithCloseButton
title={this.props.translate('activateStep.headerTitle')}
onCloseButtonPress={() => Navigation.dismissModal()}
Expand All @@ -92,7 +91,7 @@ class ActivateStep extends React.Component {
<Text>{this.props.translate('activateStep.checkBackLater')}</Text>
)}
</View>
</ScreenWrapper>
</>
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/EnablePayments/AdditionalDetailsStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class AdditionalDetailsStep extends React.Component {
const {firstName, lastName} = PersonalDetails.extractFirstAndLastNameFromAvailableDetails(this.props.currentUserPersonalDetails);

return (
<ScreenWrapper style={[styles.flex1]} keyboardAvoidingViewBehavior="height">
<>
<HeaderWithCloseButton
title={this.props.translate('additionalDetailsStep.headerTitle')}
onCloseButtonPress={() => Navigation.dismissModal()}
Expand Down Expand Up @@ -370,7 +370,7 @@ class AdditionalDetailsStep extends React.Component {
<OfflineIndicator containerStyles={[styles.mh5, styles.mb3]} />
</FormScrollView>
</View>
</ScreenWrapper>
</>
);
}
}
Expand Down
53 changes: 29 additions & 24 deletions src/pages/EnablePayments/EnablePaymentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import OnfidoStep from './OnfidoStep';
import AdditionalDetailsStep from './AdditionalDetailsStep';
import TermsStep from './TermsStep';
import ActivateStep from './ActivateStep';
import styles from '../../styles/styles';
import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
import Navigation from '../../libs/Navigation/Navigation';
import FailedKYC from './FailedKYC';
Expand Down Expand Up @@ -54,31 +53,37 @@ class EnablePaymentsPage extends React.Component {
return <FullScreenLoadingIndicator />;
}

if (this.props.userWallet.errorCode === CONST.WALLET.ERROR.KYC) {
return (
<ScreenWrapper style={[styles.flex1]} keyboardAvoidingViewBehavior="height">
<HeaderWithCloseButton
title={this.props.translate('additionalDetailsStep.headerTitle')}
onCloseButtonPress={() => Navigation.dismissModal()}
/>
<FailedKYC />
</ScreenWrapper>
);
}
if (this.props.userWallet.shouldShowWalletActivationSuccess) {
return (
<ActivateStep userWallet={this.props.userWallet} />
);
}

const currentStep = this.props.userWallet.currentStep || CONST.WALLET.STEP.ADDITIONAL_DETAILS;

return (
<ScreenWrapper>
{currentStep === CONST.WALLET.STEP.ADDITIONAL_DETAILS && <AdditionalDetailsStep walletAdditionalDetailsDraft={this.props.walletAdditionalDetailsDraft} />}
{currentStep === CONST.WALLET.STEP.ONFIDO && <OnfidoStep walletAdditionalDetailsDraft={this.props.walletAdditionalDetailsDraft} />}
{currentStep === CONST.WALLET.STEP.TERMS && <TermsStep />}
{currentStep === CONST.WALLET.STEP.ACTIVATE && <ActivateStep userWallet={this.props.userWallet} />}
{(() => {
if (this.props.userWallet.errorCode === CONST.WALLET.ERROR.KYC) {
return (
<>
<HeaderWithCloseButton
title={this.props.translate('additionalDetailsStep.headerTitle')}
onCloseButtonPress={() => Navigation.dismissModal()}
/>
<FailedKYC />
</>
);
}

if (this.props.userWallet.shouldShowWalletActivationSuccess) {
return (
<ActivateStep userWallet={this.props.userWallet} />
);
}

const currentStep = this.props.userWallet.currentStep || CONST.WALLET.STEP.ADDITIONAL_DETAILS;
return (
<>
{currentStep === CONST.WALLET.STEP.ADDITIONAL_DETAILS && <AdditionalDetailsStep walletAdditionalDetailsDraft={this.props.walletAdditionalDetailsDraft} />}
{currentStep === CONST.WALLET.STEP.ONFIDO && <OnfidoStep walletAdditionalDetailsDraft={this.props.walletAdditionalDetailsDraft} />}
{currentStep === CONST.WALLET.STEP.TERMS && <TermsStep />}
{currentStep === CONST.WALLET.STEP.ACTIVATE && <ActivateStep userWallet={this.props.userWallet} />}
</>
);
})()}
</ScreenWrapper>
);
}
Expand Down

0 comments on commit 60d933e

Please sign in to comment.