Recenter RCTScrollView when width or height are equal

Reviewed By: sahrens

Differential Revision: D3375944

fbshipit-source-id: 74f1c1f98364604a9be786ff233f230799d9b75d
This commit is contained in:
Gerald Monaco 2016-06-03 16:52:17 -07:00 committed by Facebook Github Bot 4
parent f4dbf37ba8
commit 5961764668
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}
}