diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index b354d4b..e21b499 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -73,6 +73,25 @@ function App() { getBookmarkedUrls().then(setBookmarkedUrls).catch(() => {}); }, []); + // On iOS, overscroll (rubber-band) reveals the html/body background. + // When the home page has a full-screen background image, force html+body + // to black so the overscroll area matches instead of flashing white. + const isHomeWithBg = !hasSearched && !!(bgInfo?.enabled && bgInfo?.url); + useEffect(() => { + const el = document.documentElement; + if (isHomeWithBg) { + el.style.backgroundColor = "#000"; + document.body.style.backgroundColor = "#000"; + } else { + el.style.backgroundColor = ""; + document.body.style.backgroundColor = ""; + } + return () => { + el.style.backgroundColor = ""; + document.body.style.backgroundColor = ""; + }; + }, [isHomeWithBg]); + const doSearch = useCallback( async (q: string, cat: Category = category, p: number = 1, size: ImageSize = imageSize, updateUrl = true) => { if (!q.trim()) return; @@ -252,11 +271,11 @@ function App() { // Home page (no search yet) if (!hasSearched) { return ( -