Skip to content
47 changes: 34 additions & 13 deletions src/components/WalletStatementModal/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
import React from 'react';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';
import {View} from 'react-native';
import compose from '../../libs/compose';
import withLocalize from '../withLocalize';
import ONYXKEYS from '../../ONYXKEYS';
import {walletStatementPropTypes, walletStatementDefaultProps} from './WalletStatementModalPropTypes';
import styles from '../../styles/styles';
import FullScreenLoadingIndicator from '../FullscreenLoadingIndicator';

const WalletStatementModal = (props) => {
const authToken = lodashGet(props, 'session.authToken', null);
return (
<iframe
src={`${props.statementPageURL}&authToken=${authToken}`}
title="Statements"
height="100%"
width="100%"
seamless="seamless"
frameBorder="0"
/>
);
};
class WalletStatementModal extends React.Component {
constructor(props) {
super(props);

this.state = {
isLoading: true,
};
}

render() {
const authToken = lodashGet(this.props, 'session.authToken', null);
return (
<>
<FullScreenLoadingIndicator
visible={this.state.isLoading}
/>
<View style={[styles.flex1]}>
<iframe
src={`${this.props.statementPageURL}&authToken=${authToken}`}
title="Statements"
height="100%"
width="100%"
seamless="seamless"
frameBorder="0"
onLoad={() => this.setState({isLoading: false})}
/>
</View>
</>
);
}
}

WalletStatementModal.propTypes = walletStatementPropTypes;
WalletStatementModal.defaultProps = walletStatementDefaultProps;
Expand Down
3 changes: 3 additions & 0 deletions src/components/WalletStatementModal/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import withLocalize from '../withLocalize';
import ONYXKEYS from '../../ONYXKEYS';
import compose from '../../libs/compose';
import {walletStatementPropTypes, walletStatementDefaultProps} from './WalletStatementModalPropTypes';
import FullScreenLoadingIndicator from '../FullscreenLoadingIndicator';

const WalletStatementModal = (props) => {
const authToken = lodashGet(props, 'session.authToken', null);
Expand All @@ -19,6 +20,8 @@ const WalletStatementModal = (props) => {
},
}}
incognito // 'incognito' prop required for Android, issue here https://github.com/react-native-webview/react-native-webview/issues/1352
startInLoadingState
renderLoading={() => <FullScreenLoadingIndicator />}
/>
);
};
Expand Down