about summary refs log tree commit diff
path: root/src/view/com/util/UserAvatar.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-02-09 05:00:50 +0000
committerGitHub <noreply@github.com>2024-02-08 21:00:50 -0800
commitd36b91fe67225a9d3c79c8eeb3c80f6a72e9f73f (patch)
tree965fb97bd9508afffdf66a4d2e951f57bd566f1e /src/view/com/util/UserAvatar.tsx
parent0d00c7d8516d2e4b736f5a2eaa679dbcce2cb71c (diff)
downloadvoidsky-d36b91fe67225a9d3c79c8eeb3c80f6a72e9f73f.tar.zst
Fix flashes and jumps when opening profile (#2815)
* Don't reset the tree when profile loads fully

* Give avatars a background color like placeholders

* Prevent jumps due to rich text resolving

* Rm log

* Rm unused
Diffstat (limited to 'src/view/com/util/UserAvatar.tsx')
-rw-r--r--src/view/com/util/UserAvatar.tsx5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx
index 00ff7e1ec..f673db1ee 100644
--- a/src/view/com/util/UserAvatar.tsx
+++ b/src/view/com/util/UserAvatar.tsx
@@ -123,6 +123,7 @@ let UserAvatar = ({
   usePlainRNImage = false,
 }: UserAvatarProps): React.ReactNode => {
   const pal = usePalette('default')
+  const backgroundColor = pal.colors.backgroundLight
 
   const aviStyle = useMemo(() => {
     if (type === 'algo' || type === 'list') {
@@ -130,14 +131,16 @@ let UserAvatar = ({
         width: size,
         height: size,
         borderRadius: size > 32 ? 8 : 3,
+        backgroundColor,
       }
     }
     return {
       width: size,
       height: size,
       borderRadius: Math.floor(size / 2),
+      backgroundColor,
     }
-  }, [type, size])
+  }, [type, size, backgroundColor])
 
   const alert = useMemo(() => {
     if (!moderation?.alert) {