laconic-wallet/components/NetworkDropdown.tsx
IshaVenikar 8685c94151 Integrate functionality to add new accounts with UI (#17)
* Create addAccount function

* Make review changes

* Create addAccount function

* Add id for each account

* Modify resetWallet function

* Make review changes

* Integrate functions
2024-02-19 12:12:18 +05:30

41 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 };