-
-
Notifications
You must be signed in to change notification settings - Fork 537
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
Large title: The navbar gets stuck when using the refresh control. #1034
Comments
I found a fix for this but it's dirty: In RNScreen.m, add the following in the viewDidLayoutSubviews function: UIViewController *parentVC = [self parentViewController];
if ([parentVC isKindOfClass:[UINavigationController class]]) {
[((UINavigationController *)parentVC).navigationBar sizeToFit];
} This ensures the navigation bar re-renders when the screen updates... Any thoughts? Simulator.Screen.Recording.-.iPhone.11.-.2021-08-03.at.16.09.28.mp4 |
Is it a duplicate of #395 ? |
Not really. This bug was related to React Native 0.63. facebook/react-native#28236 was supposed to resolve it, but with react-native-screens, it doesn't seem to be the case. It actually made it worse. The refresh control is not hidden under the navbar anymore, but the navbar gets stuck when setting the RefreshControl "refreshing" prop from true to false. The scroll view seems to snap back to its correct position but the navbar inside of the UINavigationController does not. By forcing the navbar to update everytime there's a layout change, it does resolve the issue, but it's a dirty hack. I'm not sure why this is happening at this time. I made a repo to reproduce this bug: https://github.com/maxencehenneron/RefreshControlBug |
In your repro you did not provide |
Hi @WoLewicki, sorry I was on vacation last week. Thank you for your help! It does seem to work when setting the header to translucent. However it makes the header, well, translucent. I can set the header background color to white to fix it, but maybe it's worth investigating why this is happening? Edit: I found the code that is likely causing this issue:
I wonder if there's a better way to avoid system laying out the screen underneath navigation controllers without setting edgesForExtendedLayout = UIRectEdgeNone. Or we could specify it in the native stack documentation somewhere |
I think since the |
Yes, I agree, translucent should be set to TRUE by default, especially when using large titles. My comment was about these lines in the library source code: react-native-screens/ios/RNSScreenStackHeaderConfig.m Lines 436 to 443 in e02172a
I was wondering if we could make it work without needing to set translucent to true |
I think it might be good to change it to be set |
I will close this issue since I think there is nothing to be added here. Feel free to comment if I am wrong and we can reopen it then. |
Description
When using a refreshcontrol, large titles and a scrollview, the navbar gets stuck when refreshing.
This seems to be related to this: https://stackoverflow.com/questions/50708081/prefer-large-titles-and-refreshcontrol-not-working-well.
It seems like the scrollview needs to be at the top of the main view for this to work correctly, which is currently not possible with this library
Other bugs I found:
Screenshots
Simulator.Screen.Recording.-.iPhone.11.-.2021-08-03.at.15.11.36.mp4
Steps To Reproduce
Expected behavior
It should snap back to its initial position
Actual behavior
It gets stuck when refreshing stops.
Snack or minimal code example
https://github.com/maxencehenneron/RefreshControlBug/blob/main/App.js
(You can pull the repository to test)
Package versions
The text was updated successfully, but these errors were encountered: