File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
src/pages/settings/Payments/PaymentsPage Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import * as Expensicons from '../../../../components/Icon/Expensicons';
30
30
import ConfirmModal from '../../../../components/ConfirmModal' ;
31
31
import KYCWall from '../../../../components/KYCWall' ;
32
32
import { propTypes , defaultProps } from './paymentsPagePropTypes' ;
33
+ import { withNetwork } from '../../../../components/OnyxProvider' ;
33
34
34
35
class BasePaymentsPage extends React . Component {
35
36
constructor ( props ) {
@@ -60,12 +61,20 @@ class BasePaymentsPage extends React.Component {
60
61
}
61
62
62
63
componentDidMount ( ) {
63
- PaymentMethods . getPaymentMethods ( ) ;
64
+ this . fetchData ( ) ;
64
65
if ( this . props . shouldListenForResize ) {
65
66
this . dimensionsSubscription = Dimensions . addEventListener ( 'change' , this . setMenuPosition ) ;
66
67
}
67
68
}
68
69
70
+ componentDidUpdate ( prevProps ) {
71
+ if ( ! prevProps . network . isOffline || this . props . network . isOffline ) {
72
+ return ;
73
+ }
74
+
75
+ this . fetchData ( ) ;
76
+ }
77
+
69
78
componentWillUnmount ( ) {
70
79
if ( ! this . props . shouldListenForResize || ! this . dimensionsSubscription ) {
71
80
return ;
@@ -186,6 +195,10 @@ class BasePaymentsPage extends React.Component {
186
195
throw new Error ( 'Invalid payment method type selected' ) ;
187
196
}
188
197
198
+ fetchData ( ) {
199
+ PaymentMethods . getPaymentMethods ( ) ;
200
+ }
201
+
189
202
/**
190
203
* Hide the add payment modal
191
204
*/
@@ -432,6 +445,7 @@ BasePaymentsPage.defaultProps = defaultProps;
432
445
export default compose (
433
446
withWindowDimensions ,
434
447
withLocalize ,
448
+ withNetwork ( ) ,
435
449
withOnyx ( {
436
450
betas : {
437
451
key : ONYXKEYS . BETAS ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
2
2
import walletTransferPropTypes from '../walletTransferPropTypes' ;
3
3
import { withLocalizePropTypes } from '../../../../components/withLocalize' ;
4
4
import { windowDimensionsPropTypes } from '../../../../components/withWindowDimensions' ;
5
+ import networkPropTypes from '../../../../components/networkPropTypes' ;
5
6
6
7
const propTypes = {
7
8
/** Wallet balance transfer props */
@@ -22,6 +23,9 @@ const propTypes = {
22
23
currentBalance : PropTypes . number ,
23
24
} ) ,
24
25
26
+ /** Information about the network */
27
+ network : networkPropTypes . isRequired ,
28
+
25
29
...withLocalizePropTypes ,
26
30
27
31
...windowDimensionsPropTypes ,
You can’t perform that action at this time.
0 commit comments