Skip to content

Commit

Permalink
use ActivityIndicator
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Feb 28, 2024
1 parent fedb40d commit f3faf18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import type {
DeleteWorkspaceAvatarParams,
DeleteWorkspaceParams,
OpenDraftWorkspaceRequestParams,
OpenPolicyCategoriesPageParams,
OpenWorkspaceInvitePageParams,
OpenWorkspaceMembersPageParams,
OpenPolicyCategoriesPageParams,
OpenWorkspaceParams,
OpenWorkspaceReimburseViewParams,
SetWorkspaceApprovalModeParams,
Expand Down
20 changes: 11 additions & 9 deletions src/pages/workspace/categories/WorkspaceCategoriesPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {StackScreenProps} from '@react-navigation/stack';
import React, {useMemo, useState, useEffect} from 'react';
import {View} from 'react-native';
import React, {useEffect, useMemo, useState} from 'react';
import {ActivityIndicator, View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import Button from '@components/Button';
Expand All @@ -21,12 +21,12 @@ import Navigation from '@libs/Navigation/Navigation';
import type {CentralPaneNavigatorParamList} from '@navigation/types';
import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper';
import PaidPolicyAccessOrNotFoundWrapper from '@pages/workspace/PaidPolicyAccessOrNotFoundWrapper';
import * as Policy from '@userActions/Policy';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import type * as OnyxTypes from '@src/types/onyx';
import * as Policy from '@userActions/Policy';
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';

type PolicyForList = {
value: string;
Expand Down Expand Up @@ -112,10 +112,6 @@ function WorkspaceCategoriesPage({policyCategories, route}: WorkspaceCategoriesP
</View>
);

if (policyCategories === undefined) {
return <FullScreenLoadingIndicator />;
}

return (
<AdminPolicyAccessOrNotFoundWrapper policyID={route.params.policyID}>
<PaidPolicyAccessOrNotFoundWrapper policyID={route.params.policyID}>
Expand All @@ -136,7 +132,13 @@ function WorkspaceCategoriesPage({policyCategories, route}: WorkspaceCategoriesP
<View style={[styles.ph5, styles.pb5]}>
<Text style={[styles.textNormal, styles.colorMuted]}>{translate('workspace.categories.subtitle')}</Text>
</View>
{categoryList.length ? (
{policyCategories === undefined ? (

Check failure on line 135 in src/pages/workspace/categories/WorkspaceCategoriesPage.tsx

View workflow job for this annotation

GitHub Actions / lint

Do not nest ternary expressions
<ActivityIndicator
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
style={[styles.flex1]}
color={theme.textSupporting}
/>
) : categoryList.length ? (
<SelectionList
canSelectMultiple
sections={[{data: categoryList, indexOffset: 0, isDisabled: false}]}
Expand Down

0 comments on commit f3faf18

Please sign in to comment.