diff --git a/renderer/native/ios/renderer/component/textinput/HippyTextField.h b/renderer/native/ios/renderer/component/textinput/HippyTextField.h index 2766e869aed..0b61e7c9f82 100644 --- a/renderer/native/ios/renderer/component/textinput/HippyTextField.h +++ b/renderer/native/ios/renderer/component/textinput/HippyTextField.h @@ -43,7 +43,6 @@ @interface HippyTextField : HippyBaseTextInput @property (nonatomic, copy) HippyDirectEventBlock onKeyPress; @property (nonatomic, assign) BOOL autoCorrect; -//@property (nonatomic, assign) UIEdgeInsets contentInset; @property (nonatomic, strong) UIColor *placeholderTextColor; @property (nonatomic, strong) NSString *placeholder; @property (nonatomic, strong) NSNumber *maxLength; @@ -62,7 +61,6 @@ @property (nonatomic, copy) HippyDirectEventBlock onKeyboardWillHide; @property (nonatomic, copy) NSString *value; -@property (nonatomic, strong) NSNumber *fontSize; @property (nonatomic, strong) NSString *defaultValue; @property (nonatomic, copy) NSString *text; @property (nonatomic, strong) UIColor *textColor; diff --git a/renderer/native/ios/renderer/component/textinput/HippyTextField.m b/renderer/native/ios/renderer/component/textinput/HippyTextField.m index f86869076dd..8f28f3a82bc 100644 --- a/renderer/native/ios/renderer/component/textinput/HippyTextField.m +++ b/renderer/native/ios/renderer/component/textinput/HippyTextField.m @@ -337,13 +337,6 @@ - (void)setText:(NSString *)text { _text = text; } -- (void)setFontSize:(NSNumber *)fontSize { - _fontSize = fontSize; - if ([fontSize floatValue] > 0) { - [_textView setFont:[UIFont systemFontOfSize:[fontSize floatValue]]]; - } -} - - (void)setValue:(NSString *)value { [_textView setText:value]; } diff --git a/renderer/native/ios/renderer/component/textinput/HippyTextView.h b/renderer/native/ios/renderer/component/textinput/HippyTextView.h index 4eebb1e6f1b..2a48201b8e8 100644 --- a/renderer/native/ios/renderer/component/textinput/HippyTextView.h +++ b/renderer/native/ios/renderer/component/textinput/HippyTextView.h @@ -60,7 +60,6 @@ - (void)performTextUpdate; @property (nonatomic, copy) NSString *value; -@property (nonatomic, strong) NSNumber *fontSize; @property (nonatomic, strong) NSString *defaultValue; @property (nonatomic, strong) UIColor *textColor; diff --git a/renderer/native/ios/renderer/component/textinput/HippyTextView.mm b/renderer/native/ios/renderer/component/textinput/HippyTextView.mm index fcd86f2fa60..eed026d66fc 100644 --- a/renderer/native/ios/renderer/component/textinput/HippyTextView.mm +++ b/renderer/native/ios/renderer/component/textinput/HippyTextView.mm @@ -267,21 +267,23 @@ - (void)updateFrames { } - (void)updateContentSize { - CGSize size = (CGSize) { _scrollView.frame.size.width, INFINITY }; - size.height = [_textView sizeThatFits:size].height; - _scrollView.contentSize = size; - _textView.frame = (CGRect) { CGPointZero, size }; - - if (_viewDidCompleteInitialLayout && _onContentSizeChange && !CGSizeEqualToSize(_previousContentSize, size)) { - _previousContentSize = size; + CGSize contentSize = (CGSize) { CGRectGetMaxX(_scrollView.frame), INFINITY }; + contentSize.height = [_textView sizeThatFits:contentSize].height; + + if (_viewDidCompleteInitialLayout && _onContentSizeChange && !CGSizeEqualToSize(_previousContentSize, contentSize)) { + _previousContentSize = contentSize; _onContentSizeChange(@{ @"contentSize": @ { - @"height": @(size.height), - @"width": @(size.width), + @"height": @(contentSize.height), + @"width": @(contentSize.width), }, @"target": self.hippyTag, }); } + + CGSize viewSize = CGSizeMake(CGRectGetWidth(_scrollView.frame), MAX(contentSize.height, self.frame.size.height)); + _scrollView.contentSize = viewSize; + _textView.frame = (CGRect) { CGPointZero, viewSize }; } - (void)updatePlaceholder { @@ -728,14 +730,6 @@ - (void)setValue:(NSString *)value { [self setText:value]; } -- (void)setFontSize:(NSNumber *)fontSize { - _fontSize = fontSize; - - if ([fontSize floatValue] > 0) { - [self setFont:[UIFont systemFontOfSize:[fontSize floatValue]]]; - } -} - - (void)setDefaultValue:(NSString *)defaultValue { if (defaultValue) { [self setText:defaultValue];