From 0dc2d1473626d4c17b9e6e9472e6ea0b499aff26 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Mon, 20 Nov 2023 08:13:53 +0500 Subject: [PATCH] mobile: fix crash on pricing plans page on ios --- .../app/components/premium/pricing-item.tsx | 7 ++++--- .../app/components/premium/pricing-plans.tsx | 16 ++++++++-------- apps/mobile/app/screens/settings/subscription.js | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/mobile/app/components/premium/pricing-item.tsx b/apps/mobile/app/components/premium/pricing-item.tsx index 56a2e5e85..a06a6c657 100644 --- a/apps/mobile/app/components/premium/pricing-item.tsx +++ b/apps/mobile/app/components/premium/pricing-item.tsx @@ -70,10 +70,11 @@ export const PricingItem = ({ {Platform.OS === "android" - ? (product.data as RNIap.SubscriptionAndroid) + ? (product.data as RNIap.SubscriptionAndroid | undefined) ?.subscriptionOfferDetails[0].pricingPhases - .pricingPhaseList?.[0].formattedPrice - : (product.data as RNIap.SubscriptionIOS)?.localizedPrice} + .pricingPhaseList?.[0]?.formattedPrice + : (product.data as RNIap.SubscriptionIOS | undefined) + ?.localizedPrice} {product?.type === "yearly" || product?.offerType === "yearly" ? "/year" diff --git a/apps/mobile/app/components/premium/pricing-plans.tsx b/apps/mobile/app/components/premium/pricing-plans.tsx index c22ca30e8..c7be83ffd 100644 --- a/apps/mobile/app/components/premium/pricing-plans.tsx +++ b/apps/mobile/app/components/premium/pricing-plans.tsx @@ -245,12 +245,12 @@ export const PricingPlans = ({ size={SIZE.lg} > {(Platform.OS === "android" - ? (monthlyPlan?.product as RNIap.SubscriptionAndroid) - ?.subscriptionOfferDetails[0].pricingPhases - .pricingPhaseList?.[0].formattedPrice - : (monthlyPlan?.product as RNIap.SubscriptionIOS) - .localizedPrice) || - (PremiumService.getMontlySub() as any).localizedPrice} + ? (monthlyPlan?.product as RNIap.SubscriptionAndroid | undefined) + ?.subscriptionOfferDetails[0]?.pricingPhases + .pricingPhaseList?.[0]?.formattedPrice + : (monthlyPlan?.product as RNIap.SubscriptionIOS | undefined) + ?.localizedPrice) || + (PremiumService.getMontlySub() as any)?.localizedPrice} / mo