Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/pages/ReimbursementAccount/EnableStep.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'underscore';
import React from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import {View, ScrollView} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import styles from '../../styles/styles';
import themeColors from '../../styles/themes/default';
Expand Down Expand Up @@ -95,7 +95,7 @@ class EnableStep extends React.Component {
shouldShowBackButton
onBackButtonPress={() => Navigation.goBack()}
/>
<View style={[styles.flex1]}>
<ScrollView style={[styles.flex1]}>
<Section
title={!isUsingExpensifyCard ? this.props.translate('workspace.bankAccount.oneMoreThing') : this.props.translate('workspace.bankAccount.allSet')}
icon={!isUsingExpensifyCard ? Illustrations.ConciergeNew : Illustrations.ThumbsUpStars}
Expand Down Expand Up @@ -144,7 +144,7 @@ class EnableStep extends React.Component {
{this.props.translate('workspace.card.checkingDomain')}
</Text>
)}
</View>
</ScrollView>
</View>
);
}
Expand Down
5 changes: 5 additions & 0 deletions src/pages/settings/Payments/PaymentMethodList.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ const propTypes = {
/** ID of selected payment method */
selectedMethodID: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),

/** Content for the FlatList header component */
listHeaderComponent: PropTypes.func,

...withLocalizePropTypes,
};

Expand All @@ -76,6 +79,7 @@ const defaultProps = {
actionPaymentMethodType: '',
activePaymentMethodID: '',
selectedMethodID: '',
listHeaderComponent: null,
};

class PaymentMethodList extends Component {
Expand Down Expand Up @@ -215,6 +219,7 @@ class PaymentMethodList extends Component {
renderItem={this.renderItem}
keyExtractor={item => item.key}
ListEmptyComponent={this.renderListEmptyComponent()}
ListHeaderComponent={this.props.listHeaderComponent}
/>
{
this.props.shouldShowAddPaymentMethodButton
Expand Down
85 changes: 47 additions & 38 deletions src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class BasePaymentsPage extends React.Component {
this.hidePasswordPrompt = this.hidePasswordPrompt.bind(this);
this.navigateToTransferBalancePage = this.navigateToTransferBalancePage.bind(this);
this.setMenuPosition = this.setMenuPosition.bind(this);
this.listHeaderComponent = this.listHeaderComponent.bind(this);
}

componentDidMount() {
Expand Down Expand Up @@ -260,6 +261,51 @@ class BasePaymentsPage extends React.Component {
Navigation.navigate(ROUTES.SETTINGS_PAYMENTS_TRANSFER_BALANCE);
}

listHeaderComponent() {
return (
<>
{Permissions.canUseWallet(this.props.betas) && (
<>
<View style={[styles.mv5]}>
<OfflineWithFeedback
pendingAction={CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD}
errors={this.props.walletTerms.errors}
onClose={PaymentMethods.clearWalletTermsError}
errorRowStyles={[styles.ml10, styles.mr2]}
>
<CurrentWalletBalance />
</OfflineWithFeedback>
</View>
{this.props.userWallet.currentBalance > 0 && (
<KYCWall
onSuccessfulKYC={this.navigateToTransferBalancePage}
enablePaymentsRoute={ROUTES.SETTINGS_ENABLE_PAYMENTS}
addBankAccountRoute={ROUTES.SETTINGS_ADD_BANK_ACCOUNT}
addDebitCardRoute={ROUTES.SETTINGS_ADD_DEBIT_CARD}
popoverPlacement="bottom"
>
{triggerKYCFlow => (
<MenuItem
title={this.props.translate('common.transferBalance')}
icon={Expensicons.Transfer}
onPress={triggerKYCFlow}
shouldShowRightIcon
disabled={this.props.network.isOffline}
/>
)}
</KYCWall>
)}
</>
)}
<Text
style={[styles.ph5, styles.mt6, styles.formLabel]}
>
{this.props.translate('paymentsPage.paymentMethodsTitle')}
</Text>
</>
);
}

render() {
const isPayPalMeSelected = this.state.formattedSelectedPaymentMethod.type === CONST.PAYMENT_METHODS.PAYPAL;
const shouldShowMakeDefaultButton = !this.state.isSelectedPaymentMethodDefault
Expand All @@ -278,44 +324,6 @@ class BasePaymentsPage extends React.Component {
onCloseButtonPress={() => Navigation.dismissModal(true)}
/>
<View style={[styles.flex1, styles.mb4]}>
{Permissions.canUseWallet(this.props.betas) && (
<>
<View style={[styles.mv5]}>
<OfflineWithFeedback
pendingAction={CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD}
errors={this.props.walletTerms.errors}
onClose={PaymentMethods.clearWalletTermsError}
errorRowStyles={[styles.ml10, styles.mr2]}
>
<CurrentWalletBalance />
</OfflineWithFeedback>
</View>
{this.props.userWallet.currentBalance > 0 && (
<KYCWall
onSuccessfulKYC={this.navigateToTransferBalancePage}
enablePaymentsRoute={ROUTES.SETTINGS_ENABLE_PAYMENTS}
addBankAccountRoute={ROUTES.SETTINGS_ADD_BANK_ACCOUNT}
addDebitCardRoute={ROUTES.SETTINGS_ADD_DEBIT_CARD}
popoverPlacement="bottom"
>
{triggerKYCFlow => (
<MenuItem
title={this.props.translate('common.transferBalance')}
icon={Expensicons.Transfer}
onPress={triggerKYCFlow}
shouldShowRightIcon
disabled={this.props.network.isOffline}
/>
)}
</KYCWall>
)}
</>
)}
<Text
style={[styles.ph5, styles.mt6, styles.formLabel]}
>
{this.props.translate('paymentsPage.paymentMethodsTitle')}
</Text>
<OfflineWithFeedback
style={styles.flex1}
contentContainerStyle={styles.flex1}
Expand All @@ -333,6 +341,7 @@ class BasePaymentsPage extends React.Component {
activePaymentMethodID={this.state.shouldShowDefaultDeleteMenu || this.state.shouldShowPasswordPrompt
? this.getSelectedPaymentMethodID()
: ''}
listHeaderComponent={this.listHeaderComponent}
/>
</OfflineWithFeedback>
</View>
Expand Down