React Native FlatList with columns, Last item width

后端 未结 8 1063
北恋
北恋 2020-12-12 23:40

I\'m using a FlatList to show a list of items in two columns



        
8条回答
  •  长情又很酷
    2020-12-13 00:10

    You can try to get the current width of the device via Dimensions, do some math based on the number of columns you want to render, minus off the margins and set that as the minWidth and maxWidth.

    For example:

    const {height, width} = Dimensions.get('window');
    const itemWidth = (width - 15) / 2;
    
    
    

提交回复
热议问题