ScrollView/TextInput: The amnesty of `scrollRectToVisible`

Reviewed By: javache

Differential Revision: D5414438

fbshipit-source-id: 45b6a32bc2584ed99efd1514d724e2b5ca29d8e9
This commit is contained in:
Valentin Shergin 2017-07-18 14:33:49 -07:00 committed by Facebook Github Bot
parent f89e132719
commit fa1d4e8d81
1 changed files with 14 additions and 2 deletions

View File

@ -214,9 +214,21 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
} }
} }
- (void)scrollRectToVisible:(__unused CGRect)rect animated:(__unused BOOL)animated - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated
{ {
// noop // Limiting scroll area to an area where we actually have content.
CGSize contentSize = self.contentSize;
UIEdgeInsets contentInset = self.contentInset;
CGSize fullSize = CGSizeMake(
contentSize.width + contentInset.left + contentInset.right,
contentSize.height + contentInset.top + contentInset.bottom);
rect = CGRectIntersection((CGRect){CGPointZero, fullSize}, rect);
if (CGRectIsNull(rect)) {
return;
}
[super scrollRectToVisible:rect animated:animated];
} }
/** /**