Skip to content

Commit

Permalink
add suggested changes.
Browse files Browse the repository at this point in the history
Signed-off-by: krishna2323 <[email protected]>
  • Loading branch information
Krishna2323 committed Jul 15, 2024
1 parent 518f36d commit 08c4a55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/pages/settings/Subscription/SubscriptionSize/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {StackScreenProps} from '@react-navigation/stack';
import React from 'react';
import {InteractionManager} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
Expand Down Expand Up @@ -31,9 +30,7 @@ function SubscriptionSizePage({route}: SubscriptionSizePageProps) {
const onFinished = () => {
Subscription.updateSubscriptionSize(subscriptionSizeFormDraft ? Number(subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE]) : 0, privateSubscription?.userCount ?? 0);
Navigation.goBack();
InteractionManager.runAfterInteractions(() => {
FormActions.clearDraftValues(ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM);
});
FormActions.clearDraftValues(ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM);
};

const {componentToRender: SubStep, screenIndex, nextScreen, prevScreen, moveTo} = useSubStep({bodyContent, startFrom, onFinished});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function Confirmation({onNext, isEditing}: ConfirmationProps) {
const [subscriptionSizeFormDraft] = useOnyx(ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM_DRAFT);
const subscriptionRenewalDate = getNewSubscriptionRenewalDate();
const subscriptionSizeDraft = subscriptionSizeFormDraft ? Number(subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE]) : 0;
const subscriptionSize = subscriptionSizeDraft || (privateSubscription?.userCount ?? 0);

const isTryingToIncreaseSubscriptionSize = subscriptionSizeDraft > (privateSubscription?.userCount ?? 0);
const canChangeSubscriptionSize = (account?.canDowngrade ?? false) || (isTryingToIncreaseSubscriptionSize && isEditing);
Expand All @@ -42,7 +43,7 @@ function Confirmation({onNext, isEditing}: ConfirmationProps) {
<MenuItemWithTopDescription
interactive={false}
description={translate('subscription.subscriptionSize.subscriptionSize')}
title={translate('subscription.subscriptionSize.activeMembers', {size: subscriptionSizeDraft})}
title={translate('subscription.subscriptionSize.activeMembers', {size: subscriptionSize})}
/>
<MenuItemWithTopDescription
interactive={false}
Expand Down

0 comments on commit 08c4a55

Please sign in to comment.