react-native-grid-view icon indicating copy to clipboard operation
react-native-grid-view copied to clipboard

Stretching

Open ghost opened this issue 9 years ago • 4 comments

It is currently not creating a real grid. If my grid is 2 items per row and i have 5 items, the 5th item is rendered across the entire row rather than in it's own part of the grid. This makes for an annoying effect:

image

ghost avatar Sep 30 '15 22:09 ghost

I changed the code with the following to add the prop "cleanGrid={true}"

 if (group.length > 0) {
      if (this.props.cleanGrid == true) {
        while (group.length < itemsPerRow) {
          group.push(null);
        }
      }
      itemsGroups.push(group);
    }

This will just push a null response for the amount of rows defined so that the user can check in the render item for null and return an empty container as needed. Not sure if there is a better way of handling this but it works!

image

ghost avatar Sep 30 '15 22:09 ghost

@bradynapier nice work, I used your code.

daemonchen avatar Oct 23 '15 06:10 daemonchen

+1 This should work by default. Please create a pull request.

maluramichael avatar Jan 13 '16 14:01 maluramichael

@bradynapier Who to add the code? Would you give me the whole sources of index.js! I learn React for the first time,I don't know how to add the prop "cleanGrid={true}".

hcf0813 avatar Apr 29 '16 01:04 hcf0813