Recenter RCTScrollView when width or height are equal
Reviewed By: sahrens Differential Revision: D3375944 fbshipit-source-id: 74f1c1f98364604a9be786ff233f230799d9b75d
This commit is contained in:
parent
f4dbf37ba8
commit
5961764668
|
@ -259,10 +259,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||
if (contentView && _centerContent) {
|
||||
CGSize subviewSize = contentView.frame.size;
|
||||
CGSize scrollViewSize = self.bounds.size;
|
||||
if (subviewSize.width < scrollViewSize.width) {
|
||||
if (subviewSize.width <= scrollViewSize.width) {
|
||||
contentOffset.x = -(scrollViewSize.width - subviewSize.width) / 2.0;
|
||||
}
|
||||
if (subviewSize.height < scrollViewSize.height) {
|
||||
if (subviewSize.height <= scrollViewSize.height) {
|
||||
contentOffset.y = -(scrollViewSize.height - subviewSize.height) / 2.0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue