mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix #flingAndSnap to check all the scroll item for offset range
Summary: When calculating the offset range, we assume the first item is always at offset zero position and skipped that (as the smallerOffset is zero). However, this may not be the case in some situations. This diff changes the range measuring loop to always start from the first item. Changelog: [Android][Fixed] - Do NOT skip the first child view in the scroll view group when measuring the lower and upper bounds for snapping. Reviewed By: mdvacca Differential Revision: D31887086 fbshipit-source-id: af7221a621b2719d057afa6b64aa91c94ac01295
This commit is contained in:
committed by
Facebook GitHub Bot
parent
25605fb6c5
commit
61e1b6f86c
+1
-1
@@ -983,7 +983,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
||||
maximumOffset);
|
||||
} else {
|
||||
ViewGroup contentView = (ViewGroup) getContentView();
|
||||
for (int i = 1; i < contentView.getChildCount(); i++) {
|
||||
for (int i = 0; i < contentView.getChildCount(); i++) {
|
||||
View item = contentView.getChildAt(i);
|
||||
int itemStartOffset =
|
||||
getItemStartOffset(mSnapToAlignment, item.getLeft(), item.getWidth(), width);
|
||||
|
||||
@@ -766,7 +766,7 @@ public class ReactScrollView extends ScrollView
|
||||
maximumOffset);
|
||||
} else {
|
||||
ViewGroup contentView = (ViewGroup) getContentView();
|
||||
for (int i = 1; i < contentView.getChildCount(); i++) {
|
||||
for (int i = 0; i < contentView.getChildCount(); i++) {
|
||||
View item = contentView.getChildAt(i);
|
||||
int itemStartOffset;
|
||||
switch (mSnapToAlignment) {
|
||||
|
||||
Reference in New Issue
Block a user