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

refactor(iOS): update view controller once per transaction when adding header subviews #2623

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

kkafar
Copy link
Member

@kkafar kkafar commented Jan 16, 2025

Description

In #2466 I've introduced RCTMountingTransactionObserving for RNSScreenStackHeaderConfig component.
Now we can use this to reduce amount of calls to updateViewControllerIfNeeded (causing layout passes) when adding subviews.

I'm not changing the unmount path of the code as we have some more additional logic there which requires some more
careful consideration.

This also aligns us with Paper implementation. Note that it has been only implemented this way, because at the implementation time there was no way
to run this code on transaction completion.

Changes

- [RNSScreenStackHeaderConfig updateViewControllerIfNeeded] is now called only once per transaction when adding subviews to header config.

Test code and steps to reproduce

Test432, TestHeaderTitle, Test2552 - see that there are no regressions.

Note

During testing I've found that there is a bug with subview layout when modifying subviews after first render. This is not a regression however. Notice the wrong position of header right on video below 👇🏻 (Test432)

Screen.Recording.2025-01-21.at.13.33.55.mov

Checklist

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

@kkafar kkafar force-pushed the @kkafar/update-view-controller-once-per-transaction branch 2 times, most recently from 8109853 to a64e8c6 Compare January 17, 2025 12:42
@kkafar
Copy link
Member Author

kkafar commented Jan 17, 2025

Lint started failing w/o any changes to the PR and for no apparent reason (before force push it passed). Moreover it has started failing on every single PR 🤷🏻‍♂️ indicating separate issue.

@kkafar kkafar force-pushed the @kkafar/update-view-controller-once-per-transaction branch from a64e8c6 to 45f186e Compare January 21, 2025 11:53
@kkafar kkafar merged commit 3c589b1 into main Jan 21, 2025
4 of 5 checks passed
@kkafar kkafar deleted the @kkafar/update-view-controller-once-per-transaction branch January 21, 2025 12:35
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.

1 participant