Skip to content

Commit ef6fe4b

Browse files
authored
Make error alert to show and refocus on input (#974)
* make error alert to show and refocus on input * revert state when import fails * clean up
1 parent d751b5e commit ef6fe4b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/model/wallet.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,14 @@ export const createWallet = async (
386386
alreadyExistingWallet &&
387387
(type === WalletTypes.readOnly || isPrivateKeyOverwritingSeedMnemonic)
388388
) {
389-
Alert.alert('Oops!', 'Looks like you already imported this wallet!');
389+
setTimeout(
390+
() =>
391+
Alert.alert(
392+
'Oops!',
393+
'Looks like you already imported this wallet!'
394+
),
395+
1
396+
);
390397
logger.sentry('[createWallet] - already imported this wallet');
391398
return null;
392399
}

src/screens/ImportSeedPhraseSheet.js

+10
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,21 @@ export default function ImportSeedPhraseSheet() {
260260
analytics.track('Imported seed phrase', {
261261
hadPreviousAddressWithValue,
262262
});
263+
} else {
264+
// Wait for error messages then refocus
265+
setTimeout(() => {
266+
inputRef.current?.focus();
267+
initializeWallet();
268+
}, 100);
263269
}
264270
})
265271
.catch(error => {
266272
handleSetImporting(false);
267273
logger.error('error importing seed phrase: ', error);
274+
setTimeout(() => {
275+
inputRef.current?.focus();
276+
initializeWallet();
277+
}, 100);
268278
});
269279
}, 50);
270280
}

0 commit comments

Comments
 (0)