forked from cerc-io/laconic-wallet
Reject signature request if user goes back from page (#54)
This commit is contained in:
parent
1f0e8aecd4
commit
e1d75dc4c6
@ -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 (
|
||||
<Appbar.Header>
|
||||
{back && (
|
||||
<Appbar.BackAction
|
||||
onPress={async () => {
|
||||
await rejectRequestHandler();
|
||||
navigation.navigate('Laconic');
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<Appbar.Content title={title} />
|
||||
</Appbar.Header>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
{isLoading ? (
|
||||
|
Loading…
Reference in New Issue
Block a user