diff --git a/components/Accounts.tsx b/components/Accounts.tsx index e43b48a..2d726d3 100644 --- a/components/Accounts.tsx +++ b/components/Accounts.tsx @@ -19,13 +19,15 @@ const Accounts: React.FC = ({ useNavigation>(); const [expanded, setExpanded] = useState(false); - + const [isAccountCreating, setIsAccountCreating] = useState(false); const handlePress = () => setExpanded(!expanded); const addAccountHandler = async () => { + setIsAccountCreating(true); const newAccount = await addAccount(network); + setIsAccountCreating(false); newAccount && updateAccounts(newAccount); - updateIndex(selectedAccounts[selectedAccounts.length -1].id); + updateIndex(selectedAccounts[selectedAccounts.length - 1].id + 1); }; let selectedAccounts: Account[] = []; @@ -44,7 +46,7 @@ const Accounts: React.FC = ({ expanded={expanded} onPress={handlePress}> {selectedAccounts && - selectedAccounts.map((account) => ( + selectedAccounts.map(account => ( = ({ ))} - diff --git a/components/HomeScreen.tsx b/components/HomeScreen.tsx index 2255709..03fc297 100644 --- a/components/HomeScreen.tsx +++ b/components/HomeScreen.tsx @@ -29,11 +29,11 @@ const HomeScreen = () => { await new Promise(resolve => setTimeout(resolve, 2000)); const { ethWalletInfo, cosmosWalletInfo } = await createWallet(); ethWalletInfo && - cosmosWalletInfo && - setAccounts({ - ethAccounts: [...accounts.ethAccounts, ethWalletInfo], - cosmosAccounts: [...accounts.cosmosAccounts, cosmosWalletInfo], - }); + cosmosWalletInfo && + setAccounts({ + ethAccounts: [...accounts.ethAccounts, ethWalletInfo], + cosmosAccounts: [...accounts.cosmosAccounts, cosmosWalletInfo], + }); setWalletDialog(true); setIsWalletCreated(true); }; @@ -112,7 +112,7 @@ const HomeScreen = () => { updateIndex={updateIndex} updateAccounts={updateAccounts} /> - +