question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FlatList] ItemSeparatorComponent bug.

See original GitHub issue

Description

When I set horizontal true for FlatList, ItemSeparatorComponent is added vertically.

Sample Code

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  FlatList
} from 'react-native';

export default class flatlist_bug extends Component {
  constructor() {
      super();

      const arr = [];
      for(let i=0; i<100; i++)
          arr.push({key: i, value: i});
      this.state = {data: arr};
  }

  render() {
      return (
          <View style={ styles.container }>
              <FlatList style={{marginTop: 100, paddingHorizontal:30, backgroundColor:'yellow', height:20}}
                  horizontal
                  ItemSeparatorComponent={ () => <View style={ { width: 10, height: 10, backgroundColor: 'red' } } /> }
                  data={ this.state.data }
                  renderItem={ (rowData) => <Text style={{backgroundColor:'blue'}} >{ rowData.item.value }</Text> }
              />
          </View>
      );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

2017-06-22 6 48 32

Additional Information

  • React Native version: 0.45.1
  • React: 16.0.0-alpha.12
  • Platform: ios. not checked android.
  • Development Operating System: macOS

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
I-adcommented, Jun 23, 2017

image

same here, its happen after update RN to 45.0.1

0reactions
HernanAAcommented, Oct 19, 2017

That also happen to me: Android Emulator Windows “react”: “16.0.0-alpha.12”, “react-native”: “0.48.3”, image

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] FlatList ItemSeparatorComponent not work correctly.
Description When I set horizontal true for FlatList, ItemSeparatorComponent is added vertically. Please fix this bug.
Read more >
What cause glitching in FlatList in React Native?
For a while, it goes well, loads the pages perfectly but after a few pages, it starts to glitching and sometimes disappear.
Read more >
FlatList - React Native Archive
A performant interface for rendering basic, flat lists, supporting the most handy features: Fully cross-platform. Optional horizontal mode.
Read more >
Features of React Native FlatList - eduCBA
React native flatlist is like a listview which is used to hold items in a list and provide important features like scrolling horizontally...
Read more >
React Native FlatList Component - GeeksforGeeks
Props in FlatList: renderItem: It is used to render the data into the list. data: It is basically an array of data. ItemSeparatorComponent:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found