diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm index 1d112b51c1c88f..039d033984cb96 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm @@ -24,21 +24,12 @@ - (instancetype)init _heightConstraint = [_safeAreaContainer.heightAnchor constraintEqualToConstant:0]; _heightConstraint.active = YES; - if (@available(iOS 11.0, *)) { - [NSLayoutConstraint activateConstraints:@[ - [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor], - [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor], - [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor], - [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor] - ]]; - } else { - [NSLayoutConstraint activateConstraints:@[ - [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.bottomAnchor], - [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.topAnchor], - [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.leadingAnchor], - [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.trailingAnchor] - ]]; - } + [NSLayoutConstraint activateConstraints:@[ + [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor], + [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor], + [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor], + [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor] + ]]; } return self; } diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm index 80514c2a54f6ca..c1b8ce67aae538 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm @@ -30,12 +30,10 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { - if (@available(iOS 11.0, *)) { - // We set the default behavior to "never" so that iOS - // doesn't do weird things to UIScrollView insets automatically - // and keeps it as an opt-in behavior. - self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } + // We set the default behavior to "never" so that iOS + // doesn't do weird things to UIScrollView insets automatically + // and keeps it as an opt-in behavior. + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; // We intentionally force `UIScrollView`s `semanticContentAttribute` to `LTR` here // because this attribute affects a position of vertical scrollbar; we don't want this diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index d1d8cc3f2ae266..b94553b5abcd07 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -258,18 +258,16 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & } } - if (@available(iOS 11.0, *)) { - if (oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior) { - auto const contentInsetAdjustmentBehavior = newScrollViewProps.contentInsetAdjustmentBehavior; - if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Never) { - scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Automatic) { - scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; - } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::ScrollableAxes) { - scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; - } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Always) { - scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways; - } + if (oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior) { + auto const contentInsetAdjustmentBehavior = newScrollViewProps.contentInsetAdjustmentBehavior; + if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Never) { + scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Automatic) { + scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; + } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::ScrollableAxes) { + scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; + } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Always) { + scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways; } } diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm index a861c36c38aefa..5212f8b5857fe3 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm @@ -210,13 +210,10 @@ UITextContentType RCTUITextContentTypeFromString(std::string const &contentType) @"streetAddressLine2" : UITextContentTypeStreetAddressLine2, @"sublocality" : UITextContentTypeSublocality, @"telephoneNumber" : UITextContentTypeTelephoneNumber, + @"username" : UITextContentTypeUsername, + @"password" : UITextContentTypePassword, } mutableCopy]; - if (@available(iOS 11.0, *)) { - [mutableContentTypeMap - addEntriesFromDictionary:@{@"username" : UITextContentTypeUsername, @"password" : UITextContentTypePassword}]; - } - if (@available(iOS 12.0, *)) { [mutableContentTypeMap addEntriesFromDictionary:@{ @"newPassword" : UITextContentTypeNewPassword, diff --git a/React/Views/ScrollView/RCTScrollView.m b/React/Views/ScrollView/RCTScrollView.m index eb8f90e1cd9351..f89e17d040f4e3 100644 --- a/React/Views/ScrollView/RCTScrollView.m +++ b/React/Views/ScrollView/RCTScrollView.m @@ -289,9 +289,7 @@ - (instancetype)initWithEventDispatcher:(id)eventDis // We set the default behavior to "never" so that iOS // doesn't do weird things to UIScrollView insets automatically // and keeps it as an opt-in behavior. - if ([_scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } + _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; _automaticallyAdjustContentInsets = YES; _contentInset = UIEdgeInsetsZero; @@ -937,11 +935,9 @@ - (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjusts - (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)behavior { // `contentInsetAdjustmentBehavior` is available since iOS 11. - if ([_scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - CGPoint contentOffset = _scrollView.contentOffset; - _scrollView.contentInsetAdjustmentBehavior = behavior; - _scrollView.contentOffset = contentOffset; - } + CGPoint contentOffset = _scrollView.contentOffset; + _scrollView.contentInsetAdjustmentBehavior = behavior; + _scrollView.contentOffset = contentOffset; } - (void)sendScrollEventWithName:(NSString *)eventName diff --git a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm index baa232423a85b1..6143162af52886 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm +++ b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm @@ -187,16 +187,14 @@ facebook::react::ColorComponents RCTPlatformColorComponentsFromSemanticItems(std::vector &semanticItems) { for (const auto &semanticCString : semanticItems) { - if (@available(iOS 11.0, *)) { - NSString *semanticNSString = _NSStringFromCString(semanticCString); - UIColor *uiColor = [UIColor colorNamed:semanticNSString]; - if (uiColor != nil) { - return _ColorComponentsFromUIColor(uiColor); - } - uiColor = _UIColorFromSemanticString(semanticNSString); - if (uiColor != nil) { - return _ColorComponentsFromUIColor(uiColor); - } + NSString *semanticNSString = _NSStringFromCString(semanticCString); + UIColor *uiColor = [UIColor colorNamed:semanticNSString]; + if (uiColor != nil) { + return _ColorComponentsFromUIColor(uiColor); + } + uiColor = _UIColorFromSemanticString(semanticNSString); + if (uiColor != nil) { + return _ColorComponentsFromUIColor(uiColor); } }