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/libs/actions/Policy/Category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ function deleteWorkspaceCategories(policyID: string, categoryNamesToDelete: stri
API.write(WRITE_COMMANDS.DELETE_WORKSPACE_CATEGORIES, parameters, onyxData);
}

function enablePolicyCategories(policyID: string, enabled: boolean) {
function enablePolicyCategories(policyID: string, enabled: boolean, shouldNavigate = true) {
const onyxUpdatesToDisableCategories: OnyxUpdate[] = [];
if (!enabled) {
onyxUpdatesToDisableCategories.push(
Expand Down Expand Up @@ -1017,7 +1017,7 @@ function enablePolicyCategories(policyID: string, enabled: boolean) {

API.write(WRITE_COMMANDS.ENABLE_POLICY_CATEGORIES, parameters, onyxData);

if (enabled && getIsNarrowLayout()) {
if (enabled && getIsNarrowLayout() && shouldNavigate) {
navigateWhenEnableFeature(policyID);
}
}
Expand Down
23 changes: 14 additions & 9 deletions src/pages/iou/request/step/IOURequestStepCategory.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import lodashIsEmpty from 'lodash/isEmpty';
import React, {useEffect} from 'react';
import {ActivityIndicator, View} from 'react-native';
import {ActivityIndicator, InteractionManager, View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView';
import Button from '@components/Button';
Expand Down Expand Up @@ -167,14 +167,19 @@ function IOURequestStepCategory({
large
success
style={[styles.w100]}
onPress={() =>
Navigation.navigate(
ROUTES.SETTINGS_CATEGORIES_ROOT.getRoute(
policy?.id ?? '-1',
ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(action, iouType, transactionID, report?.reportID ?? '-1', backTo, reportActionID),
),
)
}
onPress={() => {
if (!policy?.areCategoriesEnabled) {
Category.enablePolicyCategories(policy?.id ?? '-1', true, false);
}
InteractionManager.runAfterInteractions(() => {
Navigation.navigate(
ROUTES.SETTINGS_CATEGORIES_ROOT.getRoute(
policy?.id ?? '-1',
ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(action, iouType, transactionID, report?.reportID ?? '-1', backTo, reportActionID),
),
);
});
}}
text={translate('workspace.categories.editCategories')}
pressOnEnter
/>
Expand Down
1 change: 1 addition & 0 deletions src/pages/iou/request/step/IOURequestStepUpgrade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function IOURequestStepUpgrade({
searchText: policyDataRef.current?.policyName,
},
]);
Navigation.goBack();
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(action, CONST.IOU.TYPE.SUBMIT, transactionID, policyDataRef.current?.expenseChatReportID ?? '-1'));
}}
policyName=""
Expand Down