Fixed TextInput on iOS 8 and earlier

Summary:
public

The scrolling fix I added to RCTTextView doesn't work on iOS 8 because the underlying UITextField doesn't resize correctly, which breaks text input functionality. This diff fixes it.

Reviewed By: tadeuzagallo

Differential Revision: D2712618

fb-gh-sync-id: 1d0282df3a16f1cb6ddf9d005d640738bb1b5659
This commit is contained in:
Nick Lockwood 2015-12-02 09:33:50 -08:00 committed by facebook-github-bot-6
parent c06efc0831
commit 6d29f710e1
1 changed files with 6 additions and 5 deletions

View File

@ -201,10 +201,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
- (void)updateContentSize
{
_textView.scrollEnabled = YES;
_scrollView.contentSize = _textView.contentSize;
_textView.frame = (CGRect){CGPointZero, _scrollView.contentSize};
_textView.scrollEnabled = NO;
CGSize size = (CGSize){_scrollView.frame.size.width, INFINITY};
size.height = [_textView sizeThatFits:size].height;
_scrollView.contentSize = size;
_textView.frame = (CGRect){CGPointZero, size};
}
- (void)updatePlaceholder
@ -462,7 +462,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
- (BOOL)resignFirstResponder
{
return [super resignFirstResponder] && [_textView resignFirstResponder];
[super resignFirstResponder];
return [_textView resignFirstResponder];
}
- (void)layoutSubviews