mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Proper type for RCTBackedTextInputViewProtocol::defaultTextAttributes
Summary: This diff changes how we apply default text attributes to backed text input. The original change in https://github.com/facebook/react-native/pull/23585 that introduced the `reactTextAttributes` field in for RCTBackedTextInputViewProtocol was great! Thank you Wu zhongwuzw ! However, there is one detail that needs to be changed. RCTBackedTextInputViewProtocol is designed to only abstract complexity of iOS text input components (UITextView and UITextField); it intentionally does not have any React-specific fields or types. Adding a field `RCTTextAttributes *reactTextAttributes;` violates this principle and make it hard to reuse this functionality in the new Fabric-powered TextInput. This diff changes the type of this prop from `RCTTextAttributes` to `NSDictionary<NSAttributedStringKey,id> *` (exact same type that UITextView and UITextField use). Reviewed By: cpojer Differential Revision: D17408501 fbshipit-source-id: 65f2bba119ccc30f22e87c28d0f8ea6f731cd365
This commit is contained in:
committed by
Facebook Github Bot
parent
9833ee7bc1
commit
e271fa190d
@@ -67,7 +67,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
||||
- (void)enforceTextAttributesIfNeeded
|
||||
{
|
||||
id<RCTBackedTextInputViewProtocol> backedTextInputView = self.backedTextInputView;
|
||||
backedTextInputView.reactTextAttributes = _textAttributes;
|
||||
backedTextInputView.defaultTextAttributes = [_textAttributes effectiveTextAttributes];
|
||||
}
|
||||
|
||||
- (void)setReactPaddingInsets:(UIEdgeInsets)reactPaddingInsets
|
||||
|
||||
Reference in New Issue
Block a user