React-native-web: columnWrapper on FlatList does not stretch to list container width

Created on 5 Jul 2018  路  1Comment  路  Source: necolas/react-native-web

The problem
I'm not completely sure if this is an issue or if this is how it's supposed to work, but when using numColums > 1 on a FlatList, I can't make the columnWrapper to stretch to the full width of the list.
It seems that the div that is used as the columnWrapper is within another div, so making it width:100% doesn't work as it only stretch relative to it's parent that has fixed width, and there is no way of styling that.

How to reproduce
I put a simple test case at https://codesandbox.io/s/xprnrpz36p where you can see how each row does not expand to the list width. The list has a fixed width in this case, so I could also put that width on the columnWrapper but in my real case I don't know that value and it could also change (responsive). Yes, I could calculate it on layout if that's the only way, but I'm trying to prevent that

Expected behavior
Make the columnWrapper a direct child of the list container (not sure if this is the correct solution) or maybe be able to style the wrapper of the columnWrapper? (It doesn't sound like a good idea)

Environment (include versions). Did this work in previous versions?

  • React Native for Web (version): 0.8.7
  • React (version): 16.4
  • Browser: any

Most helpful comment

If you remove alignItems: "center" from styles.list you will get the layout you're after

>All comments

If you remove alignItems: "center" from styles.list you will get the layout you're after

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhangking picture zhangking  路  3Comments

EvanBacon picture EvanBacon  路  3Comments

tgh picture tgh  路  3Comments

passion0470 picture passion0470  路  3Comments

roryabraham picture roryabraham  路  3Comments