Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/FullscreenLoadingIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type FullScreenLoadingIndicatorProps = {
style?: StyleProp<ViewStyle>;
iconSize?: FullScreenLoadingIndicatorIconSize;

/** Whether the "Go Back" button appears after a timeout. */
/** Whether the "Go Back" button appears after a timeout. Defaults to true, pass false where going back is dead or harmful (e.g. global overlays, or a transition that is mid sign-out). */
shouldUseGoBackButton?: boolean;

onGoBack?: () => void;
Expand All @@ -35,7 +35,7 @@ type FullScreenLoadingIndicatorProps = {
function FullScreenLoadingIndicator({
style,
iconSize = CONST.ACTIVITY_INDICATOR_SIZE.LARGE,
shouldUseGoBackButton = false,
shouldUseGoBackButton = true,
onGoBack = Navigation.goBack,
testID = '',
extraLoadingContext,
Expand Down
3 changes: 2 additions & 1 deletion src/libs/Navigation/AppNavigator/DelegatorConnectGate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ function DelegatorConnectGuard({children}: {children: React.ReactNode}) {
}

return (
<Suspense fallback={<FullScreenLoadingIndicator />}>
// No "Go Back" button: this fallback replaces the whole AuthScreens navigator while connect() clears Onyx, so there is no screen to go back to.
<Suspense fallback={<FullScreenLoadingIndicator shouldUseGoBackButton={false} />}>
<DelegatorConnectGate delegatorEmail={delegatorEmail}>{children}</DelegatorConnectGate>
</Suspense>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AvatarCropPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function AvatarCropPage() {
);

if (isLoadingDraft || !draft?.uri) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

const onSave = (image: File | CustomRNImageManipulatorResult) => {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/LogInWithShortLivedAuthTokenPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ function LogInWithShortLivedAuthTokenPage({route}: LogInWithShortLivedAuthTokenP
}, [route, isLoadingSignInData]);

if (account?.isLoading || isLoadingSignInData) {
return <FullScreenLoadingIndicator />;
// No "Go Back" button: this is a deep-link entry point, so there is usually no history to pop back to.
return <FullScreenLoadingIndicator shouldUseGoBackButton={false} />;
}

return <SessionExpiredPage />;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/LogOutPreviousUserPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ function LogOutPreviousUserPage({route}: LogOutPreviousUserPageProps) {
return <NotFoundPage />;
}

return <FullScreenLoadingIndicator />;
// No "Go Back" button: going back would pop /transition into the outgoing user's session mid sign-out.
return <FullScreenLoadingIndicator shouldUseGoBackButton={false} />;
}

export default LogOutPreviousUserPage;
1 change: 0 additions & 1 deletion src/pages/PreMountBufferPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Navigation from '@libs/Navigation/Navigation';
function PreMountBufferPage() {
return (
<FullscreenLoadingIndicator
shouldUseGoBackButton
onGoBack={Navigation.recoverFromPreMountBuffer}
extraLoadingContext={{context: 'PreMountBufferPage'}}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReimbursementAccount/EnterSignerInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function EnterSignerInfo({route}: EnterSignerInfoProps) {
}, [isEditing, moveTo, pageIndex, prevPage]);

if (isRedirecting) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen
}

if (isLoadingPolicy) {
return <FullScreenLoadingIndicator />;
return <FullScreenLoadingIndicator onGoBack={() => Navigation.goBack(backTo)} />;
}

// Show loading indicator when page is first time being opened and props.reimbursementAccount yet to be loaded from the server
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Search/SearchChangeApproverPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ function SearchChangeApproverPage() {
);

if (!isOffline && isLoadingBulkChangeApproverPage) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Search/SearchColumnsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function SearchColumnsPage() {
};

if (isSeedPending) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function DynamicConfirmationPage() {
(reviewDuplicatesResult.status === 'loaded' && (!newTransaction?.transactionID || !doesTransactionBelongToReport));

if (isLoadingOnyxValue(reviewDuplicatesResult, reportResult) || !newTransaction?.transactionID) {
return <FullScreenLoadingIndicator />;
return <FullScreenLoadingIndicator onGoBack={() => Navigation.goBack(backPath, {compareParams: false})} />;
}

return (
Expand Down
3 changes: 2 additions & 1 deletion src/pages/UnlinkLoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ function UnlinkLoginPage({route}: UnlinkLoginPageProps) {
};
}, [prevIsLoading, account?.isLoading]);

return <FullScreenLoadingIndicator />;
// No "Go Back" button: this is a deep-link entry point, so there is usually no history to pop back to.
return <FullScreenLoadingIndicator shouldUseGoBackButton={false} />;
}

export default UnlinkLoginPage;
3 changes: 2 additions & 1 deletion src/pages/ValidateLoginPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ function ValidateLoginPage({
});
}, [session?.autoAuthState]);

return <FullScreenLoadingIndicator />;
// No "Go Back" button: this is a deep-link entry point, so there is usually no history to pop back to.
return <FullScreenLoadingIndicator shouldUseGoBackButton={false} />;
}

export default ValidateLoginPage;
6 changes: 5 additions & 1 deletion src/pages/ValidateLoginPage/index.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ function ValidateLoginPage({
/>
)}
{((!effectiveAutoAuthState ? shouldStartSignInWithValidateCode : autoAuthStateWithDefault === CONST.AUTO_AUTH_STATE.SIGNING_IN) || isCompletingDirectSignIn) && (
<FullScreenLoadingIndicator testID="validate-login-loading" />
<FullScreenLoadingIndicator
// No "Go Back" button: this is a deep-link entry point, so there is usually no history to pop back to.
shouldUseGoBackButton={false}
testID="validate-login-loading"
/>
)}
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/domain/DomainAccessRestrictedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function DomainAccessRestrictedPage({route}: DomainAccessRestrictedPageProps) {
}, [domainAccountID]);

if (isRedirecting) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/domain/DomainAlreadyExistsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function DomainAlreadyExistsPage({route}: DomainAlreadyExistsPageProps) {
}, [domainAccountID]);

if (isRedirecting) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/domain/DomainNameOrNotFoundWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function DomainNameOrNotFoundWrapper({domainAccountID, onLinkPress, children}: D
const [domainName, domainNameResult] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`, {selector: domainNameSelector});

if (isLoadingOnyxValue(domainNameResult)) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

if (!domainName) {
Expand Down
4 changes: 3 additions & 1 deletion src/pages/domain/DomainNotFoundPageWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator';

import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useOnyx from '@hooks/useOnyx';
import useResponsiveLayout from '@hooks/useResponsiveLayout';

import Navigation from '@navigation/Navigation';

Expand Down Expand Up @@ -33,6 +34,7 @@ function DomainNotFoundPageWrapper({domainAccountID, shouldBeBlocked, fullPageNo
});
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const isAdmin = adminAccountIDs?.includes(currentUserAccountID);
const {shouldUseNarrowLayout} = useResponsiveLayout();

const shouldShowFullScreenLoadingIndicator = isLoadingOnyxValue(domainMetadata);
const shouldShowNotFoundPage = !domain || !isAdmin || shouldBeBlocked;
Expand All @@ -46,7 +48,7 @@ function DomainNotFoundPageWrapper({domainAccountID, shouldBeBlocked, fullPageNo
}, [domain, isAdmin, shouldShowFullScreenLoadingIndicator]);

if (shouldShowFullScreenLoadingIndicator) {
return <FullscreenLoadingIndicator />;
return <FullscreenLoadingIndicator shouldUseGoBackButton={shouldUseNarrowLayout} />;
}

if (shouldShowNotFoundPage) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/domain/DomainSamlPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function DomainSamlPage({route}: DomainSamlPageProps) {
);

if (isLoadingOnyxValue(domainResults, domainSettingsResults)) {
return <FullScreenLoadingIndicator />;
return <FullScreenLoadingIndicator shouldUseGoBackButton={shouldUseNarrowLayout} />;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/inbox/report/withReportOrNotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default function (shouldRequireReportID = true): <TProps extends WithRepo
}

if (decision === 'loading') {
return <FullscreenLoadingIndicator shouldUseGoBackButton />;
return <FullscreenLoadingIndicator />;
}

if (decision === 'notFound') {
Expand Down
7 changes: 6 additions & 1 deletion src/pages/iou/DynamicSplitExpensePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,12 @@ function DynamicSplitExpensePage({route}: DynamicSplitExpensePageProps) {
};

if (isLoadingDraftTransaction) {
return <FullScreenLoadingIndicator style={[styles.opacity1]} />;
return (
<FullScreenLoadingIndicator
style={[styles.opacity1]}
onGoBack={() => Navigation.goBack(backPath)}
/>
);
}

const collapsibleHeaderOffset = isInitialSplit ? TAB_NAVIGATOR_HEIGHT_LANDSCAPE : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ function IOURequestStepConfirmationContent({
<ActivityIndicator size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE} />
</View>
) : (
<FullScreenLoadingIndicator shouldUseGoBackButton />
<FullScreenLoadingIndicator onGoBack={navigateBack} />
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function WithFullTransactionOrNotFoundImpl<TProps extends WithFullTransactionOrN
<ActivityIndicator size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE} />
</View>
) : (
<FullScreenLoadingIndicator shouldUseGoBackButton />
<FullScreenLoadingIndicator />
);
}
return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Agents/AddAgentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function AddAgentPage({route}: AddAgentPageProps) {
const [template, templateMetadata] = useOnyx(ONYXKEYS.NEW_AGENT_TEMPLATE);

if (isLoadingOnyxValue(templateMetadata)) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function DynamicContactMethodDetailsPage({route}: DynamicContactMethodDetailsPag
}, [isValidateCodeFormVisible, translate, turnOnDeleteModal, isDefaultContactMethod, icons.Trashcan]);

if (isLoadingOnyxValues || (isLoadingReportData && isEmptyObject(loginList))) {
return <FullscreenLoadingIndicator />;
return <FullscreenLoadingIndicator onGoBack={() => Navigation.goBack(listPath)} />;
}

if (!contactMethod || !loginData) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Profile/CustomStatus/SetDatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function SetDatePage() {
const isLoadingStatusDraft = isLoadingOnyxValue(statusDraftCustomClearAfterDateMetaData);

if (isLoadingStatusDraft) {
return <FullScreenLoadingIndicator />;
return <FullScreenLoadingIndicator onGoBack={() => Navigation.goBack(ROUTES.SETTINGS_STATUS_CLEAR_AFTER)} />;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function VacationDelegateMissingWorkspacesPage() {
});

if (!submittedInput && isLoadingOnyxValue(vacationDelegateMetadata)) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator onGoBack={() => Navigation.goBack(ROUTES.SETTINGS_VACATION_DELEGATE)} />;
}

if (!policyDiff) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function PrivatePersonalDetailsPage() {
};

if (isLoadingApp) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ function SubscriptionSettingsPage({route}: SubscriptionSettingsPageProps) {
}, [isAppLoading, shouldShowPage, isFocused]);

if (!shouldShowPage && isAppLoading) {
return <FullScreenLoadingIndicator />;
return (
<FullScreenLoadingIndicator
shouldUseGoBackButton={shouldUseNarrowLayout}
onGoBack={() => Navigation.goBack(backTo)}
/>
);
}

if (!shouldShowPage) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Wallet/AddCardToDigitalWalletPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function AddCardToDigitalWalletPage({
const isWaitingForPendingApproval = !isOffline && isCheckingPendingApproval !== false && !hasPendingApproval && !submittedRequest;

if (isWaitingForPendingApproval || (!card && isLoadingOnyxValue(cardMetadata))) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator onGoBack={goBackToEntryPoint} />;
}

if (!card || (!hasPendingApproval && !submittedRequest)) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Wallet/ChooseTransferAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function ChooseTransferAccountPage() {
};

if (isLoadingOnyxValue(walletTransferResult)) {
return <FullscreenLoadingIndicator />;
return <FullscreenLoadingIndicator onGoBack={() => Navigation.goBack(ROUTES.SETTINGS_WALLET_TRANSFER_BALANCE)} />;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function InternationalDepositAccountContent({
shouldShowOfflineIndicatorInWideScreen={pageIndex === CONST.CORPAY_FIELDS.INDEXES.MAPPING.CONFIRMATION}
>
{isRedirecting || isAccountLoading ? (
<FullScreenLoadingIndicator />
<FullScreenLoadingIndicator onGoBack={handleBackButtonPress} />
) : (
<>
<HeaderWithBackButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function AddPersonalNewCardPage() {
}, []);

if (isAddCardFeedLoading) {
return <FullScreenLoadingIndicator shouldUseGoBackButton />;
return <FullScreenLoadingIndicator />;
}

let CurrentStep: React.JSX.Element;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tasks/DynamicNewTaskDescriptionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function DynamicNewTaskDescriptionPage() {
};

if (isLoadingOnyxValue(taskMetadata)) {
return <FullScreenLoadingIndicator />;
return <FullScreenLoadingIndicator onGoBack={goBack} />;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tasks/DynamicNewTaskTitlePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function DynamicNewTaskTitlePage() {
};

if (isLoadingOnyxValue(taskMetadata)) {
return <FullScreenLoadingIndicator />;
return <FullScreenLoadingIndicator onGoBack={goBack} />;
}

return (
Expand Down
5 changes: 3 additions & 2 deletions src/pages/workspace/AccessOrNotFoundWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ function AccessOrNotFoundWrapper({
const pendingField = featureName ? policy?.pendingFields?.[featureName] : undefined;
const isFocused = useIsFocused();
const isWorkspacesTabFocused = useIsWorkspacesTabFocused();
const {shouldUseNarrowLayout} = useResponsiveLayout();

useEffect(() => {
if (!isPolicyIDInRoute || !isEmptyObject(policy)) {
Expand Down Expand Up @@ -250,12 +251,12 @@ function AccessOrNotFoundWrapper({
}, [isLoadingReportData, isPolicyNotAccessible]);

if (shouldShowFullScreenLoadingIndicator) {
return <FullscreenLoadingIndicator />;
return <FullscreenLoadingIndicator shouldUseGoBackButton={shouldUseNarrowLayout} />;
}
// The feature linked to this page is disabled, so the redirect effect above will navigate to the More Features page.
// Render a loader instead of the page's children so the disabled page is never shown for a frame (avoids a visible flash).
if (shouldRedirectToMoreFeatures) {
return <FullscreenLoadingIndicator shouldUseGoBackButton />;
return <FullscreenLoadingIndicator shouldUseGoBackButton={shouldUseNarrowLayout} />;
}
if (shouldShowNotFoundPage) {
return (
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/DynamicWorkspaceInvitePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,9 @@ function DynamicWorkspaceInvitePageContent({route, policy, invitedEmailsToAccoun
function DynamicWorkspaceInvitePage(props: WorkspaceInvitePageProps) {
const [policy, policyMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${props.route.params.policyID}`);
const [invitedEmailsToAccountIDsDraft, invitedEmailsToAccountIDsDraftMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${props.route.params.policyID}`);
const dynamicBackPath = useDynamicBackPath(DYNAMIC_ROUTES.WORKSPACE_INVITE.path);
if (isLoadingOnyxValue(policyMetadata, invitedEmailsToAccountIDsDraftMetadata)) {
return <FullscreenLoadingIndicator />;
return <FullscreenLoadingIndicator onGoBack={() => Navigation.goBack(dynamicBackPath)} />;
}
return (
<DynamicWorkspaceInvitePageContent
Expand Down
Loading
Loading