import React, { useState } from 'react'; import { ScrollView, View, Text } from 'react-native'; import { Button, TextInput } from 'react-native-paper'; import { addAccountFromHDPath } from '../utils/Accounts'; import { Account } from '../types'; const HDPath = ({ pathCode, updateAccounts, updateIndex, hideDialog, }: { pathCode: string; updateIndex: (index: number) => void; updateAccounts: (account: Account) => void; hideDialog: () => void; }) => { const [path, setPath] = useState(''); const [isAccountCreating, setIsAccountCreating] = useState(false); const createFromHDPathHandler = async () => { setIsAccountCreating(true); const hdPath = pathCode + path; const newAccount = await addAccountFromHDPath(hdPath); setIsAccountCreating(false); if (newAccount) { updateAccounts(newAccount); updateIndex(newAccount.counterId); hideDialog(); } }; return ( {pathCode} setPath(text)} value={path} style={{ flex: 1 }} /> ); }; export default HDPath;