2015-03-23 20:28:42 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-03-23 20:28:42 +00:00
|
|
|
*/
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2017-12-20 03:48:22 +00:00
|
|
|
#import "RCTSinglelineTextInputView.h"
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2017-05-29 22:56:38 +00:00
|
|
|
#import <React/RCTBridge.h>
|
2016-11-23 15:47:52 +00:00
|
|
|
|
2017-05-29 22:56:47 +00:00
|
|
|
#import "RCTUITextField.h"
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2017-12-20 03:48:22 +00:00
|
|
|
@implementation RCTSinglelineTextInputView
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
2018-01-24 07:17:57 +00:00
|
|
|
RCTUITextField *_backedTextInputView;
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
2017-05-29 22:56:38 +00:00
|
|
|
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
2017-06-27 23:05:05 +00:00
|
|
|
if (self = [super initWithBridge:bridge]) {
|
2017-06-10 15:19:34 +00:00
|
|
|
// `blurOnSubmit` defaults to `true` for <TextInput multiline={false}> by design.
|
2018-01-24 07:17:57 +00:00
|
|
|
self.blurOnSubmit = YES;
|
2017-06-10 15:19:34 +00:00
|
|
|
|
2018-01-24 07:17:57 +00:00
|
|
|
_backedTextInputView = [[RCTUITextField alloc] initWithFrame:self.bounds];
|
|
|
|
_backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
|
|
_backedTextInputView.textInputDelegate = self;
|
2017-05-29 22:56:47 +00:00
|
|
|
|
2018-01-24 07:17:57 +00:00
|
|
|
[self addSubview:_backedTextInputView];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
2017-05-29 22:56:47 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2017-05-29 22:56:47 +00:00
|
|
|
RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
2018-01-24 07:17:57 +00:00
|
|
|
RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
|
2017-05-29 22:56:47 +00:00
|
|
|
|
2017-06-27 23:05:04 +00:00
|
|
|
- (id<RCTBackedTextInputViewProtocol>)backedTextInputView
|
|
|
|
{
|
2018-01-24 07:17:57 +00:00
|
|
|
return _backedTextInputView;
|
2017-07-18 21:33:31 +00:00
|
|
|
}
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
@end
|