-
-
Notifications
You must be signed in to change notification settings - Fork 595
fix(iOS): modal content flicker during enter transition on iPad #3345
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
base: main
Are you sure you want to change the base?
Conversation
This is done to prevent exactly the same issue we have with native header. Basically e.g. on iPads, the horizontal space available is constrained (the modal view is narrower than the view underneath) and the native layout differs from first Yoga layout leading to content jumps & flickers in the very beginning, before we send first state updates. I filter these out now. Relying fully on native layout. Really hard to state whether it won't break anything. Until now manual testing seems ok.
| export { default as TestScreenStack } from './TestScreenStack'; | ||
| export { default as TestSplitView } from './TestSplitView'; | ||
| export { default as TestSafeAreaViewIOS } from './TestSafeAreaViewIOS'; | ||
| export { default as Test3345 } from './Test3345'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I'd move this a few lines above, closer to other numbered tests.
| if (parentVC == nil && [self isKindOfClass:RNSModalScreen.class]) { | ||
| // If we're in modal presentation, we don't want to set the frame from RN, | ||
| // as the available space is most likely restriced & differs from what Yoga | ||
| // resolves during firt layout. We want to rely on native layout here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // resolves during firt layout. We want to rely on native layout here. | |
| // resolves during first layout. We want to rely on native layout here. |
|
|
||
| if (parentVC == nil && [self isKindOfClass:RNSModalScreen.class]) { | ||
| // If we're in modal presentation, we don't want to set the frame from RN, | ||
| // as the available space is most likely restriced & differs from what Yoga |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // as the available space is most likely restriced & differs from what Yoga | |
| // as the available space is most likely restricted & differs from what Yoga |
|
The problem is still reproducible when using very specific styles on scrollview. Added reproduction in ad8eda8 Screen.Recording.2025-11-04.at.11.42.25.mov |
Description
Closes https://github.com/software-mansion/react-native-screens-labs/issues/531
This PR filters out calls to
updateLayoutMetrics:oldLayoutMetrics:for modal screen.This is done to prevent exactly the same issue we have with native
header. Basically e.g. on iPads, the horizontal space available is
constrained (the modal view is narrower than the view underneath) and
the native layout differs from first Yoga layout leading to content
jumps & flickers in the very beginning, before we send first state
updates.
I filter these out now. Relying fully on native layout. Really hard to
state whether it won't break anything. Until now manual testing indicates that the change
is ok.
Code remarks
I've put the code into
- [RNSScreenView updateLayoutMetrics:oldLayoutMetrics:]and not into- [RNSModalScreen updateLayoutMetrics:oldLayoutMetrics:]deliberately. We're not extending theRNSScreenViewbehaviour. We alter it. We can not omit calling super in- [RNSModalScreen updateLayoutMetrics:oldLayoutMetrics:]as we'd fail to update state gathered there on every call, potentially reintroducing #1463. Therefore I decided to handle this special case of subclass related code in superclass. What we could do here is to treat these as separate components & make them separate (do not inherit). This is something that we plan to do in next major, therefore decided against such big change here.Changes
Before
repro.mov
Notice this frame and the lack of green bar on the right side:

After
fix.mov
Test code and steps to reproduce
Checklist