From f04644fb75fbc1df601d19a1d010fbf35fa77bee Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sat, 24 Aug 2024 03:45:54 +0530 Subject: [PATCH 1/3] fix: Subscription - Clicking Outside the Modal Doesn't Close It, Causing Inconsistency. Signed-off-by: krishna2323 --- .../AddPaymentCard/PaymentCardCurrencyModal.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx b/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx index c3c38c4aec72..cd9bf222aec1 100644 --- a/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx +++ b/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx @@ -1,4 +1,5 @@ -import React, {useMemo} from 'react'; +import {useIsFocused} from '@react-navigation/native'; +import React, {useEffect, useMemo} from 'react'; import type {ValueOf} from 'type-fest'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import Modal from '@components/Modal'; @@ -8,6 +9,7 @@ import RadioListItem from '@components/SelectionList/RadioListItem'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import Navigation from '@libs/Navigation/Navigation'; import CONST from '@src/CONST'; type PaymentCardCurrencyModalProps = { @@ -47,6 +49,14 @@ function PaymentCardCurrencyModal({isVisible, currencies, currentCurrency = CONS [currencies, currentCurrency], ); + const isFocused = useIsFocused(); + useEffect(() => { + if (isFocused) { + return; + } + onClose?.(); + }, [isFocused, onClose]); + return ( { + Navigation.dismissModal(); + }} useNativeDriver > Date: Sat, 24 Aug 2024 03:55:59 +0530 Subject: [PATCH 2/3] minor fix. Signed-off-by: krishna2323 --- .../AddPaymentCard/PaymentCardCurrencyModal.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx b/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx index cd9bf222aec1..a67a8e63cc96 100644 --- a/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx +++ b/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx @@ -1,5 +1,4 @@ -import {useIsFocused} from '@react-navigation/native'; -import React, {useEffect, useMemo} from 'react'; +import React, {useMemo} from 'react'; import type {ValueOf} from 'type-fest'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import Modal from '@components/Modal'; @@ -49,14 +48,6 @@ function PaymentCardCurrencyModal({isVisible, currencies, currentCurrency = CONS [currencies, currentCurrency], ); - const isFocused = useIsFocused(); - useEffect(() => { - if (isFocused) { - return; - } - onClose?.(); - }, [isFocused, onClose]); - return ( { Navigation.dismissModal(); + setTimeout(() => { + onClose?.(); + }, 50); }} useNativeDriver > From 55929c252fb129cd5813bec5090c348dba8704fe Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Wed, 28 Aug 2024 04:41:09 +0530 Subject: [PATCH 3/3] remove setTimeout. Signed-off-by: krishna2323 --- src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx b/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx index a67a8e63cc96..dc27f115dc05 100644 --- a/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx +++ b/src/components/AddPaymentCard/PaymentCardCurrencyModal.tsx @@ -56,12 +56,7 @@ function PaymentCardCurrencyModal({isVisible, currencies, currentCurrency = CONS onModalHide={onClose} hideModalContentWhileAnimating innerContainerStyle={styles.RHPNavigatorContainer(isSmallScreenWidth)} - onBackdropPress={() => { - Navigation.dismissModal(); - setTimeout(() => { - onClose?.(); - }, 50); - }} + onBackdropPress={Navigation.dismissModal} useNativeDriver >