-
-
Notifications
You must be signed in to change notification settings - Fork 575
fix(iOS 26, Stack v4): fix workaround for RNSScreen being partially obstructed by UINavigationBar on iOS 26 Paper #3198
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
UIView *currentView = vc.view; | ||
while (currentView != nil) { | ||
if ([currentView isKindOfClass:RNSScreenContentWrapper.class]) { | ||
contentWrapper = static_cast<RNSScreenContentWrapper *>(currentView); | ||
break; | ||
} else if ([currentView.subviews count] > 0) { | ||
currentView = currentView.subviews[0]; | ||
} else { | ||
break; | ||
} | ||
} |
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.
This logic is similar to RNSScrollViewFinder
, we could extract it to separate class but we would probably need to cast the result in places where we would use this function or provide wrappers. I also think that RNSScrollViewFinder might soon need to use more complicated logic. Let me know what you think.
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.
We can also use this logic for all cases, not only for Paper in debug mode, but it seemed like an overkill for getting first child.
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.
We could also just do:
RNSScreenContentWrapper *contentWrapper = nil;
UIView *currentView = vc.view;
while ([currentView.subviews count] > 0) {
currentView = currentView.subviews[0];
if ([currentView isKindOfClass:RNSScreenContentWrapper.class]) {
contentWrapper = static_cast<RNSScreenContentWrapper *>(currentView);
break;
}
}
performance difference will be negligible (especially if we expect the class to be correct) and it improves readability.
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.
UIView *currentView = vc.view; | ||
while (currentView != nil) { | ||
if ([currentView isKindOfClass:RNSScreenContentWrapper.class]) { | ||
contentWrapper = static_cast<RNSScreenContentWrapper *>(currentView); | ||
break; | ||
} else if ([currentView.subviews count] > 0) { | ||
currentView = currentView.subviews[0]; | ||
} else { | ||
break; | ||
} | ||
} |
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.
We could also just do:
RNSScreenContentWrapper *contentWrapper = nil;
UIView *currentView = vc.view;
while ([currentView.subviews count] > 0) {
currentView = currentView.subviews[0];
if ([currentView isKindOfClass:RNSScreenContentWrapper.class]) {
contentWrapper = static_cast<RNSScreenContentWrapper *>(currentView);
break;
}
}
performance difference will be negligible (especially if we expect the class to be correct) and it improves readability.
Description
Fixes the workaround from #3111 on Paper.
On Paper, in debug mode, sometimes there are some views between
RNSScreenView
andRNSScreenContentWrapper
. This has been an issue before: #2683.To make the workaround work correctly, we look for
RNSScreenContentWrapper
in first descendant chain, when in debug mode on Paper.Fixes https://github.com/software-mansion/react-native-screens-labs/issues/412.
Changes
RNSScreenContentWrapper
in first descendant chain, when in debug mode on PaperTest code and steps to reproduce
Run
Test3111
on Paper in debug mode.Checklist