From 822f431b2311b284fb9982c6871560dfbc7ba1a2 Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Mon, 28 Aug 2023 10:59:30 +0200 Subject: [PATCH 1/4] Rewrite to functional component --- src/components/WalletStatementModal/index.js | 60 +++++++++----------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/src/components/WalletStatementModal/index.js b/src/components/WalletStatementModal/index.js index cd6ce783acc1..601f5cc90aa7 100644 --- a/src/components/WalletStatementModal/index.js +++ b/src/components/WalletStatementModal/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useState} from 'react'; import {withOnyx} from 'react-native-onyx'; import lodashGet from 'lodash/get'; import {View} from 'react-native'; @@ -13,21 +13,16 @@ import ROUTES from '../../ROUTES'; import Navigation from '../../libs/Navigation/Navigation'; import * as Report from '../../libs/actions/Report'; -class WalletStatementModal extends React.Component { - constructor(props) { - super(props); - - this.state = { - isLoading: true, - }; - } +function WalletStatementModal({statementPageURL, session}) { + const [isLoading, setIsLoading] = useState(true); + const authToken = lodashGet(session, 'authToken', null); /** * Handles in-app navigation for iframe links * * @param {MessageEvent} e */ - navigate(e) { + const navigate = (e) => { if (!e.data || !e.data.type || (e.data.type !== 'STATEMENT_NAVIGATE' && e.data.type !== 'CONCIERGE_NAVIGATE')) { return; } @@ -45,31 +40,28 @@ class WalletStatementModal extends React.Component { } } - render() { - const authToken = lodashGet(this.props, 'session.authToken', null); - return ( - <> - {this.state.isLoading && } - -