FlatList with 2 columns are not acting as expected #19156
Labels
Ran Commands
One of our bots successfully processed a command.
Resolution: For Stack Overflow
A question for Stack Overflow. Applying this label will cause issue to be closed.
Resolution: Locked
This issue was locked by the bot.
I'm using a FlatList with 2 columns, it works fine except in few rows, it takes the complete row.
Environment
OS: macOS High Sierra 10.13.4
Node: 9.11.1
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 3.1 AI-173.4697961
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.1
react-native: ^0.54.0 => 0.54.4
Steps to Reproduce
Run the below mentioned code and pass an array of data to the FlatList.
Here is my code -
<FlatList vertical numColumns={2} extraData={this.state} data={this.state.bikeCities} style={styles.CityListView} showsVerticalScrollIndicator={false} keyExtractor={(item, index) => index.toString()} renderItem={({item:rowData, index}) => { if(rowData.country_id == this.state.selectedCountryId) { return( <TouchableOpacity style={styles.FlatListStyle} onPress={() => this.props.citySelection(rowData, this.state.selectedView)}> <Text style={styles.cityText}>{rowData.name}</Text> </TouchableOpacity> ); } }}/>
Expected Behavior
Each row should have 2 columns.
Actual Behavior
In few rows only one column is rendered.
I've rendered a screenshot.
The text was updated successfully, but these errors were encountered: