Only run "disable min shell on foregrounding" behaviour if on the home screen (#3825)
* change useEffect to useFocusEffect * v2 -> v3zio/stable
parent
96c5db3e69
commit
6da18e3dcf
|
@ -1,7 +1,7 @@
|
||||||
export type Gate =
|
export type Gate =
|
||||||
// Keep this alphabetic please.
|
// Keep this alphabetic please.
|
||||||
| 'autoexpand_suggestions_on_profile_follow_v2'
|
| 'autoexpand_suggestions_on_profile_follow_v2'
|
||||||
| 'disable_min_shell_on_foregrounding_v2'
|
| 'disable_min_shell_on_foregrounding_v3'
|
||||||
| 'disable_poll_on_discover_v2'
|
| 'disable_poll_on_discover_v2'
|
||||||
| 'dms'
|
| 'dms'
|
||||||
| 'hide_vertical_scroll_indicators'
|
| 'hide_vertical_scroll_indicators'
|
||||||
|
|
|
@ -119,22 +119,24 @@ function HomeScreenReady({
|
||||||
const gate = useGate()
|
const gate = useGate()
|
||||||
const mode = useMinimalShellMode()
|
const mode = useMinimalShellMode()
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
React.useEffect(() => {
|
useFocusEffect(
|
||||||
const listener = AppState.addEventListener('change', nextAppState => {
|
React.useCallback(() => {
|
||||||
if (nextAppState === 'active') {
|
const listener = AppState.addEventListener('change', nextAppState => {
|
||||||
if (
|
if (nextAppState === 'active') {
|
||||||
isMobile &&
|
if (
|
||||||
mode.value === 1 &&
|
isMobile &&
|
||||||
gate('disable_min_shell_on_foregrounding_v2')
|
mode.value === 1 &&
|
||||||
) {
|
gate('disable_min_shell_on_foregrounding_v3')
|
||||||
setMinimalShellMode(false)
|
) {
|
||||||
|
setMinimalShellMode(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
return () => {
|
||||||
|
listener.remove()
|
||||||
}
|
}
|
||||||
})
|
}, [setMinimalShellMode, mode, isMobile, gate]),
|
||||||
return () => {
|
)
|
||||||
listener.remove()
|
|
||||||
}
|
|
||||||
}, [setMinimalShellMode, mode, isMobile, gate])
|
|
||||||
|
|
||||||
const onPageSelected = React.useCallback(
|
const onPageSelected = React.useCallback(
|
||||||
(index: number) => {
|
(index: number) => {
|
||||||
|
|
Loading…
Reference in New Issue