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:
parent
aeccbd6906
commit
a3249650d6
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue