-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
enableFreeze does not work on Web (react-native-web) #1359
Comments
Hello @hbomatt 👋 Yes, all of your observations are correct and it's neither a bug nor by design. We just haven't managed to add Cheers |
Hi @kacperkapusciak 👋🏻 Thanks for the explanation! I totally understand, 🤞🏻 that we'll eventually be able to use it on Web as well 😄 Thank you for your (and the entire team's) contributions to |
Just for other devs that come across this issue, I ended up relying on |
hello @hbomatt |
Thanks, that was a non-issue for us because we don't use a tabbed interface on Web, we do use a tabbed interface on iOS/Android/FireTV/etc. but that uses the native freeze support instead. I just used the custom freeze tweak specifically on Web in the non-tabbed UI. It was a product/design choice to have the tabbed UI on mobile and a non-tabbed UI on Web. I guess that saved us from encountering the problem you discovered 😅 Thanks! The biggest pain with this custom freeze approach on Web was disabling the various hooks that would execute on pages in the backstack, for perf reasons, but that was a pretty straight-forward fix once we realized what was going on. |
Description
I'm using React-Navigation v6 along with the latest version of
react-native-screens
and have followed thereact-freeze
Quick Start Guide for React-Navigation... but how can I tell that it's actually doing anything?enableFreeze(true);
seems to have zero effect on the app that I'm working on. I've just been testing on Web (react-native-web) initially...Freeze
components in the component hierarchy using React Developer Tools in Chrome, running on Web viareact-native-web
.react-freeze
.freezeEnabled()
method, likescreensEnabled()
...Stepping into the enableFreeze call, I see:
react-native-screens/src/index.tsx
Line 31 in bef0d67
I was surprised to see that the
react-freeze
integration isn't compatible withreact-native-web
apps that usereact-native-screens
.Is this a bug or by design?
Screenshots
Steps To Reproduce
enableFreeze(true);
during app startup.Expected behavior
Only the current screen and the previous screen re-render, the other screen instances in the backstack do not re-render.
Actual behavior
Every screen in the backstack re-renders, causing a severe performance hit (several seconds to re-render after browser window resizing on a MBP)
Reproduction
I don't believe a Snack repro is needed, the issue is clear when looking at the
react-native-screens
source code for theenableFreeze
method - comparingindex.tsx
(no-op) toindex.native.tsx
(actually enablesreact-freeze
)Platform
Workflow
Package versions
The text was updated successfully, but these errors were encountered: