From e1d75dc4c69df10d1d8b9b46e1294baf18ca4bfa Mon Sep 17 00:00:00 2001 From: shreerang6921 <68148922+shreerang6921@users.noreply.github.com> Date: Wed, 13 Mar 2024 19:12:50 +0530 Subject: [PATCH] Reject signature request if user goes back from page (#54) --- components/SignRequest.tsx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/components/SignRequest.tsx b/components/SignRequest.tsx index 6c0bcf9..1c53a16 100644 --- a/components/SignRequest.tsx +++ b/components/SignRequest.tsx @@ -1,12 +1,13 @@ import React, { useEffect, useMemo, useState } from 'react'; import { Alert, Image, ScrollView, View } from 'react-native'; -import { ActivityIndicator, Button, Text } from 'react-native-paper'; +import { ActivityIndicator, Button, Text, Appbar } from 'react-native-paper'; import { useNavigation } from '@react-navigation/native'; import { NativeStackNavigationProp, NativeStackScreenProps, } from '@react-navigation/native-stack'; +import { getHeaderTitle } from '@react-navigation/elements'; import { Account, StackParamsList } from '../types'; import AccountDetails from './AccountDetails'; @@ -160,6 +161,27 @@ const SignRequest = ({ route }: SignRequestProps) => { navigation.navigate('Laconic'); }; + navigation.setOptions({ + // eslint-disable-next-line react/no-unstable-nested-components + header: ({ options, back }) => { + const title = getHeaderTitle(options, route.name); + + return ( + + {back && ( + { + await rejectRequestHandler(); + navigation.navigate('Laconic'); + }} + /> + )} + + + ); + }, + }); + return ( <> {isLoading ? (