Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit 33d947c

Browse files
committed
Merge branch 'main' into feat/tabs
2 parents 592b06e + 558ef79 commit 33d947c

File tree

24 files changed

+823
-494
lines changed

24 files changed

+823
-494
lines changed

assets/headers/ailes.png

15.1 KB
Loading

assets/headers/boxes.png

20.6 KB
Loading

assets/headers/hlr.png

21.1 KB
Loading

assets/headers/spark.png

20.4 KB
Loading

assets/headers/stars.png

11.7 KB
Loading

assets/headers/texture.png

22.3 KB
Loading

assets/headers/tictactoe.png

53.8 KB
Loading

assets/headers/topography.png

57.4 KB
Loading

assets/headers/v7.png

11.5 KB
Loading

src/components/Home/AccountSwitcher.tsx

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { memo } from "react";
22
import { Image, StyleSheet, View } from "react-native";
33
import { useTheme } from "@react-navigation/native";
44
import { ChevronDown } from "lucide-react-native";
@@ -18,13 +18,13 @@ import { BlurView } from "expo-blur";
1818
const ReanimatedBlurView = Reanimated.createAnimatedComponent(BlurView);
1919
const AnimatedChevronDown = Reanimated.createAnimatedComponent(ChevronDown);
2020

21-
const AccountSwitcher: React.FC<{
22-
small?: boolean;
23-
opened?: boolean;
24-
modalOpen?: boolean;
25-
translationY?: Reanimated.SharedValue<number>;
26-
loading?: boolean;
27-
}> = ({ small, opened, modalOpen, translationY, loading }) => {
21+
const AccountSwitcher = ({
22+
small = false,
23+
opened = false,
24+
modalOpen = false,
25+
translationY,
26+
loading = false,
27+
}) => {
2828
const theme = useTheme();
2929
const { colors } = theme;
3030
const account = useCurrentAccount((store) => store.account!);
@@ -48,11 +48,7 @@ const AccountSwitcher: React.FC<{
4848
}));
4949

5050
const textAnimatedStyle = useAnimatedStyle(() => ({
51-
color: interpolateColor(
52-
translationY?.value || 0,
53-
[200, 251],
54-
["#FFF", colors.text]
55-
),
51+
color: colors.text,
5652
fontSize: 16,
5753
fontFamily: "semibold",
5854
maxWidth: 140,
@@ -94,58 +90,29 @@ const AccountSwitcher: React.FC<{
9490

9591
return (
9692
<Reanimated.View
97-
style={{
98-
backgroundColor: opened
99-
? theme.dark && !modalOpen
100-
? "#00000044"
101-
: "#FFFFFF22"
102-
: modalOpen
103-
? colors.text + "10"
104-
: "#FFFFFF12",
105-
borderRadius: 12,
106-
borderCurve: "continuous",
107-
overflow: "hidden",
108-
alignSelf: "flex-start",
109-
}}
93+
style={[
94+
styles.container,
95+
{
96+
backgroundColor: theme.dark ? colors.background : colors.card,
97+
borderColor: modalOpen ? colors.border : "transparent",
98+
shadowOpacity: modalOpen ? 0.16 : 0,
99+
},
100+
]}
110101
layout={animPapillon(LinearTransition)}
111102
>
112-
<ReanimatedBlurView
113-
tint="default"
114-
experimentalBlurMethod="dimezisBlurView"
115-
style={{
116-
paddingHorizontal: 2,
117-
paddingVertical: 0,
118-
alignSelf: "flex-start",
119-
}}
120-
layout={animPapillon(LinearTransition)}
121-
>
103+
<Reanimated.View style={styles.innerContainer} layout={animPapillon(LinearTransition)}>
122104
<Reanimated.View
123105
layout={animPapillon(LinearTransition)}
124106
style={[
125107
styles.accountSwitcher,
126108
loading && { shadowOpacity: 0 },
127-
small && {
128-
paddingHorizontal: 0,
129-
shadowOpacity: 0,
130-
elevation: 0,
131-
borderRadius: 0,
132-
paddingVertical: 0,
133-
backgroundColor: "transparent",
134-
},
109+
small && styles.smallAccountSwitcher,
135110
]}
136111
>
137-
<Reanimated.View
138-
style={{ flexDirection: "row", alignItems: "center", gap: 12 }}
139-
layout={animPapillon(LinearTransition)}
140-
>
112+
<Reanimated.View style={styles.row} layout={animPapillon(LinearTransition)}>
141113
{renderProfilePicture()}
142114
<Reanimated.Text
143-
style={{
144-
color: modalOpen && !opened ? colors.text : "#FFF",
145-
fontSize: 16,
146-
fontFamily: "semibold",
147-
maxWidth: 140,
148-
}}
115+
style={textAnimatedStyle}
149116
numberOfLines={1}
150117
ellipsizeMode="tail"
151118
>
@@ -157,7 +124,7 @@ const AccountSwitcher: React.FC<{
157124
<PapillonSpinner
158125
size={20}
159126
strokeWidth={3}
160-
color={modalOpen && !opened ? colors.text : "#FFF"}
127+
color={colors.text}
161128
animated
162129
entering={animPapillon(ZoomIn)}
163130
exiting={animPapillon(ZoomOut)}
@@ -168,17 +135,36 @@ const AccountSwitcher: React.FC<{
168135
size={24}
169136
strokeWidth={2.3}
170137
style={iconAnimatedStyle}
171-
color={modalOpen && !opened ? colors.text : "#FFF"}
138+
color={colors.text}
172139
/>
173140
</Reanimated.View>
174141
</Reanimated.View>
175142
</Reanimated.View>
176-
</ReanimatedBlurView>
143+
</Reanimated.View>
177144
</Reanimated.View>
178145
);
179146
};
180147

181148
const styles = StyleSheet.create({
149+
container: {
150+
borderRadius: 12,
151+
borderCurve: "continuous",
152+
overflow: "visible",
153+
alignSelf: "flex-start",
154+
shadowColor: "black",
155+
shadowOffset: { width: 0, height: 1 },
156+
shadowRadius: 4,
157+
shadowOpacity: 0,
158+
borderWidth: 1,
159+
},
160+
innerContainer: {
161+
paddingHorizontal: 2,
162+
paddingVertical: 0,
163+
alignSelf: "flex-start",
164+
borderRadius: 12,
165+
borderCurve: "continuous",
166+
overflow: "hidden",
167+
},
182168
accountSwitcher: {
183169
flexDirection: "row",
184170
justifyContent: "center",
@@ -191,6 +177,18 @@ const styles = StyleSheet.create({
191177
paddingVertical: 6,
192178
gap: 6,
193179
},
180+
smallAccountSwitcher: {
181+
paddingHorizontal: 0,
182+
elevation: 0,
183+
borderRadius: 0,
184+
paddingVertical: 0,
185+
backgroundColor: "transparent",
186+
},
187+
row: {
188+
flexDirection: "row",
189+
alignItems: "center",
190+
gap: 12,
191+
},
194192
avatar: {
195193
aspectRatio: 1,
196194
borderRadius: 24,
@@ -200,4 +198,4 @@ const styles = StyleSheet.create({
200198
},
201199
});
202200

203-
export default AccountSwitcher;
201+
export default memo(AccountSwitcher);

0 commit comments

Comments
 (0)