This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.4 KiB
87 lines
2.4 KiB
/** |
|
* 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; |
|
} |
|
|
|
RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) |
|
RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder) |
|
|
|
- (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
|
|
|