From 3a508d698497ecf06d7c933d773a3cf8673baea5 Mon Sep 17 00:00:00 2001 From: VH Date: Tue, 5 Sep 2023 00:21:32 +0700 Subject: [PATCH 1/3] Fix App crashes when navigating to enable payments page before logging in --- .ruby-version | 1 + src/pages/EnablePayments/EnablePaymentsPage.js | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 000000000000..7213b446aa03 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.6.10 diff --git a/src/pages/EnablePayments/EnablePaymentsPage.js b/src/pages/EnablePayments/EnablePaymentsPage.js index d62099167ced..cda0b5b5d683 100644 --- a/src/pages/EnablePayments/EnablePaymentsPage.js +++ b/src/pages/EnablePayments/EnablePaymentsPage.js @@ -1,5 +1,6 @@ import _ from 'underscore'; import React from 'react'; +import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; import ScreenWrapper from '../../components/ScreenWrapper'; import * as Wallet from '../../libs/actions/Wallet'; @@ -9,6 +10,7 @@ import CONST from '../../CONST'; import userWalletPropTypes from './userWalletPropTypes'; import {withNetwork} from '../../components/OnyxProvider'; import networkPropTypes from '../../components/networkPropTypes'; +import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../../components/withCurrentUserPersonalDetails'; // Steps import OnfidoStep from './OnfidoStep'; @@ -29,11 +31,17 @@ const propTypes = { /** The user's wallet */ userWallet: userWalletPropTypes, + /** Indicates whether the app is loading initial data */ + isLoadingReportData: PropTypes.bool, + ...withLocalizePropTypes, + ...withCurrentUserPersonalDetailsPropTypes, }; const defaultProps = { userWallet: {}, + isLoadingReportData: true, + ...withCurrentUserPersonalDetailsDefaultProps, }; class EnablePaymentsPage extends React.Component { @@ -50,7 +58,7 @@ class EnablePaymentsPage extends React.Component { } render() { - if (_.isEmpty(this.props.userWallet)) { + if (_.isEmpty(this.props.userWallet) || this.props.isLoadingReportData && _.isEmpty(this.props.personalDetails)) { return ; } @@ -94,6 +102,7 @@ EnablePaymentsPage.defaultProps = defaultProps; export default compose( withLocalize, + withCurrentUserPersonalDetails, withOnyx({ userWallet: { key: ONYXKEYS.USER_WALLET, @@ -102,6 +111,9 @@ export default compose( // stored values here. initWithStoredValues: false, }, + isLoadingReportData: { + key: ONYXKEYS.IS_LOADING_REPORT_DATA, + }, }), withNetwork(), )(EnablePaymentsPage); From b8db3e0061ac8676055e08d08425cdd6feab8a58 Mon Sep 17 00:00:00 2001 From: VH Date: Tue, 5 Sep 2023 00:22:14 +0700 Subject: [PATCH 2/3] Fix linter --- src/pages/EnablePayments/EnablePaymentsPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/EnablePayments/EnablePaymentsPage.js b/src/pages/EnablePayments/EnablePaymentsPage.js index cda0b5b5d683..907909bad6c4 100644 --- a/src/pages/EnablePayments/EnablePaymentsPage.js +++ b/src/pages/EnablePayments/EnablePaymentsPage.js @@ -58,7 +58,7 @@ class EnablePaymentsPage extends React.Component { } render() { - if (_.isEmpty(this.props.userWallet) || this.props.isLoadingReportData && _.isEmpty(this.props.personalDetails)) { + if (_.isEmpty(this.props.userWallet) || (this.props.isLoadingReportData && _.isEmpty(this.props.personalDetails))) { return ; } From 4f36effd99b8cc094fb746849619fea10ecb8c76 Mon Sep 17 00:00:00 2001 From: VH Date: Sun, 10 Sep 2023 23:57:07 +0700 Subject: [PATCH 3/3] Remove wrong commit file --- .ruby-version | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 7213b446aa03..000000000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -ruby-2.6.10