diff --git a/React/Views/RCTScrollView.m b/React/Views/RCTScrollView.m index 9c4be9d6f..24d129ba8 100644 --- a/React/Views/RCTScrollView.m +++ b/React/Views/RCTScrollView.m @@ -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]; } /**