Skip to content

Commit 8fa116c

Browse files
danilobuergerfacebook-github-bot
authored andcommitted
Fixed regression in SectionList caused by #21577 not being able to scroll to top on android (#24034)
Summary: ``` let index = params.itemIndex + 1; ``` to ``` let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex - 1; ``` to fix an issue on iOS. Note however, how the sign for non iOS changed from `+` to `-` causing a crash on Android when trying to scroll to index 0 as that will be evaluated to -1 instead of 1 and thus be out of bounds. [Android] [Fixed] - Fixed regression in SectionList caused by #21577 not being able to scroll to top on android Pull Request resolved: #24034 Differential Revision: D14520796 Pulled By: cpojer fbshipit-source-id: bb49619f49752fd3f343ef3b7bf1b86ac48af7f8
1 parent 0827184 commit 8fa116c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Libraries/Lists/VirtualizedSectionList.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
146146
sectionIndex: number,
147147
viewPosition?: number,
148148
}) {
149-
let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex - 1;
149+
let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex + 1;
150150
for (let ii = 0; ii < params.sectionIndex; ii++) {
151151
index += this.props.sections[ii].data.length + 2;
152152
}

0 commit comments

Comments
 (0)