{
selected.length == 2
?
<FlatList
keyExtractor={item => "_" + item.id}
renderItem={this.renderLastItem}
data={subGroups}
numColumns={1} />
:
<FlatList
keyExtractor={item => "#" + item.id}
renderItem={this.renderItem}
data={subGroups}
numColumns={2} />
}
In the above lines of code when selected.length equals 2, I get the following error:
Invariant Violation: Changing numColumns on the fly is not supported.
These are two different lists and I am not changing numColumns. It seems to me that react native is trying to use the same object of FlatList in all conditions. How can I solve this issue ?