From 0dc3e225e05a0635324a80de7a1a196658725513 Mon Sep 17 00:00:00 2001 From: "S. Jansen" Date: Mon, 31 Oct 2022 09:48:54 +0200 Subject: [PATCH 1/2] fix: Don't update header titles outside useLayoutEffect --- source/gui/screens/documents/document/SingleDocument.tsx | 8 +------- source/gui/screens/songs/song/SongDisplayScreen.tsx | 4 ---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/source/gui/screens/documents/document/SingleDocument.tsx b/source/gui/screens/documents/document/SingleDocument.tsx index 174d0d05..82c0ce0c 100644 --- a/source/gui/screens/documents/document/SingleDocument.tsx +++ b/source/gui/screens/documents/document/SingleDocument.tsx @@ -62,9 +62,6 @@ const SingleDocument: React.FC> = const onBlur = () => { keepScreenAwake(false); setDocument(undefined); - navigation.setOptions({ - title: "" - }); }; useEffect(() => { @@ -78,7 +75,7 @@ const SingleDocument: React.FC> = setTimeout(() => scrollToTop(), 150); }, [document?.id]); - useEffect(() => { + React.useLayoutEffect(() => { if (document === undefined) { navigation.setOptions({ title: "" @@ -109,9 +106,6 @@ const SingleDocument: React.FC> = } setDocument(newDocument); - navigation.setOptions({ - title: newDocument?.name - }); }; const animate = () => { diff --git a/source/gui/screens/songs/song/SongDisplayScreen.tsx b/source/gui/screens/songs/song/SongDisplayScreen.tsx index 4e65673c..a1347a7b 100644 --- a/source/gui/screens/songs/song/SongDisplayScreen.tsx +++ b/source/gui/screens/songs/song/SongDisplayScreen.tsx @@ -73,10 +73,6 @@ const SongDisplayScreen: React.FC = ({ route, navigation }) => { const onBlur = () => { keepScreenAwake(false); setSong(undefined); - navigation.setOptions({ - title: "", - headerRight: undefined - }); }; useEffect(() => { From b35cc6b8f66e011d337f191d89fedf149b3634f0 Mon Sep 17 00:00:00 2001 From: "S. Jansen" Date: Mon, 31 Oct 2022 09:48:54 +0200 Subject: [PATCH 2/2] fix: Don't update header titles outside useLayoutEffect --- source/gui/screens/documents/document/SingleDocument.tsx | 8 +------- source/gui/screens/songs/song/SongDisplayScreen.tsx | 4 ---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/source/gui/screens/documents/document/SingleDocument.tsx b/source/gui/screens/documents/document/SingleDocument.tsx index 174d0d05..82c0ce0c 100644 --- a/source/gui/screens/documents/document/SingleDocument.tsx +++ b/source/gui/screens/documents/document/SingleDocument.tsx @@ -62,9 +62,6 @@ const SingleDocument: React.FC> = const onBlur = () => { keepScreenAwake(false); setDocument(undefined); - navigation.setOptions({ - title: "" - }); }; useEffect(() => { @@ -78,7 +75,7 @@ const SingleDocument: React.FC> = setTimeout(() => scrollToTop(), 150); }, [document?.id]); - useEffect(() => { + React.useLayoutEffect(() => { if (document === undefined) { navigation.setOptions({ title: "" @@ -109,9 +106,6 @@ const SingleDocument: React.FC> = } setDocument(newDocument); - navigation.setOptions({ - title: newDocument?.name - }); }; const animate = () => { diff --git a/source/gui/screens/songs/song/SongDisplayScreen.tsx b/source/gui/screens/songs/song/SongDisplayScreen.tsx index 40db8eb7..30682c01 100644 --- a/source/gui/screens/songs/song/SongDisplayScreen.tsx +++ b/source/gui/screens/songs/song/SongDisplayScreen.tsx @@ -73,10 +73,6 @@ const SongDisplayScreen: React.FC = ({ route, navigation }) => { const onBlur = () => { keepScreenAwake(false); setSong(undefined); - navigation.setOptions({ - title: "", - headerRight: undefined - }); }; useEffect(() => {