about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-05-02 21:27:54 +0100
committerGitHub <noreply@github.com>2024-05-02 21:27:54 +0100
commit6da18e3dcffaf72a03bde8a205a596b4b3366b86 (patch)
treeb1be8b11de9713dd94c13066ab7dd3d2605cf945 /src
parent96c5db3e69cbe5cd89f5b9af5251e3db30d142bb (diff)
downloadvoidsky-6da18e3dcffaf72a03bde8a205a596b4b3366b86.tar.zst
Only run "disable min shell on foregrounding" behaviour if on the home screen (#3825)
* change useEffect to useFocusEffect

* v2 -> v3
Diffstat (limited to 'src')
-rw-r--r--src/lib/statsig/gates.ts2
-rw-r--r--src/view/screens/Home.tsx30
2 files changed, 17 insertions, 15 deletions
diff --git a/src/lib/statsig/gates.ts b/src/lib/statsig/gates.ts
index 5cd603920..99706de66 100644
--- a/src/lib/statsig/gates.ts
+++ b/src/lib/statsig/gates.ts
@@ -1,7 +1,7 @@
 export type Gate =
   // Keep this alphabetic please.
   | 'autoexpand_suggestions_on_profile_follow_v2'
-  | 'disable_min_shell_on_foregrounding_v2'
+  | 'disable_min_shell_on_foregrounding_v3'
   | 'disable_poll_on_discover_v2'
   | 'dms'
   | 'hide_vertical_scroll_indicators'
diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx
index 3eaa1b875..665400f14 100644
--- a/src/view/screens/Home.tsx
+++ b/src/view/screens/Home.tsx
@@ -119,22 +119,24 @@ function HomeScreenReady({
   const gate = useGate()
   const mode = useMinimalShellMode()
   const {isMobile} = useWebMediaQueries()
-  React.useEffect(() => {
-    const listener = AppState.addEventListener('change', nextAppState => {
-      if (nextAppState === 'active') {
-        if (
-          isMobile &&
-          mode.value === 1 &&
-          gate('disable_min_shell_on_foregrounding_v2')
-        ) {
-          setMinimalShellMode(false)
+  useFocusEffect(
+    React.useCallback(() => {
+      const listener = AppState.addEventListener('change', nextAppState => {
+        if (nextAppState === 'active') {
+          if (
+            isMobile &&
+            mode.value === 1 &&
+            gate('disable_min_shell_on_foregrounding_v3')
+          ) {
+            setMinimalShellMode(false)
+          }
         }
+      })
+      return () => {
+        listener.remove()
       }
-    })
-    return () => {
-      listener.remove()
-    }
-  }, [setMinimalShellMode, mode, isMobile, gate])
+    }, [setMinimalShellMode, mode, isMobile, gate]),
+  )
 
   const onPageSelected = React.useCallback(
     (index: number) => {