From a7b0d571711ef7b0421a3dd8988a6cfa21703936 Mon Sep 17 00:00:00 2001 From: Kiruthika Jeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:37:30 +0530 Subject: [PATCH] refactor(INJI-472): disable back action in loader hardware back button press or gesture back action is disable in loader Signed-off-by: Kiruthika Jeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> --- components/ui/Loader.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/ui/Loader.tsx b/components/ui/Loader.tsx index 2543ff1ca..e7f3d1055 100644 --- a/components/ui/Loader.tsx +++ b/components/ui/Loader.tsx @@ -1,14 +1,22 @@ -import React, {Fragment} from 'react'; +import React, {Fragment, useEffect} from 'react'; import {useTranslation} from 'react-i18next'; -import {Image, SafeAreaView, View} from 'react-native'; +import {BackHandler, Image, SafeAreaView, View} from 'react-native'; import Spinner from 'react-native-spinkit'; import {Button, Centered, Column, Row, Text} from '../../components/ui'; -import {Theme} from '../../components/ui/styleUtils'; +import {Theme} from './styleUtils'; import testIDProps from '../../shared/commonUtil'; export const Loader: React.FC = props => { const {t} = useTranslation('ScanScreen'); + useEffect(() => { + const backHandler = BackHandler.addEventListener( + 'hardwareBackPress', + () => true, + ); + return () => backHandler.remove(); + }, []); + return (