fix(iOS): PoC: initial content jump on screens with header #1998
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
Just my notes:
The idea is to set
top
property on shadow view depending whether thescreen has header or not.
The presence of the header can be detected via prop: shadow views do get
all the same initial props as normal views! (and maybe some extra), so
it is possible to pass this information down from JS, so that it is
available on first render (while the first layout is calculated).
Other option would be to defer setting the frame to the moment the UIKit
(native) layout is calculated & set the frame only after this is done.
We should also consider what should happen if the view is resized
dynamically e.g. by gesture on native side. The native layout gets
triggered no matter what and we can not prevent it. The question is
whether we should trigger RCT layout or not...
Triggering the layout could be problematic in context of view-clipping (especially on modals).
Not triggering it will most likely (maybe there is some workaround) cause centered-views, scrollviews, etc. to not function properly.
Some option would be to use
UIView.topLayoutGuide
(and removeedgesForExtendedLayout
(it is not deprecated, but it is recommended against using it)) and instead ofcalling
setSize
onUIManager
, what results in scheduling a block onUIManager
thread that sets the size on shadow view & schedules thelayout, we could update shadow's view top property (or any other helper
property we define) to appropriate value, set appropriate size and just
then schedule the layout?
Will
Resolves #1779
Changes
Test code and steps to reproduce
Checklist