From 00b142f59a5f362073e2e5cfc7bee881d4a149cb Mon Sep 17 00:00:00 2001 From: zhuwencheng Date: Tue, 1 Aug 2023 21:06:25 -0700 Subject: [PATCH] fix: adapt min_ios_version_supported (#38685) Summary: Adapt to the minimum version of iOS and fix unnecessary, incorrect code and comments. ## Changelog: [IOS] [FIXED] - adapt min_ios_version_supported. Pull Request resolved: https://github.com/facebook/react-native/pull/38685 Reviewed By: NickGerleman Differential Revision: D47960465 Pulled By: ryancat fbshipit-source-id: ae91fc89307709359cef0e4a8106b03beb1fa57a --- packages/react-native/Libraries/Image/RCTAnimatedImage.mm | 2 +- .../Libraries/Text/TextInput/Multiline/RCTUITextView.mm | 2 +- packages/react-native/React/CoreModules/RCTAlertController.mm | 4 +--- .../React/Views/ScrollView/RCTScrollViewManager.m | 2 -- packages/react-native/third-party-podspecs/boost.podspec | 2 +- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/react-native/Libraries/Image/RCTAnimatedImage.mm b/packages/react-native/Libraries/Image/RCTAnimatedImage.mm index e0452b72ae4..e4dfc284c62 100644 --- a/packages/react-native/Libraries/Image/RCTAnimatedImage.mm +++ b/packages/react-native/Libraries/Image/RCTAnimatedImage.mm @@ -90,7 +90,7 @@ NSNumber *gifLoopCount = gifProperties[(__bridge NSString *)kCGImagePropertyGIFLoopCount]; if (gifLoopCount != nil) { loopCount = gifLoopCount.unsignedIntegerValue; - if (@available(iOS 14, *)) { + if (@available(iOS 14.0, *)) { } else { // A loop count of 1 means it should animate twice, 2 means, thrice, etc. if (loopCount != 0) { diff --git a/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm b/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm index ce8a77ec6c1..582b49c1ef4 100644 --- a/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +++ b/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm @@ -170,7 +170,7 @@ static UIColor *defaultPlaceholderColor(void) } // Turn off scroll animation to fix flaky scrolling. -// This is only necessary for iOS <= 14. +// This is only necessary for iOS < 14. #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED < 140000 - (void)setContentOffset:(CGPoint)contentOffset animated:(__unused BOOL)animated { diff --git a/packages/react-native/React/CoreModules/RCTAlertController.mm b/packages/react-native/React/CoreModules/RCTAlertController.mm index 2b6822108b3..ceaabafaab8 100644 --- a/packages/react-native/React/CoreModules/RCTAlertController.mm +++ b/packages/react-native/React/CoreModules/RCTAlertController.mm @@ -56,9 +56,7 @@ { [_alertWindow setHidden:YES]; - if (@available(iOS 13, *)) { - _alertWindow.windowScene = nil; - } + _alertWindow.windowScene = nil; _alertWindow = nil; } diff --git a/packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m b/packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m index 37f6416c7cc..03355504e0a 100644 --- a/packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m +++ b/packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m @@ -98,9 +98,7 @@ RCT_EXPORT_VIEW_PROPERTY(onScrollEndDrag, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollBegin, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollEnd, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(inverted, BOOL) -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */ RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustsScrollIndicatorInsets, BOOL) -#endif RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior) // overflow is used both in css-layout as well as by react-native. In css-layout diff --git a/packages/react-native/third-party-podspecs/boost.podspec b/packages/react-native/third-party-podspecs/boost.podspec index 3d9331c95d1..19dd0a3fc71 100644 --- a/packages/react-native/third-party-podspecs/boost.podspec +++ b/packages/react-native/third-party-podspecs/boost.podspec @@ -14,7 +14,7 @@ Pod::Spec.new do |spec| :sha256 => 'f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41' } # Pinning to the same version as React.podspec. - spec.platforms = { :ios => '11.0' } + spec.platforms = { :ios => min_ios_version_supported } spec.requires_arc = false spec.module_name = 'boost'