-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
fix: take preload into account when freezing children #2566
Conversation
I think we need to leave them unfrozen so that effects etc. can run on that screen to load everything required. |
I mean there is one render before the screen is frozen, but it might not be enough so it makes sense. |
Freezing usually doesn’t affect effects, right? It only stops re-rendering the UI, no? I think preloaded screens can be frozen—it’s just their UI not being updated. But I think that’s kind of against the whole purpose of preloading or pre-rendering a screen. So, it makes sense not to freeze preloaded screens. |
We could also add prop |
Either is fine but I think the second one will be breaking, so for now I think it maybe good to add a new prop like |
**Motivation** PR connected to software-mansion/react-native-screens#2566 moving the freezing logic to `react-navigation` since we have control over `preloaded` screens here. **Test plan** `TestFreeze` in `RNScreens` repo. --------- Co-authored-by: Satyajit Sahoo <[email protected]>
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.
Both https://github.com/react-navigation/react-navigation/pull/12332/files and this one look reasonable.
Only thing that missing is whether we want to document somewhere that we don't freeze preloaded screens or leave it "unstable". Same for fabric behaviour (top most two screens not frozen) we introduced a while back.
Yeah, it would be nice to inform people that behavior differs on old/new arch. As for preloaded screens, I would add a prop on e.g. navigator to decide if we should freeze preloaded screens too, but it is on the side of |
@WoLewicki PRs to docs is welcome :) |
I started a discussion about re-thinking react-freeze a little bit. They are definitely some flaws/inconsistencies that should be tackled in the future. I opened the discussion over at react-navigation, I can move it to RNS if the place is wrong |
Description
Fixed #2557. We have to take preloaded screens into account when freezing screens. Till now, the assumption was that the newest screens are the ones rendered, right now top children can be the preloaded ones, so we have to filter them from calculating the size of frozen screens. We could also think of freezing the preloaded screens, wdyt about it @satya164 ?
Changes
Test code and steps to reproduce
TestFreeze now includes preloading of screens, even more than 1 to see that the current one still gets the updates.
Checklist