React Native FlatList separator between columns

前端 未结 6 1564
不思量自难忘°
不思量自难忘° 2021-02-18 20:57

I have a FlatList with multiple columns:

             


        
6条回答
  •  独厮守ぢ
    2021-02-18 21:24

    Sorry, I also did not find a way to add a column separator using properties in the flatlist component. So I just added the view outside the text component in the render item like this:

    export default class App extends Component {
    
     render() {
      return (
       
         (
            
              {item}
            
          )}
        />
       
      );
     }
    }
    
    const styles = StyleSheet.create({
     view: {
      paddingTop: 30,
     },
     text: {
      flex: 1,
      fontSize: 40,
      textAlign: 'center'
     },
     separator: {
      flex: 1, 
      borderWidth: 1, 
      borderColor: 'red'
     },
    });
    

    And this is the result:

    I hope this is can help you. :)

提交回复
热议问题