forked from cerc-io/laconic-wallet
Select network after creating wallet (#10)
* View dropdown on creating wallet * Use separate component for network dropdown * Fix imports --------- Co-authored-by: Adw8 <adwait@deepstacksoft.com>
This commit is contained in:
parent
242eec1104
commit
f026d9345f
7
App.tsx
7
App.tsx
@ -1,19 +1,18 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { HomeScreen } from './components/HomeScreen';
|
|
||||||
import { Header } from './components/Header';
|
|
||||||
import { NavigationContainer } from '@react-navigation/native';
|
import { NavigationContainer } from '@react-navigation/native';
|
||||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||||
|
|
||||||
import SignMessage from './components/SignMessage';
|
import SignMessage from './components/SignMessage';
|
||||||
|
import { HomeScreen } from './components/HomeScreen';
|
||||||
|
|
||||||
const Stack = createNativeStackNavigator();
|
const Stack = createNativeStackNavigator();
|
||||||
|
|
||||||
const App = (): React.JSX.Element => {
|
const App = (): React.JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<NavigationContainer>
|
<NavigationContainer>
|
||||||
<Header />
|
|
||||||
<Stack.Navigator>
|
<Stack.Navigator>
|
||||||
<Stack.Screen name="Home" component={HomeScreen} />
|
<Stack.Screen name="Laconic" component={HomeScreen} />
|
||||||
<Stack.Screen name="Sign Message" component={SignMessage} />
|
<Stack.Screen name="Sign Message" component={SignMessage} />
|
||||||
</Stack.Navigator>
|
</Stack.Navigator>
|
||||||
</NavigationContainer>
|
</NavigationContainer>
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { Text, Button, Dialog, Portal } from 'react-native-paper';
|
import { Text, Button, Dialog, Portal, List } from 'react-native-paper';
|
||||||
import { HDNode } from 'ethers/lib/utils';
|
import { HDNode } from 'ethers/lib/utils';
|
||||||
|
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
|
|
||||||
import { generateWallet, resetWallet } from '../utils';
|
import { generateWallet, resetWallet } from '../utils';
|
||||||
import { DialogComponent } from './Dialog';
|
import { DialogComponent } from './Dialog';
|
||||||
|
import { NetworkDropdown } from './NetworkDropdown';
|
||||||
|
|
||||||
const HomeScreen = () => {
|
const HomeScreen = () => {
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
@ -62,6 +63,7 @@ const HomeScreen = () => {
|
|||||||
</Portal>
|
</Portal>
|
||||||
{isWalletCreated ? (
|
{isWalletCreated ? (
|
||||||
<View>
|
<View>
|
||||||
|
<NetworkDropdown />
|
||||||
<Text variant="headlineSmall">Account1</Text>
|
<Text variant="headlineSmall">Account1</Text>
|
||||||
<View style={{ marginTop: 15, marginBottom: 15 }}>
|
<View style={{ marginTop: 15, marginBottom: 15 }}>
|
||||||
<Text variant="bodyLarge">
|
<Text variant="bodyLarge">
|
||||||
|
@ -1,22 +1,18 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { Appbar, List } from 'react-native-paper';
|
import { List } from 'react-native-paper';
|
||||||
|
|
||||||
const Header = () => {
|
const NetworkDropdown = () => {
|
||||||
const [expanded, setExpanded] = useState<boolean>(false);
|
const [expanded, setExpanded] = useState<boolean>(false);
|
||||||
|
|
||||||
const handlePress = () => setExpanded(!expanded);
|
const expandNetworks = () => setExpanded(!expanded);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View style={{ marginBottom: 20 }}>
|
||||||
<Appbar.Header mode="center-aligned">
|
|
||||||
<Appbar.Content title="Laconic" />
|
|
||||||
</Appbar.Header>
|
|
||||||
|
|
||||||
<List.Accordion
|
<List.Accordion
|
||||||
title="Select Network"
|
title="Select Network"
|
||||||
expanded={expanded}
|
expanded={expanded}
|
||||||
onPress={handlePress}>
|
onPress={expandNetworks}>
|
||||||
<List.Item
|
<List.Item
|
||||||
title="Ethereum"
|
title="Ethereum"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
@ -34,4 +30,4 @@ const Header = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { Header };
|
export { NetworkDropdown };
|
Loading…
Reference in New Issue
Block a user