From e40bd2361b5d8956ba34315706471017c3be181d Mon Sep 17 00:00:00 2001 From: Nathaniel Rankin Webb Date: Sun, 12 Mar 2017 18:17:46 -0500 Subject: [PATCH] Updated iOS ScrollView's method .scrollToEnd to protect against exceeding the 0 boundary. --- React/Views/RCTScrollView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/React/Views/RCTScrollView.m b/React/Views/RCTScrollView.m index 32bcaeacc94d..9fa892d6bcf1 100644 --- a/React/Views/RCTScrollView.m +++ b/React/Views/RCTScrollView.m @@ -529,9 +529,9 @@ - (void)scrollToEnd:(BOOL)animated BOOL isHorizontal = [self isHorizontal:_scrollView]; CGPoint offset; if (isHorizontal) { - offset = CGPointMake(_scrollView.contentSize.width - _scrollView.bounds.size.width, 0); + offset = CGPointMake(fmax(_scrollView.contentSize.width - _scrollView.bounds.size.width + _scrollView.contentInset.right, 0), 0); } else { - offset = CGPointMake(0, _scrollView.contentSize.height - _scrollView.bounds.size.height); + offset = CGPointMake(0, fmax(_scrollView.contentSize.height - _scrollView.bounds.size.height + _scrollView.contentInset.bottom, 0)); } if (!CGPointEqualToPoint(_scrollView.contentOffset, offset)) { // Ensure at least one scroll event will fire