Only run "disable min shell on foregrounding" behaviour if on the home screen (#3825)
* change useEffect to useFocusEffect * v2 -> v3
This commit is contained in:
parent
96c5db3e69
commit
6da18e3dcf
2 changed files with 17 additions and 15 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue