From ffbd3de621cd64a5cfa9b9ff2443cac66b7ac6e0 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Tue, 3 Nov 2026 15:37:52 -0500 Subject: [PATCH] fix(mobile): keep loading skeletons below headers --- apps/mobile/components/skeletons.tsx | 104 ++++++++++++++++++--------- 1 file changed, 71 insertions(+), 33 deletions(-) diff --git a/apps/mobile/components/skeletons.tsx b/apps/mobile/components/skeletons.tsx index 26ada21..6f32141 100644 --- a/apps/mobile/components/skeletons.tsx +++ b/apps/mobile/components/skeletons.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef } from "react" +import { useEffect, useRef, type ReactNode } from "react" import { Animated, ScrollView, @@ -18,6 +18,30 @@ import { useTwoColumnCardWidth, } from "@/lib/theme" +/** Match the inset-adjusted lists used once screen data is available. */ +function SkeletonContent({ + children, + embedded = false, +}: { + children: ReactNode + embedded?: boolean +}) { + const colors = useThemeColors() + if (embedded) return <>{children} + + return ( + + {children} + + ) +} + export function Skeleton({ style }: { style?: StyleProp }) { const colors = useThemeColors() const opacity = useRef(new Animated.Value(1)).current @@ -74,13 +98,21 @@ export function SongRowSkeleton() { ) } -export function SongListSkeleton({ rows = 10 }: { rows?: number }) { +export function SongListSkeleton({ + rows = 10, + embedded = false, +}: { + rows?: number + embedded?: boolean +}) { return ( - - {Array.from({ length: rows }, (_, index) => ( - - ))} - + + + {Array.from({ length: rows }, (_, index) => ( + + ))} + + ) } @@ -109,24 +141,28 @@ function CardSkeleton({ export function MediaGridSkeleton({ items = 6, contentInset = true, + embedded = false, }: { items?: number contentInset?: boolean + embedded?: boolean }) { const cardWidth = useTwoColumnCardWidth() return ( - - {Array.from({ length: items }, (_, index) => ( - - ))} - + + + {Array.from({ length: items }, (_, index) => ( + + ))} + + ) } @@ -192,9 +228,9 @@ export function CollectionDetailSkeleton({ {round ? ( - + ) : ( - + )} ) @@ -203,17 +239,19 @@ export function CollectionDetailSkeleton({ export function ArtistListSkeleton({ rows = 12 }: { rows?: number }) { const colors = useThemeColors() return ( - - {Array.from({ length: rows }, (_, index) => ( - - - - - ))} - + + + {Array.from({ length: rows }, (_, index) => ( + + + + + ))} + + ) } @@ -233,7 +271,7 @@ const styles = StyleSheet.create({ grid: { flexDirection: "row", flexWrap: "wrap", gap: spacing.md }, gridInset: { padding: spacing.lg }, gridRowInset: { paddingHorizontal: spacing.lg }, - carousel: { gap: spacing.md }, + carousel: { gap: spacing.md, overflow: "hidden" }, carouselRow: { flexDirection: "row", gap: spacing.md }, home: { padding: spacing.lg, gap: spacing.xl }, hero: { alignItems: "center", padding: spacing.lg, gap: spacing.sm },