Skip to content

Commit

Permalink
Freeze inactive screens (#1949)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Nov 17, 2023
1 parent a8aed2c commit 6c8f043
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/App.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {RootSiblingParent} from 'react-native-root-siblings'
import * as SplashScreen from 'expo-splash-screen'
import {GestureHandlerRootView} from 'react-native-gesture-handler'
import {QueryClientProvider} from '@tanstack/react-query'
import {enableFreeze} from 'react-native-screens'

import 'view/icons'

Expand Down Expand Up @@ -40,6 +41,7 @@ import {messages} from './locale/locales/en/messages'
i18n.load('en', messages)
i18n.activate('en')

enableFreeze(true)
SplashScreen.preventAutoHideAsync()

function InnerApp() {
Expand Down
3 changes: 3 additions & 0 deletions src/App.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, {useState, useEffect} from 'react'
import {QueryClientProvider} from '@tanstack/react-query'
import {SafeAreaProvider} from 'react-native-safe-area-context'
import {RootSiblingParent} from 'react-native-root-siblings'
import {enableFreeze} from 'react-native-screens'

import 'view/icons'

Expand Down Expand Up @@ -32,6 +33,8 @@ import {
import {Provider as UnreadNotifsProvider} from 'state/queries/notifications/unread'
import * as persisted from '#/state/persisted'

enableFreeze(true)

function InnerApp() {
const {isInitialLoad} = useSession()
const {resumeSession} = useSessionApi()
Expand Down

0 comments on commit 6c8f043

Please sign in to comment.