Skip to content
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(Android): onLayout calls in bottom tabs with freezeOnBlur #2363

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

alduzy
Copy link
Member

@alduzy alduzy commented Oct 1, 2024

Description

This PR fixes freezeOnBlur option not working for onLayout events with @react-navigation/bottom-tabs navigator.

In bottom tabs onLayout is called inside frozen screens. Re-renders don't happen so it seems like freeze itself is working correctly, except for native events. In native stack nothing is called inside frozen screens as expected (note: native stack with fabric keeps one previous screen unfrozen).

Comparing both it seems like calling updateScreenSizeFabric or updateScreenSizePaper makes the difference - effectively stopping native event calls in non-active screens.

Fixes #2349

Changes

  • removed check for ScreenStack
  • updated TestFreeze.tsx repro

Checklist

  • Included code example that can be used to test this change
  • Ensured that CI passes

Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember from the top of my head why we have checked there for container is ScreenStack. Maybe @WoLewicki will have more context here. I'll be able to look into it todays afternoon.

Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reading this through & came to conclusion that we need better description of the error mechanism here. Why the frame is wrong (what part of it is wrong), why does this interfere with freezeOnBlur mechanism?

@@ -137,7 +137,7 @@ class Screen(
r: Int,
b: Int,
) {
if (container is ScreenStack && changed) {
if (changed) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added since the logic inside is intended only for native-stack. So I have no idea why removing it would change anything. Can we have more information?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WoLewicki I updated the description with some more information. That's all I got, I'll keep on investigating.

@alduzy alduzy marked this pull request as draft October 10, 2024 09:37
@alduzy alduzy changed the title fix(Android): freezeOnBlur not working with bottom tabs navigator fix(Android): onLayout calls in bottom tabs with freezeOnBlur Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android freeze not working if layout changes since >= 3.30.0
3 participants