ScrollView/TextInput: The amnesty of `scrollRectToVisible`
Reviewed By: javache Differential Revision: D5414438 fbshipit-source-id: 45b6a32bc2584ed99efd1514d724e2b5ca29d8e9
This commit is contained in:
parent
f89e132719
commit
fa1d4e8d81
|
@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue