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
@@ -47,6 +47,16 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)didSetProps:(NSArray<NSString *> *)changedProps
|
||||
{
|
||||
[super didSetProps:changedProps];
|
||||
|
||||
// `backgroundColor` and `opacity` are being applied directly to a UIView,
|
||||
// therefore we need to exclude them from base `textAttributes`.
|
||||
self.textAttributes.backgroundColor = nil;
|
||||
self.textAttributes.opacity = NAN;
|
||||
}
|
||||
|
||||
- (void)layoutSubviewsWithContext:(RCTLayoutContext)layoutContext
|
||||
{
|
||||
// Do nothing.
|
||||
|
||||
Reference in New Issue
Block a user