mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
398595e074
Summary:
This pull request aims to remove iOS 11 version check which is no longer needed.
The minimum iOS deployment target for React Native is `iOS 11` but we still have iOS 11 version check like below.
```
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
if (available(iOS 11.0, *)) {
```
> React Native apps may target iOS 11.0 and Android 5.0 (API 21) or newer.
ref: https://github.com/facebook/react-native#-requirements
------
If there is a team motivation to remove the deprecated methods and classes before iOS 10, I can continue the work in this pull request or in the continuing pull requests.
We have deprecated warnings for these in the project.
- `UIUserNotificationSettings`
- `UILocalNotification`
- `topLayoutGuide` and `bottomLayoutGuide`
- `automaticallyAdjustsScrollViewInsets`
## Changelog
[iOS] [Changed] - Remove iOS 11 version check
Pull Request resolved: https://github.com/facebook/react-native/pull/32151
Reviewed By: sammy-SC
Differential Revision: D30877917
Pulled By: yungsters
fbshipit-source-id: d903ea5d557beeb65ef87bfce572e4db3532b3c5
76 lines
2.4 KiB
Objective-C
76 lines
2.4 KiB
Objective-C
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <React/RCTInputAccessoryViewContent.h>
|
|
|
|
#import <React/UIView+React.h>
|
|
|
|
@implementation RCTInputAccessoryViewContent
|
|
{
|
|
UIView *_safeAreaContainer;
|
|
NSLayoutConstraint *_heightConstraint;
|
|
}
|
|
|
|
- (instancetype)init
|
|
{
|
|
if (self = [super init]) {
|
|
_safeAreaContainer = [UIView new];
|
|
[self addSubview:_safeAreaContainer];
|
|
|
|
// Use autolayout to position the view properly and take into account
|
|
// safe area insets on iPhone X.
|
|
// TODO: Support rotation, anchor to left and right without breaking frame x coordinate (T27974328).
|
|
self.autoresizingMask = UIViewAutoresizingFlexibleHeight;
|
|
_safeAreaContainer.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
|
_heightConstraint = [_safeAreaContainer.heightAnchor constraintEqualToConstant:0];
|
|
_heightConstraint.active = YES;
|
|
|
|
[_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor].active = YES;
|
|
[_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor].active = YES;
|
|
[_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor].active = YES;
|
|
[_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor].active = YES;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (CGSize)intrinsicContentSize
|
|
{
|
|
// This is needed so the view size is based on autolayout constraints.
|
|
return CGSizeZero;
|
|
}
|
|
|
|
- (void)reactSetFrame:(CGRect)frame
|
|
{
|
|
// We still need to set the frame here, otherwise it won't be
|
|
// measured until moved to the window during the keyboard opening
|
|
// animation. If this happens, the height will be animated from 0 to
|
|
// its actual size and we don't want that.
|
|
[self setFrame:frame];
|
|
[_safeAreaContainer setFrame:frame];
|
|
|
|
_heightConstraint.constant = frame.size.height;
|
|
[self layoutIfNeeded];
|
|
}
|
|
|
|
- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)index
|
|
{
|
|
[super insertReactSubview:subview atIndex:index];
|
|
[_safeAreaContainer insertSubview:subview atIndex:index];
|
|
}
|
|
|
|
- (void)removeReactSubview:(UIView *)subview
|
|
{
|
|
[super removeReactSubview:subview];
|
|
[subview removeFromSuperview];
|
|
if ([[_safeAreaContainer subviews] count] == 0 && [self isFirstResponder]) {
|
|
[self resignFirstResponder];
|
|
}
|
|
}
|
|
|
|
@end
|