RCTSinglelineTextInputView.m 1010 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import <React/RCTSinglelineTextInputView.h>
  8. #import <React/RCTBridge.h>
  9. #import <React/RCTUITextField.h>
  10. @implementation RCTSinglelineTextInputView
  11. {
  12. RCTUITextField *_backedTextInputView;
  13. }
  14. - (instancetype)initWithBridge:(RCTBridge *)bridge
  15. {
  16. if (self = [super initWithBridge:bridge]) {
  17. // `blurOnSubmit` defaults to `true` for <TextInput multiline={false}> by design.
  18. self.blurOnSubmit = YES;
  19. _backedTextInputView = [[RCTUITextField alloc] initWithFrame:self.bounds];
  20. _backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  21. _backedTextInputView.textInputDelegate = self;
  22. [self addSubview:_backedTextInputView];
  23. }
  24. return self;
  25. }
  26. - (id<RCTBackedTextInputViewProtocol>)backedTextInputView
  27. {
  28. return _backedTextInputView;
  29. }
  30. @end