Repository navigation
fix(iOS): header snapshots not working - #2393
Merged
Merged
Conversation
kkafar
reviewed
Oct 8, 2024
kkafar
left a comment
Member
There was a problem hiding this comment.
Hey, I need you to confirm that this PR does not introduce regression on #2230.
You can test specifically on @tboba's reproduction: #2230 (comment)
If we don't have a regression I need you to explain what other change fixed the issue mentioned in #2230. Otherwise I'm a bit reluctant, cause it might be working only by accident.
Contributor
Author
alduzy
marked this pull request as draft
October 8, 2024 13:06
alduzy
marked this pull request as ready for review
October 14, 2024 07:42
kkafar
requested changes
Oct 15, 2024
kkafar
left a comment
Member
There was a problem hiding this comment.
Few remarks. The logic looks good, I would only want you to change the naming.
| @property (nonatomic) react::LayoutMetrics newLayoutMetrics; | ||
| @property (weak, nonatomic) RNSScreenStackHeaderConfig *config; | ||
| @property (nonatomic, readonly) BOOL hasHeaderConfig; | ||
| @property (nonatomic) BOOL isGoingToBeRemoved; |
Member
There was a problem hiding this comment.
We don't need this in public API of Screen component
Suggested change
| @property (nonatomic) BOOL isGoingToBeRemoved; |
Co-authored-by: Kacper Kafara <kacper.kafara@swmansion.com>
kkafar
added a commit
that referenced
this pull request
Oct 25, 2024
The `updateViewControllerIfNeeded` call introduced by #2230 forces the view controller to rebuild the subviews with the recent config. When the screen is being unmounted it replaces the subviews with nil values as the `reactSubviews` are removed from the config one by one. Snapshots made earlier get discarded in the process. This PR adds a condition that prevents updating the view controller when the screen is being changed + stops unnecessary snapshots when the screen is not changed. - updated `Test556.tsx` repro - added `isGoingToBeRemoved` property to `RNSScreenView` - making snapshots / updating the view controller conditionally <!-- --> - Use `Test556.tsx` repro - [x] Included code example that can be used to test this change - [x] Ensured that CI passes --------- Co-authored-by: Kacper Kafara <kacper.kafara@swmansion.com> Co-authored-by: Kacper Kafara <kacperkafara@gmail.com> (cherry picked from commit e4333a1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
updateViewControllerIfNeededcall introduced by #2230 forces the view controller to rebuild the subviews with the recent config.When the screen is being unmounted it replaces the subviews with nil values as the
reactSubviewsare removed from the config one by one. Snapshots made earlier get discarded in the process.This PR adds a condition that prevents updating the view controller when the screen is being changed + stops unnecessary snapshots when the screen is not changed.
Changes
Test556.tsxreproisGoingToBeRemovedproperty toRNSScreenViewTest code and steps to reproduce
Test556.tsxreproChecklist