fix(mobile): fast Android page fades with artwork colors #108

Merged
joshuafhiggins merged 3 commits from t3/simplify-android-transitions into main 2026-11-16 22:07:52 -05:00
Owner

On Android, artwork colors on album and playlist pages popped in after the slide transition finished. The background, header, tab bar and text each changed at a different moment. #75 brought the slide transitions back, but added about 490 lines of animated palette machinery to do it: a Reanimated shared palette that pushed the whole tab standardAppearance through setNativeProps on every frame, palette animations started from two places, PaletteText/PaletteIcon wrappers, and unstable_nativeProps on each tab trigger.

This replaces that with a simpler model:

  • Each pushed album/playlist page paints its own artwork palette (background, header, text, icons), so the colors slide in and out with the page.
  • Shared chrome (the tab bar and mini player) switches palettes once, on the stack's transitionStart event, and reverts on gestureCancel. Nothing updates per frame.
  • Deleted palette-text.tsx, the per-frame native tab color hook, unstable_nativeProps, and the transparent header/tab bar backgrounds. iPad keeps its 400ms sidebar fade through a small useTabletBackgroundStyle.

Transition and cache follow-ups

  • Android page transitions are now a 100ms fade through black (old page out in 50ms, new page in over the next 50ms), replacing the ~400ms slide. Android ignores animationDuration, so plugins/with-android-fast-fade.js writes app-level overrides of react-native-screens' rns_fade_in/rns_fade_out resources. App resources take precedence over library ones, so the library and its patch are untouched. This needs a native rebuild.
  • Toggling "New artwork colors" in settings now clears cached palettes (in memory and the persisted palette: entries) for both algorithms, so covers are re-extracted with the selected one. Adds clearCachePrefix to the persistent cache.

Verification (Android emulator, API 37)

  • tsc --noEmit passes for apps/mobile.
  • Fade transition: fade.mp4. Pages appear fully colored with the tab bar already matching. Emulator screenrecord only encodes changed frames, so it can't show the exact 100ms timing.
  • Slide-era before/after videos: before.mp4, after.mp4. Before: the page slides in on black, then the background, header, tab bar and buttons fill in separately. After: each page arrives fully colored and slides out with its color. The tab bar switches when the transition starts.

Not verified / known gaps

  • The settings toggle's cache clear was typechecked but not exercised on device.
  • iPad and iOS were not run (iOS keeps its native push). The iPad fade code path is preserved but untested.
  • Playlist pages use the same hook but I only recorded albums.
  • Pre-existing, not touched here: on a cover whose persisted swatches differ from a fresh extraction, useCoverPalette repaints the page about 2s after it opens. It shows on the first album in both videos. It lives in the palette cache, not navigation, so I'm leaving it for a separate fix.
  • The tab ripple and the … menu button color are handled in their own PRs.

Changes made by Claude Opus 5.5 (Claude Code, via T3 Code).

🤖 Generated with Claude Code

On Android, artwork colors on album and playlist pages popped in after the slide transition finished. The background, header, tab bar and text each changed at a different moment. #75 brought the slide transitions back, but added about 490 lines of animated palette machinery to do it: a Reanimated shared palette that pushed the whole tab `standardAppearance` through `setNativeProps` on every frame, palette animations started from two places, `PaletteText`/`PaletteIcon` wrappers, and `unstable_nativeProps` on each tab trigger. This replaces that with a simpler model: - Each pushed album/playlist page paints its own artwork palette (background, header, text, icons), so the colors slide in and out with the page. - Shared chrome (the tab bar and mini player) switches palettes once, on the stack's `transitionStart` event, and reverts on `gestureCancel`. Nothing updates per frame. - Deleted `palette-text.tsx`, the per-frame native tab color hook, `unstable_nativeProps`, and the transparent header/tab bar backgrounds. iPad keeps its 400ms sidebar fade through a small `useTabletBackgroundStyle`. **Transition and cache follow-ups** - Android page transitions are now a 100ms fade through black (old page out in 50ms, new page in over the next 50ms), replacing the ~400ms slide. Android ignores `animationDuration`, so `plugins/with-android-fast-fade.js` writes app-level overrides of react-native-screens' `rns_fade_in`/`rns_fade_out` resources. App resources take precedence over library ones, so the library and its patch are untouched. This needs a native rebuild. - Toggling "New artwork colors" in settings now clears cached palettes (in memory and the persisted `palette:` entries) for both algorithms, so covers are re-extracted with the selected one. Adds `clearCachePrefix` to the persistent cache. **Verification (Android emulator, API 37)** - `tsc --noEmit` passes for `apps/mobile`. - Fade transition: [fade.mp4](https://gitcoffee.dev/attachments/18181e3e-4f72-4fbc-8c20-d91a13d80be2). Pages appear fully colored with the tab bar already matching. Emulator screenrecord only encodes changed frames, so it can't show the exact 100ms timing. - Slide-era before/after videos: [before.mp4](https://gitcoffee.dev/attachments/5533515f-fe73-4daa-9e8e-63738ff8ed2e), [after.mp4](https://gitcoffee.dev/attachments/3577a227-94c3-4ebe-b66f-b7ce3d1f4886). Before: the page slides in on black, then the background, header, tab bar and buttons fill in separately. After: each page arrives fully colored and slides out with its color. The tab bar switches when the transition starts. **Not verified / known gaps** - The settings toggle's cache clear was typechecked but not exercised on device. - iPad and iOS were not run (iOS keeps its native push). The iPad fade code path is preserved but untested. - Playlist pages use the same hook but I only recorded albums. - Pre-existing, not touched here: on a cover whose persisted swatches differ from a fresh extraction, `useCoverPalette` repaints the page about 2s after it opens. It shows on the first album in both videos. It lives in the palette cache, not navigation, so I'm leaving it for a separate fix. - The tab ripple and the `…` menu button color are handled in their own PRs. Changes made by Claude Opus 5.5 (Claude Code, via T3 Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
4.7 MiB
4.0 MiB
2.1 MiB
joshuafhiggins added 1 commit 2026-11-16 20:44:54 -05:00
joshuafhiggins added 1 commit 2026-11-16 21:40:54 -05:00
Replace the 400ms slide with a 100ms fade through black, set via app-level
overrides of react-native-screens' fade anim resources.

Clear cached artwork palettes when the artwork color setting changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joshuafhiggins changed title from fix(mobile): simplify Android artwork colors during page transitions to fix(mobile): fast Android page fades with artwork colors 2026-11-16 21:41:03 -05:00
joshuafhiggins added 1 commit 2026-11-16 22:07:46 -05:00
# Conflicts:
#	apps/mobile/app/(app)/(tabs)/home/album/[id].tsx
#	apps/mobile/app/(app)/(tabs)/home/settings.tsx
#	apps/mobile/hooks/use-cover-palette.ts
#	apps/mobile/hooks/use-legacy-cover-palette.ts
joshuafhiggins merged commit 0cc756396f into main 2026-11-16 22:07:52 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joshuafhiggins/otunes#108