mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
5f9a2117bf
Summary: These lines were causing erros with the e2e tests on ios. There are some methods that are not going to be called, and some definitions that are not correct. needed for #19574. we will run the e2e tests. [INTERNAL] [MINOR] [Tests] - Fix some definitions. Closes https://github.com/facebook/react-native/pull/19790 Differential Revision: D8509228 Pulled By: hramos fbshipit-source-id: 78650e347db52305a587e3461ac56877e3c79062
85 lines
2.3 KiB
Objective-C
85 lines
2.3 KiB
Objective-C
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import "RCTMultilineTextInputView.h"
|
|
|
|
#import <React/RCTUtils.h>
|
|
|
|
#import "RCTUITextView.h"
|
|
|
|
@implementation RCTMultilineTextInputView
|
|
{
|
|
RCTUITextView *_backedTextInputView;
|
|
}
|
|
|
|
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
|
{
|
|
if (self = [super initWithBridge:bridge]) {
|
|
// `blurOnSubmit` defaults to `false` for <TextInput multiline={true}> by design.
|
|
self.blurOnSubmit = NO;
|
|
|
|
_backedTextInputView = [[RCTUITextView alloc] initWithFrame:self.bounds];
|
|
_backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
_backedTextInputView.backgroundColor = [UIColor clearColor];
|
|
_backedTextInputView.textColor = [UIColor blackColor];
|
|
// This line actually removes 5pt (default value) left and right padding in UITextView.
|
|
_backedTextInputView.textContainer.lineFragmentPadding = 0;
|
|
#if !TARGET_OS_TV
|
|
_backedTextInputView.scrollsToTop = NO;
|
|
#endif
|
|
_backedTextInputView.scrollEnabled = YES;
|
|
_backedTextInputView.textInputDelegate = self;
|
|
|
|
[self addSubview:_backedTextInputView];
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
- (id<RCTBackedTextInputViewProtocol>)backedTextInputView
|
|
{
|
|
return _backedTextInputView;
|
|
}
|
|
|
|
#pragma mark - UIScrollViewDelegate
|
|
|
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
|
{
|
|
RCTDirectEventBlock onScroll = self.onScroll;
|
|
|
|
if (onScroll) {
|
|
CGPoint contentOffset = scrollView.contentOffset;
|
|
CGSize contentSize = scrollView.contentSize;
|
|
CGSize size = scrollView.bounds.size;
|
|
UIEdgeInsets contentInset = scrollView.contentInset;
|
|
|
|
onScroll(@{
|
|
@"contentOffset": @{
|
|
@"x": @(contentOffset.x),
|
|
@"y": @(contentOffset.y)
|
|
},
|
|
@"contentInset": @{
|
|
@"top": @(contentInset.top),
|
|
@"left": @(contentInset.left),
|
|
@"bottom": @(contentInset.bottom),
|
|
@"right": @(contentInset.right)
|
|
},
|
|
@"contentSize": @{
|
|
@"width": @(contentSize.width),
|
|
@"height": @(contentSize.height)
|
|
},
|
|
@"layoutMeasurement": @{
|
|
@"width": @(size.width),
|
|
@"height": @(size.height)
|
|
},
|
|
@"zoomScale": @(scrollView.zoomScale ?: 1),
|
|
});
|
|
}
|
|
}
|
|
|
|
@end
|