Remove deep link path and prevent re-render from useEffect #7
@ -15,14 +15,7 @@ import { WalletConnectProvider } from './context/WalletConnectContext';
|
|||||||
globalThis.Buffer = Buffer;
|
globalThis.Buffer = Buffer;
|
||||||
|
|
||||||
const linking = {
|
const linking = {
|
||||||
prefixes: ['https://wallet.laconic.com'],
|
prefixes: ['https://wallet.laconic.com']
|
||||||
config: {
|
|
||||||
screens: {
|
|
||||||
SignRequest: {
|
|
||||||
path: 'sign/:namespace/:chaindId/:address/:message',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const theme = {
|
const theme = {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { Image, ScrollView, View } from 'react-native';
|
import { Image, ScrollView, View } from 'react-native';
|
||||||
import { ActivityIndicator, Button, Text, Appbar } from 'react-native-paper';
|
import { ActivityIndicator, Button, Text, Appbar } from 'react-native-paper';
|
||||||
import _ from 'lodash';
|
|
||||||
|
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import {
|
import {
|
||||||
@ -50,7 +49,7 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
|||||||
const isCosmosSignDirect = useMemo(() => {
|
const isCosmosSignDirect = useMemo(() => {
|
||||||
const requestParams = route.params.requestEvent;
|
const requestParams = route.params.requestEvent;
|
||||||
|
|
||||||
if (!requestParams) {
|
if (!requestParams?.id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +59,7 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
|||||||
const isEthSendTransaction = useMemo(() => {
|
const isEthSendTransaction = useMemo(() => {
|
||||||
const requestParams = route.params.requestEvent;
|
const requestParams = route.params.requestEvent;
|
||||||
|
|
||||||
if (!requestParams) {
|
if (!requestParams?.id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,21 +86,13 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_.isEqual(requestAccount, account)) {
|
setAccount(requestAccount);
|
||||||
setAccount(requestAccount);
|
setMessage(decodeURIComponent(requestMessage));
|
||||||
}
|
setNamespace(requestNamespace);
|
||||||
if (requestMessage !== message) {
|
setChainId(requestChainId);
|
||||||
setMessage(decodeURIComponent(requestMessage));
|
|
||||||
}
|
|
||||||
if (requestNamespace !== namespace) {
|
|
||||||
setNamespace(requestNamespace);
|
|
||||||
}
|
|
||||||
if (requestChainId !== chainId) {
|
|
||||||
setChainId(requestChainId);
|
|
||||||
}
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
},
|
},
|
||||||
[account, message, navigation, namespace, chainId],
|
[navigation],
|
||||||
);
|
);
|
||||||
|
|
||||||
const sanitizePath = useCallback(
|
const sanitizePath = useCallback(
|
||||||
|
Loading…
Reference in New Issue
Block a user