RCTBackedTextInputViewProtocol.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. @protocol RCTBackedTextInputDelegate;
  9. @class RCTTextAttributes;
  10. NS_ASSUME_NONNULL_BEGIN
  11. @protocol RCTBackedTextInputViewProtocol <UITextInput>
  12. @property (nonatomic, copy, nullable) NSAttributedString *attributedText;
  13. @property (nonatomic, copy, nullable) NSString *placeholder;
  14. @property (nonatomic, strong, nullable) UIColor *placeholderColor;
  15. @property (nonatomic, assign, readonly) BOOL textWasPasted;
  16. @property (nonatomic, assign) UIEdgeInsets textContainerInset;
  17. @property (nonatomic, strong, nullable) UIView *inputAccessoryView;
  18. @property (nonatomic, weak, nullable) id<RCTBackedTextInputDelegate> textInputDelegate;
  19. @property (nonatomic, readonly) CGSize contentSize;
  20. @property (nonatomic, strong, nullable) NSDictionary<NSAttributedStringKey,id> *defaultTextAttributes;
  21. @property (nonatomic, assign) BOOL contextMenuHidden;
  22. @property (nonatomic, assign, getter=isEditable) BOOL editable;
  23. @property (nonatomic, assign) BOOL caretHidden;
  24. @property (nonatomic, assign) BOOL enablesReturnKeyAutomatically;
  25. @property (nonatomic, assign) UITextFieldViewMode clearButtonMode;
  26. @property (nonatomic, getter=isScrollEnabled) BOOL scrollEnabled;
  27. // This protocol disallows direct access to `selectedTextRange` property because
  28. // unwise usage of it can break the `delegate` behavior. So, we always have to
  29. // explicitly specify should `delegate` be notified about the change or not.
  30. // If the change was initiated programmatically, we must NOT notify the delegate.
  31. // If the change was a result of user actions (like typing or touches), we MUST notify the delegate.
  32. - (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange NS_UNAVAILABLE;
  33. - (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate;
  34. // This protocol disallows direct access to `text` property because
  35. // unwise usage of it can break the `attributeText` behavior.
  36. // Use `attributedText.string` instead.
  37. @property (nonatomic, copy, nullable) NSString *text NS_UNAVAILABLE;
  38. @end
  39. NS_ASSUME_NONNULL_END