Skip to content
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 scrollIndicatorInsets on iOS 13 #27102

Closed
wants to merge 1 commit into from

Conversation

radex
Copy link
Contributor

@radex radex commented Nov 4, 2019

Summary

scrollIndicatorInsets seems to be broken on iOS 13. I think this might be an iOS bug? Or maybe a behavior change. Either way, it's a regression for React Native users. Setting automaticallyAdjustsScrollIndicatorInsets = NO fixes the behavior + we stop using deprecated scrollIndicatorInsets if possible

Changelog

[iOS] [Fixed] - Fixed ScrollView's scrollIndicatorInsets prop on iOS 13

Test Plan

  • RNTester → scrollView - both horizontal and vertical examples have insets set to 50px on both sides

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 4, 2019
@react-native-bot react-native-bot added Platform: iOS iOS applications. Bug labels Nov 4, 2019
@sammy-SC
Copy link
Contributor

sammy-SC commented Nov 5, 2019

Hello @radex,

thank you for the PR. I am unable to reproduce the problem, could you please send me a repro so I can verify that this fix works?

@@ -299,6 +299,12 @@ - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
}
#endif

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is to have conditional compilation together with @available(iOS 13.0, *) check.
Using @available(iOS 13.0, *) is preferred.

This applies to the code below as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is, and it seems to be a convention in RN project.

@available(iOS 13.0, *) is a runtime check, and #if ... __IPHONE_OS_VERSION_MAX_ALLOWED check is for SDK the project is compiled against.

I can re-check but I think if you tried to compile this code in Xcode 10.2 or earlier, it would fail to compile

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe @radex may be referring to RCTAppearance.mm where I used this pattern as Dark Mode is new to iOS 13:

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
if (@available(iOS 13.0, *)) {

@sammy-SC do you still want this change to be made?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hramos is there any reason to have conditional compilation there? If not, then let's remove it.

@SYoder1
Copy link

SYoder1 commented Jul 8, 2020

Is there any status update on this PR?

@lunaleaps
Copy link
Contributor

I believe this has been resolved by #29809 so will close this for now.

@lunaleaps lunaleaps closed this Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants