-
-
Notifications
You must be signed in to change notification settings - Fork 518
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: iOS Fabric snapshotting mechanism #1357
Merged
Merged
Conversation
This file contains 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
|
WoLewicki
reviewed
Mar 30, 2022
WoLewicki
reviewed
Mar 30, 2022
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
This PR moves the snapshotting logic from Screen to ScreenStack. From now on a snapshot is made from only the top-most screen on the stack.
Snapshots are used in order to have a transition animation during the go-back invoked from the JS side.
Problems:
Layout shift on initial render
Layout shift on app reload is partly fixed by simplifying logic in
resetViewToScreen
method inRNSScreenController
by running[_initialView updateBounds];
on every re-render. This will finally properly set the layout.It leaves a slight issue with a layout jump on the initial render which offsets the Screen by the height of the header. The problem is probably caused by the asynchronous layout calculation in the commit phase of the Fabric render pipeline that incorrectly calculates the layout values in its nodes. These values, in the end, after the mount are getting corrected by the iOS system. Well, probably.
The height of the Screen is determined by the fact that it has a Header as its child or not. This is probably way too late for Fabric to figure out that it changes the layout. After the screen is mounted iOS system correctly shrinks the screen to the expected size.
Lack of animation in the nested stack on initial app load
The current problem we are unable to tackle is the lack of screen animation in a nested stack on initial app load:
Simulator.Screen.Recording.-.iPhone.13.-.2022-03-09.at.16.33.03.mp4
The issue doesn't occur after the application is refreshed (eg. by tapping R on the keyboard):
Simulator.Screen.Recording.-.iPhone.13.-.2022-03-09.at.16.34.20.mp4
Removing call to
[_controller removeFromParentViewController];
fromprepareForRecycle
method in RNScreenStackComponentView reproduces the problem (lack of animation) also after refresh.Repro used to test the changes
We suspect that the nested stacks are improperly hooked to the highest UIViewController in the hierarchy even tho we explicitly connect the nested screen to the screen to its parent stack navigator. It might be the reason why the system doesn't know how to handle the animation.
Thank you so much @WoLewicki for help with this. You are a legend 🙌