diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js
--- a/native/account/siwe-panel.react.js
+++ b/native/account/siwe-panel.react.js
@@ -31,6 +31,9 @@
const getSIWENonceLoadingStatusSelector = createLoadingStatusSelector(
getSIWENonceActionTypes,
);
+const siweAuthLoadingStatusSelector = createLoadingStatusSelector(
+ siweAuthActionTypes,
+);
type Props = {
+onClose: () => mixed,
@@ -52,6 +55,9 @@
const getSIWENonceCallFailed = useSelector(
state => getSIWENonceLoadingStatusSelector(state) === 'error',
);
+ const siweAuthCallLoading = useSelector(
+ state => siweAuthLoadingStatusSelector(state) === 'loading',
+ );
const [nonce, setNonce] = React.useState(null);
@@ -109,12 +115,15 @@
);
const closeBottomSheet = bottomSheetRef.current?.close;
const { onClose, nextMode } = props;
+ const disableOnClose = React.useRef(false);
const handleMessage = React.useCallback(
event => {
const data: SIWEWebViewMessage = JSON.parse(event.nativeEvent.data);
if (data.type === 'siwe_success') {
const { address, message, signature } = data;
if (address && signature) {
+ disableOnClose.current = true;
+ closeBottomSheet?.();
handleSIWE({ message, signature });
}
} else if (data.type === 'siwe_closed') {
@@ -164,6 +173,10 @@
const onBottomSheetChange = React.useCallback(
(index: number) => {
+ if (disableOnClose.current) {
+ disableOnClose.current = false;
+ return;
+ }
if (index === -1) {
onClose();
}
@@ -196,7 +209,7 @@
let activity;
if (getSIWENonceCallFailed) {
activity = Oops, try again later!;
- } else if (isLoading) {
+ } else if (isLoading || siweAuthCallLoading) {
activity = ;
}