fix(mobile): keep loading skeletons below navigation headers

This commit is contained in:
joshuafhiggins committed 2026-11-09 18:02:36 -05:00 Verified
1 parent af7d5cc51d
commit fb36a6149b
1 file changed
+21 -7
+21 -7
View File
@@ -4,9 +4,11 @@ import {
useCollectionHeroLayout,
} from "@/components/collection-hero"
import { Link } from "expo-router"
import { useHeaderHeight } from "expo-router/react-navigation"
import Reanimated from "react-native-reanimated"
import { type ReactNode, type ComponentProps } from "react"
import {
Platform,
ScrollView,
StyleSheet,
View,
@@ -18,7 +20,7 @@ import {
import { contentBottomInset } from "@/components/player"
import { carouselCardWidth, radius, spacing, useThemeColors } from "@/lib/theme"
/** Match the inset-adjusted lists used once screen data is available. */
/** Reserve the transparent native header explicitly while skeletons cannot scroll. */
function SkeletonContent({
children,
embedded = false,
@@ -27,13 +29,17 @@ function SkeletonContent({
embedded?: boolean
}) {
const colors = useThemeColors()
const headerHeight = useHeaderHeight()
if (embedded) return <>{children}</>
return (
<ScrollView
style={{ flex: 1, backgroundColor: colors.background }}
contentContainerStyle={{ paddingBottom: contentBottomInset }}
contentInsetAdjustmentBehavior="automatic"
contentContainerStyle={{
paddingTop: Platform.OS === "ios" ? headerHeight : 0,
paddingBottom: contentBottomInset,
}}
contentInsetAdjustmentBehavior="never"
scrollEnabled={false}
accessibilityLabel="Loading"
>
@@ -170,12 +176,16 @@ export function CarouselSkeleton() {
}
export function HomeSkeleton() {
const headerHeight = useHeaderHeight()
const colors = useThemeColors()
return (
<ScrollView
style={{ flex: 1, backgroundColor: colors.background }}
contentContainerStyle={styles.home}
contentInsetAdjustmentBehavior="automatic"
contentContainerStyle={[
styles.home,
{ paddingTop: (Platform.OS === "ios" ? headerHeight : 0) + spacing.lg },
]}
contentInsetAdjustmentBehavior="never"
scrollEnabled={false}
accessibilityLabel="Loading"
>
@@ -200,6 +210,7 @@ export function CollectionDetailSkeleton({
onLayout?: () => void
}) {
const colors = useThemeColors()
const headerHeight = useHeaderHeight()
const { landscape, coverSize: tabletCoverSize } = useCollectionHeroLayout()
const coverSize =
!round && landscape
@@ -228,8 +239,11 @@ export function CollectionDetailSkeleton({
{ flex: 1, backgroundColor: backgroundColor ?? colors.background },
style,
]}
contentContainerStyle={{ paddingBottom: contentBottomInset }}
contentInsetAdjustmentBehavior="automatic"
contentContainerStyle={{
paddingTop: Platform.OS === "ios" ? headerHeight : 0,
paddingBottom: contentBottomInset,
}}
contentInsetAdjustmentBehavior="never"
scrollEnabled={false}
accessibilityLabel="Loading"
>