This is a piece of code that helps to properly format the data being inputted to acheive a perfect grid.
It simply adds more items to your array to make the rows equal and it the rows has equal number of items then it doesn't do anything, it's left to you to hide the dummy data that was added.
Example: You can use it in react-native's FlatList