Fixed ListViewMock unique key error when many sections

Summary:
When ListViews has multiple sections, then rowIDs are required to be unique per section.
However the ListViewMock required rowIDs to be unique per whole list.
This change fixes the limitation of ListViewMock.
Closes https://github.com/facebook/react-native/pull/13642

Differential Revision: D5189675

Pulled By: shergin

fbshipit-source-id: 8a4fb68feb74af3307407d6d70f3f6642f50452a
This commit is contained in:
Tomasz Szajna 2017-06-05 22:26:20 -07:00 committed by Facebook Github Bot
parent aeccbd6906
commit a3249650d6
1 changed files with 2 additions and 1 deletions

View File

@ -32,9 +32,10 @@ class ListViewMock extends React.Component {
const rowIDs = allRowIDs[sectionIdx];
for (let rowIdx = 0; rowIdx < rowIDs.length; rowIdx++) {
const rowID = rowIDs[rowIdx];
// Row IDs are only unique in a section
rows.push(
<StaticRenderer
key={rowID}
key={'section_' + sectionID + '_row_' + rowID}
shouldUpdate={true}
render={this.props.renderRow.bind(
null,