From e5840c6c13200dd1ea4a91122fbd6d998a2d6a46 Mon Sep 17 00:00:00 2001 From: Prajjaval Verma Date: Wed, 10 Apr 2024 13:48:48 +0530 Subject: [PATCH] TP-59414 | HandleClick Errors | Bottom Sheet Animation Time (#10373) --- .../quote-offer-screen/QuoteOfferScreen.tsx | 3 ++- App/common/constants/NumericalConstants.ts | 3 ++- .../bottomsheet/BaseBottomSheetComponent.tsx | 7 ++++--- .../grid-with-card-widget/GridWithCardWidget.tsx | 6 +----- components/widgets/title-widget/TitleWidget.tsx | 16 ++++++---------- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/App/Container/Navi-Insurance/screen/quote-offer-screen/QuoteOfferScreen.tsx b/App/Container/Navi-Insurance/screen/quote-offer-screen/QuoteOfferScreen.tsx index 5de1b9583c..457f8c6b62 100644 --- a/App/Container/Navi-Insurance/screen/quote-offer-screen/QuoteOfferScreen.tsx +++ b/App/Container/Navi-Insurance/screen/quote-offer-screen/QuoteOfferScreen.tsx @@ -171,7 +171,8 @@ const QuoteOfferScreen = ({ screenData?.screenState !== ScreenState.ERROR && screenData?.screenState !== ScreenState.LOADING ) { - handleClick(screenData?.screenMetaData?.redirectionCta); + screenData?.screenMetaData?.redirectionCta && + handleClick(screenData?.screenMetaData?.redirectionCta); } }, [screenData?.screenMetaData?.redirectionCta]); diff --git a/App/common/constants/NumericalConstants.ts b/App/common/constants/NumericalConstants.ts index ff71ffdaff..3b79e0d640 100644 --- a/App/common/constants/NumericalConstants.ts +++ b/App/common/constants/NumericalConstants.ts @@ -1,2 +1,3 @@ export const HEADER_LOTTIE_WIDGET_HEIGHT = 180; -export const HEADER_LOTTIE_TITLE_HEIGHT = 84; \ No newline at end of file +export const HEADER_LOTTIE_TITLE_HEIGHT = 84; +export const BOTTOMSHEET_ANIMATION_DURATION = 200; \ No newline at end of file diff --git a/components/bottomsheet/BaseBottomSheetComponent.tsx b/components/bottomsheet/BaseBottomSheetComponent.tsx index 83bb4e2e05..cc92b29c63 100644 --- a/components/bottomsheet/BaseBottomSheetComponent.tsx +++ b/components/bottomsheet/BaseBottomSheetComponent.tsx @@ -7,6 +7,7 @@ import { ModalView } from "../../App/common/interface/modals/ModalView"; import { GetModalView } from "../../App/common/modals/modalViewResolver"; import { NativeDeeplinkNavigatorModule } from "../../App/common/native-module/NativeModules"; import styles from "../../App/common/styles/BaseBottomSheetComponentStyles"; +import { BOTTOMSHEET_ANIMATION_DURATION } from "../../App/common/constants/NumericalConstants"; const BaseBottomSheetComponent = ({ onBottomSheetAnimationEnd, @@ -26,7 +27,7 @@ const BaseBottomSheetComponent = ({ setModalVisible(false); setTimeout(() => { onClose(); - }, 400); + }, BOTTOMSHEET_ANIMATION_DURATION); }; const handleModalClick = (cta: CtaData) => { @@ -73,8 +74,8 @@ const BaseBottomSheetComponent = ({ onModalHide={() => onClose()} animationIn="slideInUp" animationOut="slideOutDown" - animationInTiming={400} - animationOutTiming={400} + animationInTiming={BOTTOMSHEET_ANIMATION_DURATION} + animationOutTiming={BOTTOMSHEET_ANIMATION_DURATION} useNativeDriverForBackdrop={true} style={styles.modal} > diff --git a/components/widgets/grid-with-card-widget/GridWithCardWidget.tsx b/components/widgets/grid-with-card-widget/GridWithCardWidget.tsx index 470f0b34e2..56b62bc8c4 100644 --- a/components/widgets/grid-with-card-widget/GridWithCardWidget.tsx +++ b/components/widgets/grid-with-card-widget/GridWithCardWidget.tsx @@ -49,11 +49,7 @@ const GridCardItemComponent = ({ { - { - if (handleClick) { - handleClick(cardItem?.cta!!)!!; - } - } + handleClick && (cardItem?.cta) && handleClick(cardItem?.cta); }} style={[styles.cardItem, cardItem.cardStyle]} > diff --git a/components/widgets/title-widget/TitleWidget.tsx b/components/widgets/title-widget/TitleWidget.tsx index 3705f08e59..e516548ccc 100644 --- a/components/widgets/title-widget/TitleWidget.tsx +++ b/components/widgets/title-widget/TitleWidget.tsx @@ -19,19 +19,15 @@ const TitleWidget = ({ widgetIndex?: number; }) => { const handleTitleClick = () => { - { - if (handleClick) { - handleClick(widgetData?.title?.cta!!)!!; - } - } + handleClick && + (widgetData?.title?.cta) && + handleClick(widgetData?.title?.cta); }; const handleRightTitleClick = () => { - { - if (handleClick) { - handleClick(widgetData?.rightTitle?.cta!!)!!; - } - } + handleClick && + (widgetData?.rightTitle?.cta) && + handleClick(widgetData?.rightTitle?.cta); }; return (