laconic-wallet/components/NetworkDropdown.tsx
Adwait Gharpure 31c6999e9f UI to add multiple accounts (#16)
* Change button position

* Keep reset button at the bottom

* Use dropdown for accounts in separate component

* Display data of selected account

* Add method to add multiple accounts

* Change reset button position

* Clear account state on reset

* Display correct account info after creating

* Added account info to sign page

* Change variable names

* Use consistent variable names

* Use account id in ui

* Make review changes

* Fix imports

---------

Co-authored-by: Adw8 <adwait@deepstacksoft.com>
2024-02-19 12:12:18 +05:30

43 lines
1.0 KiB
TypeScript

import React, { useState } from 'react';
import { View } from 'react-native';
import { List } from 'react-native-paper';
import { NetworkDropdownProps } from '../types';
const NetworkDropdown: React.FC<NetworkDropdownProps> = ({
updateNetwork,
}) => {
const [expanded, setExpanded] = useState<boolean>(false);
const [title, setTitle] = useState<string>('Ethereum');
const expandNetworks = () => setExpanded(!expanded);
return (
<View style={{ marginBottom: 20 }}>
<List.Accordion
title={title}
expanded={expanded}
onPress={expandNetworks}>
<List.Item
title="Ethereum"
onPress={() => {
updateNetwork('eth');
setTitle('Ethereum');
setExpanded(false);
}}
/>
<List.Item
title="Cosmos"
onPress={() => {
updateNetwork('cosmos');
setTitle('Cosmos');
setExpanded(false);
}}
/>
</List.Accordion>
</View>
);
};
export { NetworkDropdown };