Skip to content

Commit c9d3e92

Browse files
authored
Merge pull request Expensify#88739 from Expensify/claude-useActivityIndicatorInWalletStatementModal
Replace FullscreenLoadingIndicator with ActivityIndicator in WalletStatementModal
2 parents c2ac449 + 5efb1f7 commit c9d3e92

2 files changed

Lines changed: 43 additions & 25 deletions

File tree

src/components/WalletStatementModal/index.native.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import {hasSeenTourSelector} from '@selectors/Onboarding';
22
import React, {useRef} from 'react';
3+
import {StyleSheet, View} from 'react-native';
34
import type {WebViewMessageEvent, WebViewNavigation} from 'react-native-webview';
45
import {WebView} from 'react-native-webview';
56
import type {ValueOf} from 'type-fest';
6-
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
7+
import ActivityIndicator from '@components/ActivityIndicator';
78
import useOnyx from '@hooks/useOnyx';
8-
import type CONST from '@src/CONST';
9+
import useThemeStyles from '@hooks/useThemeStyles';
10+
import CONST from '@src/CONST';
911
import ONYXKEYS from '@src/ONYXKEYS';
1012
import type {WalletStatementProps} from './types';
1113
import handleWalletStatementNavigation from './walletNavigationUtils';
@@ -14,9 +16,8 @@ type WebViewMessageType = ValueOf<typeof CONST.WALLET.WEB_MESSAGE_TYPE>;
1416

1517
type WebViewNavigationEvent = WebViewNavigation & {type?: WebViewMessageType};
1618

17-
const renderLoading = () => <FullScreenLoadingIndicator reasonAttributes={{context: 'WalletStatementModal'}} />;
18-
1919
function WalletStatementModal({statementPageURL}: WalletStatementProps) {
20+
const styles = useThemeStyles();
2021
const [session] = useOnyx(ONYXKEYS.SESSION);
2122
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
2223
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
@@ -27,6 +28,15 @@ function WalletStatementModal({statementPageURL}: WalletStatementProps) {
2728

2829
const authToken = session?.authToken ?? null;
2930

31+
const renderLoading = () => (
32+
<View style={[StyleSheet.absoluteFill, styles.fullScreenLoading]}>
33+
<ActivityIndicator
34+
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
35+
reasonAttributes={{context: 'WalletStatementModal'}}
36+
/>
37+
</View>
38+
);
39+
3040
const onMessage = (event: WebViewMessageEvent) => {
3141
let parsedData: WebViewNavigationEvent | null = null;
3242
try {

src/components/WalletStatementModal/index.tsx

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {hasSeenTourSelector} from '@selectors/Onboarding';
22
import React, {useCallback, useEffect, useRef, useState} from 'react';
3-
import {View} from 'react-native';
4-
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
3+
import {StyleSheet, View} from 'react-native';
4+
import ActivityIndicator from '@components/ActivityIndicator';
55
import useOnyx from '@hooks/useOnyx';
66
import useThemeStyles from '@hooks/useThemeStyles';
7+
import CONST from '@src/CONST';
78
import ONYXKEYS from '@src/ONYXKEYS';
89
import type {WalletStatementMessage, WalletStatementProps} from './types';
910
import handleWalletStatementNavigation from './walletNavigationUtils';
@@ -37,26 +38,33 @@ function WalletStatementModal({statementPageURL}: WalletStatementProps) {
3738
}, [navigate]);
3839

3940
return (
40-
<>
41-
{isLoading && <FullScreenLoadingIndicator reasonAttributes={{context: 'WalletStatementModal'}} />}
42-
<View style={[styles.flex1]}>
43-
<iframe
44-
src={`${statementPageURL}&authToken=${authToken}`}
45-
title="Statements"
46-
height="100%"
47-
width="100%"
48-
seamless
49-
frameBorder="0"
50-
onLoad={() => {
51-
setIsLoading(false);
41+
<View style={styles.flex1}>
42+
{isLoading && (
43+
<View style={[StyleSheet.absoluteFill, styles.fullScreenLoading]}>
44+
<ActivityIndicator
45+
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
46+
reasonAttributes={{context: 'WalletStatementModal'}}
47+
/>
48+
</View>
49+
)}
50+
<iframe
51+
src={`${statementPageURL}&authToken=${authToken}`}
52+
title="Statements"
53+
height="100%"
54+
width="100%"
55+
seamless
56+
// frameBorder is deprecated in HTML5 but needed for consistent cross-browser iframe border removal
57+
// eslint-disable-next-line @typescript-eslint/no-deprecated
58+
frameBorder="0"
59+
onLoad={() => {
60+
setIsLoading(false);
5261

53-
// We listen to a message sent from the iframe to the parent component when a link is clicked.
54-
// This lets us handle navigation in the app, outside of the iframe.
55-
window.onmessage = (event: MessageEvent<WalletStatementMessage>) => navigateRef.current?.(event);
56-
}}
57-
/>
58-
</View>
59-
</>
62+
// We listen to a message sent from the iframe to the parent component when a link is clicked.
63+
// This lets us handle navigation in the app, outside of the iframe.
64+
window.onmessage = (event: MessageEvent<WalletStatementMessage>) => navigateRef.current?.(event);
65+
}}
66+
/>
67+
</View>
6068
);
6169
}
6270

0 commit comments

Comments
 (0)