mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary:
This pull request aims to remove iOS 11 availability 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 (available(iOS 11.0, *)) {
```
This is a continuation pull request of https://github.com/facebook/react-native/pull/32151
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
[iOS] [Changed] - Remove iOS 11 availability check
Pull Request resolved: https://github.com/facebook/react-native/pull/32488
Reviewed By: yungsters
Differential Revision: D32006312
Pulled By: ryancat
fbshipit-source-id: 0ee6579e433a15d3d220a52d2ccd6931b0513971
62 lines
1.7 KiB
Plaintext
62 lines
1.7 KiB
Plaintext
/*
|
|
* 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 "RCTInputAccessoryContentView.h"
|
|
|
|
@implementation RCTInputAccessoryContentView {
|
|
UIView *_safeAreaContainer;
|
|
NSLayoutConstraint *_heightConstraint;
|
|
}
|
|
|
|
- (instancetype)init
|
|
{
|
|
if (self = [super init]) {
|
|
self.autoresizingMask = UIViewAutoresizingFlexibleHeight;
|
|
|
|
_safeAreaContainer = [UIView new];
|
|
_safeAreaContainer.translatesAutoresizingMaskIntoConstraints = NO;
|
|
[self addSubview:_safeAreaContainer];
|
|
|
|
_heightConstraint = [_safeAreaContainer.heightAnchor constraintEqualToConstant:0];
|
|
_heightConstraint.active = YES;
|
|
|
|
[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;
|
|
}
|
|
|
|
- (CGSize)intrinsicContentSize
|
|
{
|
|
// This is needed so the view size is based on autolayout constraints.
|
|
return CGSizeZero;
|
|
}
|
|
|
|
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index
|
|
{
|
|
[_safeAreaContainer insertSubview:view atIndex:index];
|
|
}
|
|
|
|
- (void)setFrame:(CGRect)frame
|
|
{
|
|
[super setFrame:frame];
|
|
[_safeAreaContainer setFrame:frame];
|
|
_heightConstraint.constant = frame.size.height;
|
|
[self layoutIfNeeded];
|
|
}
|
|
|
|
- (BOOL)canBecomeFirstResponder
|
|
{
|
|
return true;
|
|
}
|
|
|
|
@end
|