Skip to content

Commit e66d661

Browse files
authored
Merge pull request Expensify#76254 from thelullabyy/fix/75176/last-three-avatars
Profile - Last three avatars are not arranged side by side when display name is not English
2 parents c7b1703 + ce39b6b commit e66d661

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/components/AvatarSelector.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ type AvatarSelectorProps = {
2929
label?: string;
3030
};
3131

32+
const SPACER_SIZE = 10;
33+
3234
/**
3335
* AvatarSelector — renders a grid of selectable avatars.
3436
*/
@@ -39,6 +41,8 @@ function AvatarSelector({selectedID, onSelect, label, name, size = CONST.AVATAR_
3941
const StyleUtils = useStyleUtils();
4042
const {avatarList} = useLetterAvatars(name, size);
4143

44+
const iconSize = StyleUtils.getAvatarSize(size);
45+
4246
return (
4347
<>
4448
{!!label && avatarList?.length > 0 && (
@@ -89,6 +93,15 @@ function AvatarSelector({selectedID, onSelect, label, name, size = CONST.AVATAR_
8993
</PressableWithFeedback>
9094
);
9195
})}
96+
{/* We need to add several invisible items at the end of the avatar list to guarantee that the last row avatars are aligned properly */}
97+
{[...Array(SPACER_SIZE).keys()].map((i) => (
98+
<View
99+
key={`spacer-${i}`}
100+
style={[styles.avatarSelectorWrapper]}
101+
>
102+
<View style={{width: iconSize, height: iconSize}} />
103+
</View>
104+
))}
92105
</View>
93106
</>
94107
);

0 commit comments

Comments
 (0)