-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
perf: Freeze screens and unmount Browser and Transactions screens when unfocused #15246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e4841b4
be1c6b4
d47b68d
988cbe0
642b3ab
1b25f12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import './shim.js'; | ||
|
||
import { enableFreeze } from 'react-native-screens'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're on React Navigation v5, it looks like we also need to enable screens via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
enableFreeze(true); | ||
|
||
// Needed to polyfill random number generation. | ||
import 'react-native-get-random-values'; | ||
import '@walletconnect/react-native-compat'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since React Navigation v6 removes this option, let's go with the
useIsFocus
implementation for now since that will still work once we upgrade to v6 - https://reactnavigation.org/docs/upgrading-from-6.x/#the-unmountonblur-option-is-removed-in-favor-of-poptotoponblur-in-bottom-tab-navigator-and-drawer-navigatorThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point Cal.
I like the high order component proposal presented on the docs
Then we can use it in the
layout
prop of the screen