Fixes #issue18098 SectionList scrollToLocation (#21577)

Summary:
Fixes #18098
Pull Request resolved: https://github.com/facebook/react-native/pull/21577

Differential Revision: D13761884

Pulled By: cpojer

fbshipit-source-id: a096d69c589815d00754427fb575de0d8d0b595f
This commit is contained in:
Christoph Nakazawa 2019-01-22 07:22:08 -08:00 committed by Facebook Github Bot
parent 01f1780314
commit f66e8ebf51
1 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,7 @@
*/
'use strict';
const Platform = require('Platform');
const React = require('React');
const View = require('View');
const VirtualizedList = require('VirtualizedList');
@ -145,7 +146,7 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
sectionIndex: number,
viewPosition?: number,
}) {
let index = params.itemIndex + 1;
let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex - 1;
for (let ii = 0; ii < params.sectionIndex; ii++) {
index += this.props.sections[ii].data.length + 2;
}