Skip to content

Commit d05ae5c

Browse files
authored
Add some defensive checks
Not sure if needed, but don't want to regress from facebook#24817
1 parent 71fd517 commit d05ae5c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/react-native/React/Views/ScrollView/RCTScrollView.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,9 @@ -(void)scrollViewDidZoom : (UIScrollView *)scrollView
665665
*/
666666
-(void)centerContentIfNeeded
667667
{
668-
if (_scrollView.centerContent) {
668+
if (_scrollView.centerContent &&
669+
!CGSizeEqualToSize(self.contentSize, CGSizeZero) &&
670+
!CGSizeEqualToSize(self.bounds.size, CGSizeZero)) {
669671
CGFloat top = 0, left = 0;
670672
if (self.contentSize.width < self.bounds.size.width) {
671673
left = (self.bounds.size.width - self.contentSize.width) * 0.5f;

0 commit comments

Comments
 (0)