RCTBaseTextInputView.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 <UIKit/UIKit.h>
  8. #import <React/RCTView.h>
  9. #import "RCTBackedTextInputDelegate.h"
  10. #import "RCTBackedTextInputViewProtocol.h"
  11. @class RCTBridge;
  12. @class RCTEventDispatcher;
  13. @class RCTTextAttributes;
  14. @class RCTTextSelection;
  15. NS_ASSUME_NONNULL_BEGIN
  16. @interface RCTBaseTextInputView : RCTView <RCTBackedTextInputDelegate>
  17. - (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
  18. - (instancetype)init NS_UNAVAILABLE;
  19. - (instancetype)initWithCoder:(NSCoder *)decoder NS_UNAVAILABLE;
  20. - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
  21. @property (nonatomic, readonly) UIView<RCTBackedTextInputViewProtocol> *backedTextInputView;
  22. @property (nonatomic, strong, nullable) RCTTextAttributes *textAttributes;
  23. @property (nonatomic, assign) UIEdgeInsets reactPaddingInsets;
  24. @property (nonatomic, assign) UIEdgeInsets reactBorderInsets;
  25. @property (nonatomic, copy, nullable) RCTDirectEventBlock onContentSizeChange;
  26. @property (nonatomic, copy, nullable) RCTDirectEventBlock onSelectionChange;
  27. @property (nonatomic, copy, nullable) RCTDirectEventBlock onChange;
  28. @property (nonatomic, copy, nullable) RCTDirectEventBlock onTextInput;
  29. @property (nonatomic, copy, nullable) RCTDirectEventBlock onScroll;
  30. @property (nonatomic, assign) NSInteger mostRecentEventCount;
  31. @property (nonatomic, assign, readonly) NSInteger nativeEventCount;
  32. @property (nonatomic, assign) BOOL autoFocus;
  33. @property (nonatomic, assign) BOOL blurOnSubmit;
  34. @property (nonatomic, assign) BOOL selectTextOnFocus;
  35. @property (nonatomic, assign) BOOL clearTextOnFocus;
  36. @property (nonatomic, assign) BOOL secureTextEntry;
  37. @property (nonatomic, copy) RCTTextSelection *selection;
  38. @property (nonatomic, strong, nullable) NSNumber *maxLength;
  39. @property (nonatomic, copy, nullable) NSAttributedString *attributedText;
  40. @property (nonatomic, copy) NSString *inputAccessoryViewID;
  41. @property (nonatomic, assign) UIKeyboardType keyboardType;
  42. /**
  43. Sets selection intext input if both start and end are within range of the text input.
  44. **/
  45. - (void)setSelectionStart:(NSInteger)start
  46. selectionEnd:(NSInteger)end;
  47. @end
  48. NS_ASSUME_NONNULL_END