From 956821e4e93bbcfb64ae57b95948027df9f7e8c7 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Wed, 21 Feb 2024 17:19:22 +0530 Subject: [PATCH] Add multiple textboxes --- components/HDPath.tsx | 69 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/components/HDPath.tsx b/components/HDPath.tsx index 6e9c6fa..e8ea58a 100644 --- a/components/HDPath.tsx +++ b/components/HDPath.tsx @@ -1,9 +1,10 @@ import React, { useState } from 'react'; -import { ScrollView, View, Text } from 'react-native'; +import { ScrollView, View, Text, StyleSheet } from 'react-native'; import { Button, TextInput } from 'react-native-paper'; import { addAccountFromHDPath } from '../utils/Accounts'; import { Account } from '../types'; +import { HDNode } from 'ethers/lib/utils'; const HDPath = ({ pathCode, @@ -16,12 +17,14 @@ const HDPath = ({ updateAccounts: (account: Account) => void; hideDialog: () => void; }) => { - const [path, setPath] = useState(''); const [isAccountCreating, setIsAccountCreating] = useState(false); + const [firstNumber, setFirstNumber] = useState(''); + const [secondNumber, setSecondNumber] = useState(''); + const [thirdNumber, setThirdNumber] = useState(''); const createFromHDPathHandler = async () => { setIsAccountCreating(true); - const hdPath = pathCode + path; + const hdPath = pathCode + `${firstNumber}'/${secondNumber}/${thirdNumber}`; try { const newAccount = await addAccountFromHDPath(hdPath); if (newAccount) { @@ -37,19 +40,37 @@ const HDPath = ({ }; return ( - - - - {pathCode} - + + + {pathCode} + '/ + + '/ + - +