-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathWalletInfoView.tsx
More file actions
44 lines (40 loc) · 1.27 KB
/
WalletInfoView.tsx
File metadata and controls
44 lines (40 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { Image, StyleSheet, StyleProp, ViewStyle } from 'react-native';
import { useAccount, useWalletInfo } from '@reown/appkit-react-native';
import { FlexView, Text } from '@reown/appkit-ui-react-native';
interface Props {
style?: StyleProp<ViewStyle>;
}
export function WalletInfoView({ style }: Props) {
const { walletInfo } = useWalletInfo();
const { address, chain } = useAccount();
return walletInfo ? (
<FlexView style={style} padding="m" alignItems="center">
<Text variant="small-600" style={styles.label}>
Connected to
</Text>
<FlexView flexDirection="row" alignItems="center">
{walletInfo?.icons?.[0] ? (
<Image style={styles.logo} source={{ uri: walletInfo?.icons?.[0] }} />
) : null}
{walletInfo?.name ? <Text variant="small-400">{walletInfo?.name}</Text> : null}
</FlexView>
{address ? (
<Text ellipsizeMode="middle" numberOfLines={1} variant="small-400">
Address: {address}
</Text>
) : null}
{chain?.name ? <Text variant="small-400">Chain: {chain?.name}</Text> : null}
</FlexView>
) : null;
}
const styles = StyleSheet.create({
label: {
marginBottom: 2
},
logo: {
width: 20,
height: 20,
borderRadius: 5,
marginRight: 4
}
});