mirror of
https://github.com/status-im/react-native.git
synced 2025-02-28 09:00:55 +00:00
[TextView] Define missing properties and add getters
Summary: Some of the RCTTextView properties weren't set up correctly which would cause bugs when you'd set a property and then unset it, trying to revert to the default. This requires reading the default value from the dummy view instance, but some of these properties didn't have getters which was causing issues. Fixes #1174 Closes https://github.com/facebook/react-native/pull/1175 Github Author: James Ide <ide@jameside.com> Test Plan: Create a `<TextInput multiline={true}>` component. Give it a style with `color: 'blue'`, and then on the next render pass remove the style. No more red box.
This commit is contained in:
parent
e9db0338d2
commit
4e412381f2
@ -21,8 +21,10 @@
|
||||
@property (nonatomic, assign) BOOL selectTextOnFocus;
|
||||
@property (nonatomic, assign) UIEdgeInsets contentInset;
|
||||
@property (nonatomic, assign) BOOL automaticallyAdjustContentInsets;
|
||||
@property (nonatomic, copy) NSString *text;
|
||||
@property (nonatomic, strong) UIColor *textColor;
|
||||
@property (nonatomic, strong) UIColor *placeholderTextColor;
|
||||
@property (nonatomic, assign) UIFont *font;
|
||||
@property (nonatomic, strong) UIFont *font;
|
||||
|
||||
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
|
@ -72,13 +72,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (UIFont *)font
|
||||
{
|
||||
return _textView.font;
|
||||
}
|
||||
|
||||
- (void)setFont:(UIFont *)font
|
||||
{
|
||||
_font = font;
|
||||
_textView.font = _font;
|
||||
_textView.font = font;
|
||||
[self updatePlaceholder];
|
||||
}
|
||||
|
||||
- (UIColor *)textColor
|
||||
{
|
||||
return _textView.textColor;
|
||||
}
|
||||
|
||||
- (void)setTextColor:(UIColor *)textColor
|
||||
{
|
||||
_textView.textColor = textColor;
|
||||
@ -106,6 +115,11 @@
|
||||
[self updateFrames];
|
||||
}
|
||||
|
||||
- (NSString *)text
|
||||
{
|
||||
return _textView.text;
|
||||
}
|
||||
|
||||
- (void)setText:(NSString *)text
|
||||
{
|
||||
if (![text isEqualToString:_textView.text]) {
|
||||
@ -146,7 +160,6 @@
|
||||
- (void)textViewDidBeginEditing:(UITextView *)textView
|
||||
{
|
||||
if (_clearTextOnFocus) {
|
||||
[_textView setText:@""];
|
||||
_textView.text = @"";
|
||||
[self _setPlaceholderVisibility];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user