From 18cd074170a36ec93d3fa5098d78e17838024b3a Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Thu, 5 Nov 2026 17:08:30 -0500 Subject: [PATCH 1/5] fix(mobile): restore Android page transitions --- apps/mobile/app/(app)/(tabs)/home/_layout.tsx | 5 ----- apps/mobile/app/(app)/(tabs)/library/_layout.tsx | 5 ----- apps/mobile/app/(app)/(tabs)/search/_layout.tsx | 5 ----- apps/mobile/lib/navigation.ts | 1 + 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/apps/mobile/app/(app)/(tabs)/home/_layout.tsx b/apps/mobile/app/(app)/(tabs)/home/_layout.tsx index 195b95a..87b926d 100644 --- a/apps/mobile/app/(app)/(tabs)/home/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/_layout.tsx @@ -1,5 +1,4 @@ import { Stack } from "expo-router" -import { Platform } from "react-native" import { ProfileHeaderButton } from "@/components/profile-header-button" import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation" @@ -15,10 +14,6 @@ export default function HomeLayout() { ({ ...baseOptions, - ...(Platform.OS === "android" && - (route.name === "album/[id]" || route.name === "playlist/[id]") - ? { animation: "none" as const } - : {}), title: tabStackScreenTitles[route.name] ?? "Home", headerRight: route.name === "index" ? () => : undefined, diff --git a/apps/mobile/app/(app)/(tabs)/library/_layout.tsx b/apps/mobile/app/(app)/(tabs)/library/_layout.tsx index 1620b26..e3d9b68 100644 --- a/apps/mobile/app/(app)/(tabs)/library/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/library/_layout.tsx @@ -1,5 +1,4 @@ import { Stack } from "expo-router" -import { Platform } from "react-native" import { ProfileHeaderButton } from "@/components/profile-header-button" import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation" @@ -15,10 +14,6 @@ export default function LibraryLayout() { ({ ...baseOptions, - ...(Platform.OS === "android" && - (route.name === "album/[id]" || route.name === "playlist/[id]") - ? { animation: "none" as const } - : {}), title: tabStackScreenTitles[route.name] ?? "Library", headerRight: route.name === "index" ? () => : undefined, diff --git a/apps/mobile/app/(app)/(tabs)/search/_layout.tsx b/apps/mobile/app/(app)/(tabs)/search/_layout.tsx index dcea4b1..288328a 100644 --- a/apps/mobile/app/(app)/(tabs)/search/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/search/_layout.tsx @@ -1,5 +1,4 @@ import { Stack } from "expo-router" -import { Platform } from "react-native" import { ProfileHeaderButton } from "@/components/profile-header-button" import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation" @@ -15,10 +14,6 @@ export default function SearchLayout() { ({ ...baseOptions, - ...(Platform.OS === "android" && - (route.name === "album/[id]" || route.name === "playlist/[id]") - ? { animation: "none" as const } - : {}), title: tabStackScreenTitles[route.name] ?? "Search", headerRight: route.name === "index" ? () => : undefined, diff --git a/apps/mobile/lib/navigation.ts b/apps/mobile/lib/navigation.ts index 63f6e0c..3340a10 100644 --- a/apps/mobile/lib/navigation.ts +++ b/apps/mobile/lib/navigation.ts @@ -28,6 +28,7 @@ export function useStackScreenOptions( headerBackButtonDisplayMode: "minimal", ...(Platform.OS === "android" ? { + animation: "slide_from_right", headerLargeTitle: false, headerTransparent: false, headerStyle: { backgroundColor: theme.background }, -- 2.54.1 From 08e742ef45b982552e2d616b8fec4ce375582b9f Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Thu, 5 Nov 2026 17:33:41 -0500 Subject: [PATCH 2/5] fix(mobile): fade artwork colors during Android navigation --- .../app/(app)/(tabs)/home/album/[id].tsx | 13 ++- .../app/(app)/(tabs)/home/playlist/[id].tsx | 13 ++- apps/mobile/components/cover-image.tsx | 6 ++ apps/mobile/components/skeletons.tsx | 7 +- apps/mobile/contexts/android-tab-theme.tsx | 98 ++++++++++++++----- apps/mobile/hooks/use-cover-palette.ts | 16 ++- 6 files changed, 124 insertions(+), 29 deletions(-) diff --git a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx index c1de515..509b9b9 100644 --- a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx @@ -135,9 +135,20 @@ export default function AlbumScreen() { options={{ title: "", headerLargeTitle: false, + ...(Platform.OS === "android" + ? { + headerStyle: { backgroundColor: palette.background }, + headerTintColor: palette.foreground, + } + : {}), }} /> - + ) } diff --git a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx index c5214fc..a6268f2 100644 --- a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx @@ -98,9 +98,20 @@ export default function PlaylistScreen() { options={{ title: "", headerLargeTitle: false, + ...(Platform.OS === "android" + ? { + headerStyle: { backgroundColor: palette.background }, + headerTintColor: palette.foreground, + } + : {}), }} /> - + ) } diff --git a/apps/mobile/components/cover-image.tsx b/apps/mobile/components/cover-image.tsx index d686057..7303894 100644 --- a/apps/mobile/components/cover-image.tsx +++ b/apps/mobile/components/cover-image.tsx @@ -2,6 +2,7 @@ import { Ionicons } from "@expo/vector-icons" import { Image, type ImageContentFit, type ImageStyle } from "expo-image" import { memo, useMemo } from "react" import { + Platform, PixelRatio, StyleProp, StyleSheet, @@ -9,6 +10,8 @@ import { type ViewStyle, } from "react-native" +import { prefetchCoverPalette } from "@/hooks/use-cover-palette" + import { useThemeColors } from "@/lib/theme" import { coverImageSizes, @@ -106,6 +109,9 @@ export const CoverImage = memo(function CoverImage({ contentFit={contentFit} transition={150} blurRadius={blurRadius} + onLoad={ + Platform.OS === "android" ? () => prefetchCoverPalette(uri) : undefined + } cachePolicy="memory-disk" recyclingKey={sourceUri} enforceEarlyResizing diff --git a/apps/mobile/components/skeletons.tsx b/apps/mobile/components/skeletons.tsx index 6f32141..af12d8f 100644 --- a/apps/mobile/components/skeletons.tsx +++ b/apps/mobile/components/skeletons.tsx @@ -198,14 +198,19 @@ export function HomeSkeleton() { /** Album and playlist pages: cover, title, play buttons, then tracks. */ export function CollectionDetailSkeleton({ round = false, + backgroundColor, + onLayout, }: { round?: boolean + backgroundColor?: string + onLayout?: () => void }) { const colors = useThemeColors() const coverSize = round ? 180 : 210 return ( (null) - const palette = screen?.palette ?? null + const palette = useFadingPalette( + screen?.palette ?? defaultPalette, + defaultPalette + ) const setPalette = useCallback( (palette: CoverPalette | null, owner: string) => { setScreen((current) => @@ -88,33 +92,80 @@ export function useAndroidTabSelectedColor() { return theme?.selectedColor ?? defaultPalette.accentText } -/** Keep Android artwork screens and shared bars on the same displayed palette. */ +// Match the default Android medium animation time used by slide_from_right. +// Continue from displayed colors when artwork arrives late or focus changes. +const PALETTE_FADE_MS = 400 + +function useFadingPalette(target: CoverPalette, initial: CoverPalette) { + const [displayed, setDisplayed] = useState(initial) + const current = useRef(initial) + const reducedMotion = useReducedMotion() + + useLayoutEffect(() => { + if (Platform.OS !== "android") return + if (reducedMotion || current.current === target) { + current.current = target + setDisplayed(target) + return + } + const from = current.current + const progress = new Animated.Value(0) + const listener = progress.addListener(({ value }) => { + const color = (key: Exclude) => + interpolateColor(value, [0, 1], [from[key], target[key]], "RGB") + const next: CoverPalette = { + background: color("background"), + foreground: color("foreground"), + secondaryForeground: color("secondaryForeground"), + accent: color("accent"), + accentForeground: color("accentForeground"), + accentText: color("accentText"), + surface: color("surface"), + divider: color("divider"), + isDark: value < 0.5 ? from.isDark : target.isDark, + } + current.current = value === 1 ? target : next + setDisplayed(current.current) + }) + const animation = Animated.timing(progress, { + toValue: 1, + duration: PALETTE_FADE_MS, + easing: Easing.out(Easing.cubic), + useNativeDriver: false, + }) + animation.start() + return () => { + animation.stop() + progress.removeListener(listener) + } + }, [target, reducedMotion]) + + return Platform.OS === "android" ? displayed : target +} + +/** Fade each page independently; shared bars follow the focused page. */ export function useAndroidScreenPalette(palette: CoverPalette) { const isFocused = useIsFocused() const owner = useRoute().key const navigation = useNavigation>>() - const [appeared, setAppeared] = useState(false) - const [leaving, setLeaving] = useState(false) const [laidOut, setLaidOut] = useState(false) + const [closing, setClosing] = useState(false) const onLayout = useCallback(() => setLaidOut(true), []) - const theme = useContext(AndroidTabTheme) - const setPalette = theme?.setPalette - useLayoutEffect(() => { if (Platform.OS !== "android") return - return navigation.addListener("transitionEnd", ({ data }) => { - setAppeared(!data.closing) + const start = navigation.addListener("transitionStart", ({ data }) => { + setClosing(data.closing) }) + return start }, [navigation]) - - usePreventRemove(Platform.OS === "android" && !leaving, ({ repeat }) => { - setLeaving(true) - setPalette?.(null, owner) - // Let the page and bars paint their shared destination colors before the - // native stack removes the page. React blur happens too early for this. - requestAnimationFrame(() => requestAnimationFrame(repeat)) - }) + const defaultPalette = useDefaultPalette() + const theme = useContext(AndroidTabTheme) + const setPalette = theme?.setPalette + const displayed = useFadingPalette( + isFocused && laidOut && !closing ? palette : defaultPalette, + defaultPalette + ) useLayoutEffect(() => { if ( @@ -122,16 +173,15 @@ export function useAndroidScreenPalette(palette: CoverPalette) { !setPalette || !isFocused || !laidOut || - !appeared || - leaving + closing ) return setPalette(palette, owner) return () => setPalette(null, owner) - }, [appeared, isFocused, laidOut, leaving, owner, palette, setPalette]) + }, [closing, laidOut, isFocused, owner, palette, setPalette]) return { - palette: Platform.OS === "android" && theme ? theme.palette : palette, + palette: displayed, onLayout: Platform.OS === "android" ? onLayout : undefined, } } diff --git a/apps/mobile/hooks/use-cover-palette.ts b/apps/mobile/hooks/use-cover-palette.ts index 4fd199b..2c9d889 100644 --- a/apps/mobile/hooks/use-cover-palette.ts +++ b/apps/mobile/hooks/use-cover-palette.ts @@ -95,6 +95,13 @@ function extractSwatches(key: string) { return request } +/** Warm visible artwork colors before a detail page is pushed. */ +export function prefetchCoverPalette(uri: string) { + const key = withCoverImageSize(uri, 64) + if (cachedSwatches(key) !== undefined) return + void extractSwatches(key) +} + /** * Colors for a screen tinted by `uri`'s cover art. Extraction runs once per * cover and is cached on device. Pass `hasCover` as `undefined` while it isn't @@ -138,7 +145,10 @@ export function useCoverPalette( // case the cover changed. const timer = known === undefined - ? setTimeout(() => !cancelled && setWaitedKey(key), COVER_PALETTE_WAIT_MS) + ? setTimeout( + () => !cancelled && setWaitedKey(key), + COVER_PALETTE_WAIT_MS + ) : null void extractSwatches(key).then((next) => { if (!cancelled) show(next ?? known ?? null) @@ -151,7 +161,9 @@ export function useCoverPalette( const palette = useMemo(() => { const fromArt = - hasCover !== false && swatches ? deriveCoverPalette(swatches, isDark) : null + hasCover !== false && swatches + ? deriveCoverPalette(swatches, isDark) + : null return fromArt ?? themeCoverPalette(theme, isDark) }, [hasCover, isDark, swatches, theme]) -- 2.54.1 From 4f3733eecf681a5d0e68e92b200fbd3bc581f89f Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Thu, 5 Nov 2026 17:41:03 -0500 Subject: [PATCH 3/5] fix(mobile): animate artwork backgrounds on the UI thread --- .../app/(app)/(tabs)/home/album/[id].tsx | 21 ++++---- .../app/(app)/(tabs)/home/playlist/[id].tsx | 16 +++++-- apps/mobile/components/mini-player.tsx | 7 ++- apps/mobile/components/skeletons.tsx | 14 ++++-- apps/mobile/contexts/android-tab-theme.tsx | 48 +++++++++++++++++-- 5 files changed, 80 insertions(+), 26 deletions(-) diff --git a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx index 509b9b9..ba37d59 100644 --- a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx @@ -1,16 +1,10 @@ +import Animated from "react-native-reanimated" import { useAndroidScreenPalette } from "@/contexts/android-tab-theme" import { MusicEntityView } from "@/components/music-entity-view" import { Stack, useIsFocused, useLocalSearchParams } from "expo-router" import { StatusBar } from "expo-status-bar" import { memo, useCallback, useEffect, useMemo } from "react" -import { - FlatList, - Platform, - Pressable, - StyleSheet, - Text, - View, -} from "react-native" +import { Platform, Pressable, StyleSheet, Text, View } from "react-native" import { Ionicons } from "@expo/vector-icons" import { @@ -70,7 +64,8 @@ export default function AlbumScreen() { coverUri, album ? album.cover != null : album === null ? false : undefined ) - const { palette, onLayout } = useAndroidScreenPalette(artworkPalette) + const { palette, onLayout, backgroundStyle } = + useAndroidScreenPalette(artworkPalette) const songIds = useMemo( () => album?.tracks.map((track) => track.id as Id<"songs">) ?? [], [album] @@ -145,6 +140,7 @@ export default function AlbumScreen() { /> - { if (songs) rememberSongs(songs) @@ -108,6 +109,7 @@ export default function PlaylistScreen() { /> void + backgroundStyle: ReturnType["backgroundStyle"] playlist: BrowsePlaylistDetail songs: BrowseSong[] coverUri: string @@ -333,13 +338,16 @@ function PlaylistContent({ onQueryChange={onQueryChange} onSearchSubmit={onSearchSubmit} /> - + {children} {hasArtworkPalette ? ( - + ) } diff --git a/apps/mobile/components/skeletons.tsx b/apps/mobile/components/skeletons.tsx index af12d8f..cacb8cc 100644 --- a/apps/mobile/components/skeletons.tsx +++ b/apps/mobile/components/skeletons.tsx @@ -1,4 +1,5 @@ -import { useEffect, useRef, type ReactNode } from "react" +import Reanimated from "react-native-reanimated" +import { useEffect, useRef, type ReactNode, type ComponentProps } from "react" import { Animated, ScrollView, @@ -197,10 +198,12 @@ export function HomeSkeleton() { /** Album and playlist pages: cover, title, play buttons, then tracks. */ export function CollectionDetailSkeleton({ + style, round = false, backgroundColor, onLayout, }: { + style?: ComponentProps["style"] round?: boolean backgroundColor?: string onLayout?: () => void @@ -208,9 +211,12 @@ export function CollectionDetailSkeleton({ const colors = useThemeColors() const coverSize = round ? 180 : 210 return ( - )} - + ) } diff --git a/apps/mobile/contexts/android-tab-theme.tsx b/apps/mobile/contexts/android-tab-theme.tsx index 492c132..5e50641 100644 --- a/apps/mobile/contexts/android-tab-theme.tsx +++ b/apps/mobile/contexts/android-tab-theme.tsx @@ -15,13 +15,21 @@ import { type PropsWithChildren, } from "react" import { Animated, Easing, Platform } from "react-native" -import { interpolateColor, useReducedMotion } from "react-native-reanimated" +import { + interpolateColor, + useReducedMotion, + useSharedValue, + useAnimatedStyle, + withTiming, + type SharedValue, +} from "react-native-reanimated" import { themeCoverPalette, type CoverPalette } from "@/lib/cover-palette" import { useIsDark, useThemeColors } from "@/lib/theme" type TabTheme = { palette: CoverPalette + background: SharedValue selectedColor: string hasArtworkPalette: boolean setPalette: (palette: CoverPalette | null, owner: string) => void @@ -40,6 +48,10 @@ export function AndroidTabThemeProvider({ children }: PropsWithChildren) { palette: CoverPalette owner: string } | null>(null) + const background = useFadingBackground( + screen?.palette.background ?? defaultPalette.background, + defaultPalette.background + ) const palette = useFadingPalette( screen?.palette ?? defaultPalette, defaultPalette @@ -63,11 +75,12 @@ export function AndroidTabThemeProvider({ children }: PropsWithChildren) { const value = useMemo( () => ({ palette: artworkPalette ?? defaultPalette, + background, selectedColor: artworkPalette?.foreground ?? defaultPalette.accentText, hasArtworkPalette: artworkPalette !== null, setPalette, }), - [defaultPalette, artworkPalette, setPalette] + [defaultPalette, artworkPalette, setPalette, background] ) return ( @@ -92,6 +105,25 @@ export function useAndroidTabSelectedColor() { return theme?.selectedColor ?? defaultPalette.accentText } +export function useAndroidTabBackgroundStyle() { + const theme = useContext(AndroidTabTheme) + const fallback = useDefaultPalette().background + return useAnimatedStyle(() => ({ + backgroundColor: theme?.background.value ?? fallback, + })) +} + +/** Run backgrounds on the UI thread even while React is rendering track rows. */ +function useFadingBackground(target: string, initial: string) { + const background = useSharedValue(initial) + useLayoutEffect(() => { + if (Platform.OS === "android") { + background.value = withTiming(target, { duration: PALETTE_FADE_MS }) + } + }, [background, target]) + return background +} + // Match the default Android medium animation time used by slide_from_right. // Continue from displayed colors when artwork arrives late or focus changes. const PALETTE_FADE_MS = 400 @@ -162,9 +194,14 @@ export function useAndroidScreenPalette(palette: CoverPalette) { const defaultPalette = useDefaultPalette() const theme = useContext(AndroidTabTheme) const setPalette = theme?.setPalette - const displayed = useFadingPalette( - isFocused && laidOut && !closing ? palette : defaultPalette, - defaultPalette + const target = isFocused && laidOut && !closing ? palette : defaultPalette + const displayed = useFadingPalette(target, defaultPalette) + const background = useFadingBackground( + target.background, + defaultPalette.background + ) + const backgroundStyle = useAnimatedStyle(() => + Platform.OS === "android" ? { backgroundColor: background.value } : {} ) useLayoutEffect(() => { @@ -182,6 +219,7 @@ export function useAndroidScreenPalette(palette: CoverPalette) { return { palette: displayed, + backgroundStyle, onLayout: Platform.OS === "android" ? onLayout : undefined, } } -- 2.54.1 From 7d4dc9a4de38e714f5653055e45df9cc35b53b8f Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Thu, 5 Nov 2026 17:49:30 -0500 Subject: [PATCH 4/5] fix(mobile): synchronize artwork page and bar backgrounds --- apps/mobile/app/(app)/(tabs)/_layout.tsx | 18 ++++++++--- .../app/(app)/(tabs)/home/album/[id].tsx | 11 +++++-- .../app/(app)/(tabs)/home/playlist/[id].tsx | 11 +++++-- apps/mobile/contexts/android-tab-theme.tsx | 32 +++++++++++-------- 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/apps/mobile/app/(app)/(tabs)/_layout.tsx b/apps/mobile/app/(app)/(tabs)/_layout.tsx index 051a11c..7763f94 100644 --- a/apps/mobile/app/(app)/(tabs)/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/_layout.tsx @@ -1,12 +1,14 @@ +import Animated from "react-native-reanimated" import { NavigationBar } from "expo-navigation-bar" import { AndroidTabThemeProvider, useAndroidTabPalette, + useAndroidTabBackgroundStyle, useAndroidTabSelectedColor, } from "@/contexts/android-tab-theme" import { DarkTheme, DefaultTheme, ThemeProvider } from "expo-router" import { NativeTabs } from "expo-router/native-tabs" -import { DynamicColorIOS, Platform, View } from "react-native" +import { DynamicColorIOS, Platform } from "react-native" import { useMemo } from "react" import { AndroidMiniPlayer, TabBottomAccessory } from "@/components/mini-player" @@ -78,8 +80,8 @@ function useNativeTabColors() { blurEffect: isDark ? "systemChromeMaterialDark" : "systemChromeMaterialLight", - backgroundColor: - Platform.OS === "ios" ? undefined : androidPalette.background, + // Reveal the shared UI-thread background beneath the native tab bar. + backgroundColor: Platform.OS === "ios" ? undefined : "transparent", } } @@ -87,6 +89,7 @@ function TabsContent() { const keyboardVisible = useAndroidKeyboardVisible() const routerTheme = useRouterTheme() const tabColors = useNativeTabColors() + const backgroundStyle = useAndroidTabBackgroundStyle() const { currentSong, queueSongIds } = usePlaybackQueue() const showBottomAccessory = Boolean(currentSong && queueSongIds.length > 0) @@ -101,7 +104,12 @@ function TabsContent() { return ( - + {Platform.OS === "android" ? ( ) : null} @@ -156,7 +164,7 @@ function TabsContent() { {!keyboardVisible ? : null} - + ) } diff --git a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx index ba37d59..4039dea 100644 --- a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx @@ -1,5 +1,8 @@ import Animated from "react-native-reanimated" -import { useAndroidScreenPalette } from "@/contexts/android-tab-theme" +import { + renderAndroidArtworkBackground, + useAndroidScreenPalette, +} from "@/contexts/android-tab-theme" import { MusicEntityView } from "@/components/music-entity-view" import { Stack, useIsFocused, useLocalSearchParams } from "expo-router" import { StatusBar } from "expo-status-bar" @@ -132,7 +135,8 @@ export default function AlbumScreen() { headerLargeTitle: false, ...(Platform.OS === "android" ? { - headerStyle: { backgroundColor: palette.background }, + headerStyle: { backgroundColor: "transparent" }, + headerBackground: renderAndroidArtworkBackground, headerTintColor: palette.foreground, } : {}), @@ -182,7 +186,8 @@ export default function AlbumScreen() { headerTintColor: palette.foreground, ...(Platform.OS === "android" ? { - headerStyle: { backgroundColor: palette.background }, + headerStyle: { backgroundColor: "transparent" }, + headerBackground: renderAndroidArtworkBackground, statusBarStyle: palette.isDark ? ("light" as const) : ("dark" as const), diff --git a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx index 1904b00..7bc89f9 100644 --- a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx @@ -3,7 +3,10 @@ import { PlaylistSearchBar, usePlaylistSearch, } from "@/components/playlist-search-bar" -import { useAndroidScreenPalette } from "@/contexts/android-tab-theme" +import { + renderAndroidArtworkBackground, + useAndroidScreenPalette, +} from "@/contexts/android-tab-theme" import { MusicEntityView } from "@/components/music-entity-view" import { useMutation } from "convex/react" import { memo, useCallback, useEffect, useMemo } from "react" @@ -101,7 +104,8 @@ export default function PlaylistScreen() { headerLargeTitle: false, ...(Platform.OS === "android" ? { - headerStyle: { backgroundColor: palette.background }, + headerStyle: { backgroundColor: "transparent" }, + headerBackground: renderAndroidArtworkBackground, headerTintColor: palette.foreground, } : {}), @@ -263,7 +267,8 @@ function PlaylistContent({ headerTintColor: palette.foreground, ...(Platform.OS === "android" ? { - headerStyle: { backgroundColor: palette.background }, + headerStyle: { backgroundColor: "transparent" }, + headerBackground: renderAndroidArtworkBackground, statusBarStyle: palette.isDark ? ("light" as const) : ("dark" as const), diff --git a/apps/mobile/contexts/android-tab-theme.tsx b/apps/mobile/contexts/android-tab-theme.tsx index 5e50641..0435951 100644 --- a/apps/mobile/contexts/android-tab-theme.tsx +++ b/apps/mobile/contexts/android-tab-theme.tsx @@ -14,8 +14,8 @@ import { useRef, type PropsWithChildren, } from "react" -import { Animated, Easing, Platform } from "react-native" -import { +import { Animated, Easing, Platform, StyleSheet } from "react-native" +import Reanimated, { interpolateColor, useReducedMotion, useSharedValue, @@ -108,9 +108,21 @@ export function useAndroidTabSelectedColor() { export function useAndroidTabBackgroundStyle() { const theme = useContext(AndroidTabTheme) const fallback = useDefaultPalette().background - return useAnimatedStyle(() => ({ - backgroundColor: theme?.background.value ?? fallback, - })) + return useAnimatedStyle(() => + Platform.OS === "android" + ? { backgroundColor: theme?.background.value ?? fallback } + : {} + ) +} + +/** Native headers draw this same UI-thread background as the page and bars. */ +function AndroidArtworkBackground() { + const style = useAndroidTabBackgroundStyle() + return +} + +export function renderAndroidArtworkBackground() { + return } /** Run backgrounds on the UI thread even while React is rendering track rows. */ @@ -175,7 +187,7 @@ function useFadingPalette(target: CoverPalette, initial: CoverPalette) { return Platform.OS === "android" ? displayed : target } -/** Fade each page independently; shared bars follow the focused page. */ +/** The focused artwork screen selects the shared background for page and bars. */ export function useAndroidScreenPalette(palette: CoverPalette) { const isFocused = useIsFocused() const owner = useRoute().key @@ -196,13 +208,7 @@ export function useAndroidScreenPalette(palette: CoverPalette) { const setPalette = theme?.setPalette const target = isFocused && laidOut && !closing ? palette : defaultPalette const displayed = useFadingPalette(target, defaultPalette) - const background = useFadingBackground( - target.background, - defaultPalette.background - ) - const backgroundStyle = useAnimatedStyle(() => - Platform.OS === "android" ? { backgroundColor: background.value } : {} - ) + const backgroundStyle = useAndroidTabBackgroundStyle() useLayoutEffect(() => { if ( -- 2.54.1 From c91bf600cbac9ee179b7d5fe9c6e868db0d6768e Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Thu, 5 Nov 2026 21:30:23 -0500 Subject: [PATCH 5/5] fix(mobile): fade artwork text colors on the UI thread --- apps/mobile/app/(app)/(tabs)/_layout.tsx | 26 ++- .../app/(app)/(tabs)/home/album/[id].tsx | 84 +++++--- .../app/(app)/(tabs)/home/playlist/[id].tsx | 57 ++++-- apps/mobile/components/audio-format-badge.tsx | 12 +- apps/mobile/components/collection-list.tsx | 10 +- apps/mobile/components/mini-player.tsx | 39 ++-- apps/mobile/components/palette-text.tsx | 49 +++++ apps/mobile/components/player.tsx | 20 +- apps/mobile/components/ui/primitives.tsx | 17 +- apps/mobile/contexts/android-tab-theme.tsx | 189 +++++++++--------- 10 files changed, 337 insertions(+), 166 deletions(-) create mode 100644 apps/mobile/components/palette-text.tsx diff --git a/apps/mobile/app/(app)/(tabs)/_layout.tsx b/apps/mobile/app/(app)/(tabs)/_layout.tsx index 7763f94..261251f 100644 --- a/apps/mobile/app/(app)/(tabs)/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/_layout.tsx @@ -4,7 +4,7 @@ import { AndroidTabThemeProvider, useAndroidTabPalette, useAndroidTabBackgroundStyle, - useAndroidTabSelectedColor, + useAndroidNativeTabColors, } from "@/contexts/android-tab-theme" import { DarkTheme, DefaultTheme, ThemeProvider } from "expo-router" import { NativeTabs } from "expo-router/native-tabs" @@ -43,10 +43,12 @@ function useRouterTheme() { } function useNativeTabColors() { - const selectedColor = useAndroidTabSelectedColor() + // These props initialize native tabs; the worklet owns subsequent colors. + const selectedColor = colors.dark.primary const themeIsDark = useIsDark() - const androidPalette = useAndroidTabPalette() - const isDark = Platform.OS === "android" ? androidPalette.isDark : themeIsDark + const androidPalette = colors.dark + const artworkPalette = useAndroidTabPalette() + const isDark = Platform.OS === "android" ? artworkPalette.isDark : themeIsDark const inactive = appleMusic.tabInactive const iconColor = @@ -56,14 +58,14 @@ function useNativeTabColors() { selected: appleMusic.pink, } : { - default: androidPalette.secondaryForeground, + default: androidPalette.mutedForeground, selected: selectedColor, } const labelColor = Platform.OS === "ios" ? DynamicColorIOS({ dark: inactive, light: "#636366" }) - : androidPalette.secondaryForeground + : androidPalette.mutedForeground return { isDark, @@ -86,6 +88,9 @@ function useNativeTabColors() { } function TabsContent() { + const homeColors = useAndroidNativeTabColors() + const libraryColors = useAndroidNativeTabColors() + const searchColors = useAndroidNativeTabColors() const keyboardVisible = useAndroidKeyboardVisible() const routerTheme = useRouterTheme() const tabColors = useNativeTabColors() @@ -135,6 +140,9 @@ function TabsContent() { @@ -144,6 +152,9 @@ function TabsContent() { @@ -156,6 +167,9 @@ function TabsContent() { diff --git a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx index 4039dea..92fea11 100644 --- a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx @@ -1,3 +1,8 @@ +import { + PaletteText, + PaletteIcon, + renderArtworkBackButton, +} from "@/components/palette-text" import Animated from "react-native-reanimated" import { renderAndroidArtworkBackground, @@ -7,8 +12,7 @@ import { MusicEntityView } from "@/components/music-entity-view" import { Stack, useIsFocused, useLocalSearchParams } from "expo-router" import { StatusBar } from "expo-status-bar" import { memo, useCallback, useEffect, useMemo } from "react" -import { Platform, Pressable, StyleSheet, Text, View } from "react-native" -import { Ionicons } from "@expo/vector-icons" +import { Platform, Pressable, StyleSheet, View } from "react-native" import { CollectionDivider, @@ -137,6 +141,8 @@ export default function AlbumScreen() { ? { headerStyle: { backgroundColor: "transparent" }, headerBackground: renderAndroidArtworkBackground, + headerBackVisible: false, + headerLeft: renderArtworkBackButton, headerTintColor: palette.foreground, } : {}), @@ -163,9 +169,9 @@ export default function AlbumScreen() { }} /> - + Album not found. - + ) @@ -188,6 +194,8 @@ export default function AlbumScreen() { ? { headerStyle: { backgroundColor: "transparent" }, headerBackground: renderAndroidArtworkBackground, + headerBackVisible: false, + headerLeft: renderArtworkBackButton, statusBarStyle: palette.isDark ? ("light" as const) : ("dark" as const), @@ -209,7 +217,8 @@ export default function AlbumScreen() { } > - - + {album.title} - + push(`/artist/${album.artist.id}`)} style={styles.artistPressable} > - + {album.artist.name} - + {metadata ? ( - + {metadata} - + ) : null} {hasLossless ? ( <> {metadata ? ( - + · - + ) : null} {metadata || hasLossless ? ( - + · - + ) : null} - - void onPlay(track.id as Id<"songs">, songIds)} > - {number} - + - {track.title} - + {track.artists ? ( - {track.artists.join(", ")} - + ) : null} - + {formatDuration(track.durationSeconds)} - + diff --git a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx index 7bc89f9..2cfdfed 100644 --- a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx @@ -1,3 +1,8 @@ +import { + PaletteText, + PaletteIcon, + renderArtworkBackButton, +} from "@/components/palette-text" import Animated from "react-native-reanimated" import { PlaylistSearchBar, @@ -21,12 +26,10 @@ import { Platform, Pressable, StyleSheet, - Text, View, type ListRenderItemInfo, } from "react-native" import ReanimatedSwipeable from "react-native-gesture-handler/ReanimatedSwipeable" -import { Ionicons } from "@expo/vector-icons" import { CollectionDivider } from "@/components/collection-list" import { CoverImage } from "@/components/cover-image" @@ -106,6 +109,8 @@ export default function PlaylistScreen() { ? { headerStyle: { backgroundColor: "transparent" }, headerBackground: renderAndroidArtworkBackground, + headerBackVisible: false, + headerLeft: renderArtworkBackButton, headerTintColor: palette.foreground, } : {}), @@ -132,9 +137,9 @@ export default function PlaylistScreen() { }} /> - + Playlist not found. - + ) @@ -269,6 +274,8 @@ function PlaylistContent({ ? { headerStyle: { backgroundColor: "transparent" }, headerBackground: renderAndroidArtworkBackground, + headerBackVisible: false, + headerLeft: renderArtworkBackButton, statusBarStyle: palette.isDark ? ("light" as const) : ("dark" as const), @@ -287,7 +294,8 @@ function PlaylistContent({ onAction={handlePlaylistMenuAction} > - {songs.length ? "No songs found." : "No songs in this playlist."} - + } ListHeaderComponent={ - - + Remove - + )} > @@ -505,10 +518,18 @@ const PlaylistHero = memo(function PlaylistHero({ - + {title} - - {ownerName} + + + {ownerName} + {showSubscribe ? ( - - + diff --git a/apps/mobile/components/audio-format-badge.tsx b/apps/mobile/components/audio-format-badge.tsx index 0a977c9..f2de453 100644 --- a/apps/mobile/components/audio-format-badge.tsx +++ b/apps/mobile/components/audio-format-badge.tsx @@ -1,4 +1,5 @@ -import { StyleSheet, Text, View } from "react-native" +import { PaletteText } from "@/components/palette-text" +import { StyleSheet, View } from "react-native" import Svg, { G, Path } from "react-native-svg" import type { PlaybackFormat } from "@otunes/convex/playback-stream" @@ -74,10 +75,12 @@ function LosslessMark({ /** The Dolby Atmos or Lossless label shown under the progress bar. */ export function AudioFormatBadge({ + artwork = false, format, color, backgroundColor, }: { + artwork?: boolean format: PlaybackFormat color: string backgroundColor: string @@ -90,7 +93,12 @@ export function AudioFormatBadge({ ) : ( )} - {label} + + {label} + ) } diff --git a/apps/mobile/components/collection-list.tsx b/apps/mobile/components/collection-list.tsx index ff04e4c..a11ac37 100644 --- a/apps/mobile/components/collection-list.tsx +++ b/apps/mobile/components/collection-list.tsx @@ -1,5 +1,6 @@ +import { PaletteText } from "@/components/palette-text" import { memo } from "react" -import { StyleSheet, Text, View } from "react-native" +import { StyleSheet, View } from "react-native" import { useThemeColors } from "@/lib/theme" @@ -25,9 +26,12 @@ export const DiscHeader = memo(function DiscHeader({ }) { const colors = useThemeColors() return ( - + {label} - + ) }) diff --git a/apps/mobile/components/mini-player.tsx b/apps/mobile/components/mini-player.tsx index 7c1adeb..8f936fb 100644 --- a/apps/mobile/components/mini-player.tsx +++ b/apps/mobile/components/mini-player.tsx @@ -1,13 +1,13 @@ +import { PaletteText, PaletteIcon } from "@/components/palette-text" import Animated from "react-native-reanimated" import { useAndroidTabPalette, useAndroidTabBackgroundStyle, useAndroidTabHasArtworkPalette, } from "@/contexts/android-tab-theme" -import { Ionicons } from "@expo/vector-icons" import { NativeTabs } from "expo-router/native-tabs" import { useRouter } from "expo-router" -import { Platform, Pressable, StyleSheet, Text, View } from "react-native" +import { Platform, Pressable, StyleSheet, View } from "react-native" import { useSafeAreaInsets } from "react-native-safe-area-context" @@ -67,7 +67,8 @@ function MiniPlayerContent({ - {currentSong.title} - + - - {currentSong.title} - - + {currentSong.artist.name} - + {Platform.OS === "android" && !isAccessory ? ( @@ -134,7 +138,12 @@ function MiniPlayerContent({ }} hitSlop={6} > - + ) : null} - - + diff --git a/apps/mobile/components/palette-text.tsx b/apps/mobile/components/palette-text.tsx new file mode 100644 index 0000000..0c7934c --- /dev/null +++ b/apps/mobile/components/palette-text.tsx @@ -0,0 +1,49 @@ +import { Ionicons } from "@expo/vector-icons" +import type { ComponentProps } from "react" +import { Pressable, type TextProps } from "react-native" +import { useRouter } from "expo-router" +import Animated from "react-native-reanimated" + +import { + useAnimatedPaletteColor, + type PaletteColor, +} from "@/contexts/android-tab-theme" + +const AnimatedIcon = Animated.createAnimatedComponent(Ionicons) + +/** Keep artwork text colors on the same UI-thread animation as the background. */ +export function PaletteText({ + tone, + style, + ...props +}: TextProps & { tone?: PaletteColor }) { + const colorStyle = useAnimatedPaletteColor(tone) + return +} + +export function PaletteIcon({ + tone, + style, + ...props +}: ComponentProps & { tone?: PaletteColor }) { + const colorStyle = useAnimatedPaletteColor(tone) + return +} + +function ArtworkBackButton() { + const router = useRouter() + return ( + router.back()} + > + + + ) +} + +export function renderArtworkBackButton() { + return +} diff --git a/apps/mobile/components/player.tsx b/apps/mobile/components/player.tsx index 2d074ad..f5e38a1 100644 --- a/apps/mobile/components/player.tsx +++ b/apps/mobile/components/player.tsx @@ -1,3 +1,4 @@ +import { PaletteText } from "@/components/palette-text" import { MusicEntityView } from "@/components/music-entity-view" import { collectionInset } from "@/components/collection-list" import { CoverImage } from "@/components/cover-image" @@ -8,7 +9,7 @@ import { formatDuration } from "@/lib/format" import { albumCoverUrl } from "@/lib/urls" import { miniPlayerHeight, spacing, useThemeColors } from "@/lib/theme" import { memo, useCallback } from "react" -import { Platform, Pressable, StyleSheet, Text, View } from "react-native" +import { Platform, Pressable, StyleSheet, View } from "react-native" import { MediaContextMenu, @@ -46,22 +47,27 @@ export const SongRow = memo(function SongRow({ const content = ( <> - {song.title} - - + {song.artist.name} · {song.album.title} - + - + {formatDuration(song.durationSeconds)} - + {trailing} ) diff --git a/apps/mobile/components/ui/primitives.tsx b/apps/mobile/components/ui/primitives.tsx index 2ab15f4..3ec1da4 100644 --- a/apps/mobile/components/ui/primitives.tsx +++ b/apps/mobile/components/ui/primitives.tsx @@ -1,3 +1,4 @@ +import { PaletteText, PaletteIcon } from "@/components/palette-text" import { ActivityIndicator, Platform, @@ -73,8 +74,20 @@ export function Button({ ) : ( - {icon ? : null} - {title} + {icon ? ( + + ) : null} + + {title} + )} diff --git a/apps/mobile/contexts/android-tab-theme.tsx b/apps/mobile/contexts/android-tab-theme.tsx index 0435951..fec457d 100644 --- a/apps/mobile/contexts/android-tab-theme.tsx +++ b/apps/mobile/contexts/android-tab-theme.tsx @@ -11,15 +11,16 @@ import { useLayoutEffect, useMemo, useState, - useRef, type PropsWithChildren, } from "react" -import { Animated, Easing, Platform, StyleSheet } from "react-native" +import { Platform, StyleSheet, type HostInstance } from "react-native" import Reanimated, { - interpolateColor, - useReducedMotion, useSharedValue, useAnimatedStyle, + useAnimatedReaction, + useAnimatedRef, + setNativeProps, + processColor, withTiming, type SharedValue, } from "react-native-reanimated" @@ -27,10 +28,14 @@ import Reanimated, { import { themeCoverPalette, type CoverPalette } from "@/lib/cover-palette" import { useIsDark, useThemeColors } from "@/lib/theme" +export type PaletteColor = Exclude +type PaletteColors = Pick & { + selectedColor: string +} + type TabTheme = { palette: CoverPalette - background: SharedValue - selectedColor: string + colors: SharedValue hasArtworkPalette: boolean setPalette: (palette: CoverPalette | null, owner: string) => void } @@ -48,14 +53,30 @@ export function AndroidTabThemeProvider({ children }: PropsWithChildren) { palette: CoverPalette owner: string } | null>(null) - const background = useFadingBackground( - screen?.palette.background ?? defaultPalette.background, - defaultPalette.background - ) - const palette = useFadingPalette( - screen?.palette ?? defaultPalette, - defaultPalette - ) + const palette = screen?.palette ?? defaultPalette + const hasArtwork = + palette.background !== defaultPalette.background || + palette.foreground !== defaultPalette.foreground || + palette.secondaryForeground !== defaultPalette.secondaryForeground || + palette.accent !== defaultPalette.accent + const { isDark: _defaultIsDark, ...defaultColors } = defaultPalette + const animatedColors = useSharedValue({ + ...defaultColors, + selectedColor: defaultPalette.accentText, + }) + useLayoutEffect(() => { + if (Platform.OS !== "android") return + const { isDark: _isDark, ...colors } = palette + animatedColors.value = withTiming( + { + ...colors, + selectedColor: hasArtwork + ? palette.foreground + : defaultPalette.accentText, + }, + { duration: PALETTE_FADE_MS } + ) + }, [animatedColors, palette, defaultPalette, hasArtwork]) const setPalette = useCallback( (palette: CoverPalette | null, owner: string) => { setScreen((current) => @@ -64,23 +85,15 @@ export function AndroidTabThemeProvider({ children }: PropsWithChildren) { }, [] ) - const artworkPalette = - palette && - (palette.background !== defaultPalette.background || - palette.foreground !== defaultPalette.foreground || - palette.secondaryForeground !== defaultPalette.secondaryForeground || - palette.accent !== defaultPalette.accent) - ? palette - : null + const artworkPalette = hasArtwork ? palette : null const value = useMemo( () => ({ palette: artworkPalette ?? defaultPalette, - background, - selectedColor: artworkPalette?.foreground ?? defaultPalette.accentText, + colors: animatedColors, hasArtworkPalette: artworkPalette !== null, setPalette, }), - [defaultPalette, artworkPalette, setPalette, background] + [defaultPalette, artworkPalette, setPalette, animatedColors] ) return ( @@ -89,6 +102,50 @@ export function AndroidTabThemeProvider({ children }: PropsWithChildren) { ) } +/** + * NativeTabs forwards raw screen props to its Fabric screen. Bind that host + * directly so appearance updates stay on the UI thread with the page colors. + */ +export function useAndroidNativeTabColors() { + const colors = useContext(AndroidTabTheme)?.colors + const ref = useAnimatedRef() + const mounted = useSharedValue(false) + const attach = useCallback( + (host: HostInstance | null) => { + if (host) ref(host) + mounted.value = host !== null + }, + [ref, mounted] + ) + + useAnimatedReaction( + () => ({ colors: colors?.value, mounted: mounted.value }), + ({ colors: palette, mounted: ready }) => { + if (Platform.OS !== "android" || !ready || !palette) return + const normal = processColor(palette.secondaryForeground) + const selected = processColor(palette.selectedColor) + setNativeProps(ref, { + standardAppearance: { + tabBarBackgroundColor: processColor("transparent"), + tabBarItemRippleColor: selected, + tabBarItemActiveIndicatorEnabled: false, + tabBarItemTitleSmallLabelFontSize: 10, + tabBarItemTitleLargeLabelFontSize: 10, + normal: { + tabBarItemTitleFontColor: normal, + tabBarItemIconColor: normal, + }, + selected: { + tabBarItemTitleFontColor: selected, + tabBarItemIconColor: selected, + }, + }, + }) + } + ) + return { ref: attach, style: { backgroundColor: "transparent" } } +} + export function useAndroidTabPalette() { const theme = useContext(AndroidTabTheme) const defaultPalette = useDefaultPalette() @@ -99,18 +156,23 @@ export function useAndroidTabHasArtworkPalette() { return useContext(AndroidTabTheme)?.hasArtworkPalette ?? false } -export function useAndroidTabSelectedColor() { - const theme = useContext(AndroidTabTheme) - const defaultPalette = useDefaultPalette() - return theme?.selectedColor ?? defaultPalette.accentText -} - export function useAndroidTabBackgroundStyle() { const theme = useContext(AndroidTabTheme) const fallback = useDefaultPalette().background + const colors = theme?.colors return useAnimatedStyle(() => Platform.OS === "android" - ? { backgroundColor: theme?.background.value ?? fallback } + ? { backgroundColor: colors?.value.background ?? fallback } + : {} + ) +} + +/** Color tokens share the background's UI-thread timing. */ +export function useAnimatedPaletteColor(tone: PaletteColor | undefined) { + const colors = useContext(AndroidTabTheme)?.colors + return useAnimatedStyle(() => + Platform.OS === "android" && tone && colors + ? { color: colors.value[tone] } : {} ) } @@ -125,68 +187,8 @@ export function renderAndroidArtworkBackground() { return } -/** Run backgrounds on the UI thread even while React is rendering track rows. */ -function useFadingBackground(target: string, initial: string) { - const background = useSharedValue(initial) - useLayoutEffect(() => { - if (Platform.OS === "android") { - background.value = withTiming(target, { duration: PALETTE_FADE_MS }) - } - }, [background, target]) - return background -} - -// Match the default Android medium animation time used by slide_from_right. -// Continue from displayed colors when artwork arrives late or focus changes. const PALETTE_FADE_MS = 400 -function useFadingPalette(target: CoverPalette, initial: CoverPalette) { - const [displayed, setDisplayed] = useState(initial) - const current = useRef(initial) - const reducedMotion = useReducedMotion() - - useLayoutEffect(() => { - if (Platform.OS !== "android") return - if (reducedMotion || current.current === target) { - current.current = target - setDisplayed(target) - return - } - const from = current.current - const progress = new Animated.Value(0) - const listener = progress.addListener(({ value }) => { - const color = (key: Exclude) => - interpolateColor(value, [0, 1], [from[key], target[key]], "RGB") - const next: CoverPalette = { - background: color("background"), - foreground: color("foreground"), - secondaryForeground: color("secondaryForeground"), - accent: color("accent"), - accentForeground: color("accentForeground"), - accentText: color("accentText"), - surface: color("surface"), - divider: color("divider"), - isDark: value < 0.5 ? from.isDark : target.isDark, - } - current.current = value === 1 ? target : next - setDisplayed(current.current) - }) - const animation = Animated.timing(progress, { - toValue: 1, - duration: PALETTE_FADE_MS, - easing: Easing.out(Easing.cubic), - useNativeDriver: false, - }) - animation.start() - return () => { - animation.stop() - progress.removeListener(listener) - } - }, [target, reducedMotion]) - - return Platform.OS === "android" ? displayed : target -} - /** The focused artwork screen selects the shared background for page and bars. */ export function useAndroidScreenPalette(palette: CoverPalette) { const isFocused = useIsFocused() @@ -207,7 +209,6 @@ export function useAndroidScreenPalette(palette: CoverPalette) { const theme = useContext(AndroidTabTheme) const setPalette = theme?.setPalette const target = isFocused && laidOut && !closing ? palette : defaultPalette - const displayed = useFadingPalette(target, defaultPalette) const backgroundStyle = useAndroidTabBackgroundStyle() useLayoutEffect(() => { @@ -224,7 +225,7 @@ export function useAndroidScreenPalette(palette: CoverPalette) { }, [closing, laidOut, isFocused, owner, palette, setPalette]) return { - palette: displayed, + palette: Platform.OS === "android" ? target : palette, backgroundStyle, onLayout: Platform.OS === "android" ? onLayout : undefined, } -- 2.54.1