From 6aa195ceafb2fbd9f721bf2981aa66a94232c0fc Mon Sep 17 00:00:00 2001 From: Johannes Klein Date: Tue, 14 Oct 2025 21:22:24 +0200 Subject: [PATCH] Fix: Double border on user icon in Me tab (#3135) * Use Image with nativewind styling instead of FasterImageView * Update UserIcon.test.js.snap * Update unit tests --- src/components/SharedComponents/UserIcon.tsx | 29 ++----- .../SharedComponents/UserIcon.test.js | 2 +- .../__snapshots__/UserIcon.test.js.snap | 84 ++++++++++++------- .../UserProfile/UserProfile.test.js | 2 +- 4 files changed, 64 insertions(+), 53 deletions(-) diff --git a/src/components/SharedComponents/UserIcon.tsx b/src/components/SharedComponents/UserIcon.tsx index 818b91bda..955acb1f4 100644 --- a/src/components/SharedComponents/UserIcon.tsx +++ b/src/components/SharedComponents/UserIcon.tsx @@ -1,8 +1,8 @@ +import classNames from "classnames"; import { INatIcon } from "components/SharedComponents"; -import { FasterImageView, View } from "components/styledComponents"; +import { Image, View } from "components/styledComponents"; import React from "react"; import type { ImageStyle } from "react-native"; -import colors from "styles/tailwindColors"; interface Props { active?: boolean; @@ -42,14 +42,9 @@ const UserIcon = ( { // but it works with style, might warrant further investigation or an issue in nativewind const style: ImageStyle = { width: size, - height: size, - overflow: "hidden" - }; - const activeStyle: ImageStyle = { - borderColor: String( colors?.inatGreen ), - borderWidth: 3, - borderRadius: size / 2 + height: size }; + return ( uri ? ( @@ -58,20 +53,12 @@ const UserIcon = ( { accessibilityIgnoresInvertColors testID="UserIcon.photo" > - ) diff --git a/tests/unit/components/SharedComponents/UserIcon.test.js b/tests/unit/components/SharedComponents/UserIcon.test.js index 2503b3642..b0697adc3 100644 --- a/tests/unit/components/SharedComponents/UserIcon.test.js +++ b/tests/unit/components/SharedComponents/UserIcon.test.js @@ -44,6 +44,6 @@ describe( "UserIcon", () => { // eslint-disable-next-line testing-library/no-node-access expect( profilePicture.children[0] ).toBeTruthy(); // eslint-disable-next-line testing-library/no-node-access - expect( profilePicture.children[0].props.source ).toHaveProperty( "url", mockUri ); + expect( profilePicture.children[0].props.source ).toHaveProperty( "uri", mockUri ); } ); } ); diff --git a/tests/unit/components/SharedComponents/__snapshots__/UserIcon.test.js.snap b/tests/unit/components/SharedComponents/__snapshots__/UserIcon.test.js.snap index 3f21f44eb..a06b74c42 100644 --- a/tests/unit/components/SharedComponents/__snapshots__/UserIcon.test.js.snap +++ b/tests/unit/components/SharedComponents/__snapshots__/UserIcon.test.js.snap @@ -6,24 +6,38 @@ exports[`UserIcon displays active user image correctly 1`] = ` accessibilityRole="image" testID="UserIcon.photo" > - @@ -36,21 +50,26 @@ exports[`UserIcon displays small user image correctly 1`] = ` accessibilityRole="image" testID="UserIcon.photo" > - @@ -63,21 +82,26 @@ exports[`UserIcon displays user image correctly 1`] = ` accessibilityRole="image" testID="UserIcon.photo" > - diff --git a/tests/unit/components/UserProfile/UserProfile.test.js b/tests/unit/components/UserProfile/UserProfile.test.js index 849d99733..08ce7a6e1 100644 --- a/tests/unit/components/UserProfile/UserProfile.test.js +++ b/tests/unit/components/UserProfile/UserProfile.test.js @@ -71,7 +71,7 @@ describe( "UserProfile", () => { const userIcon = screen.getByTestId( "UserIcon.photo" ); expect( userIcon ).toBeTruthy( ); // eslint-disable-next-line testing-library/no-node-access - expect( userIcon.children[0].props.source ).toHaveProperty( "url", mockUser.icon_url ); + expect( userIcon.children[0].props.source ).toHaveProperty( "uri", mockUser.icon_url ); } ); test( "renders followers and following buttons", async () => {