I have a product component - TouchableOpacity as shown in picture. Number of products is dynamic.Thing is that, I want to post 2 products on each row. But I can't. It renders them vertically, although I set horizontal as true. How can I solve, it? Do you have any suggestion?
Here is my styling of the component
The default value for flexDirection
in react-native is column
. You should set it to row
in the style of the container of your list of TouchableOpacity
.
Here is an example from the official documentation : https://facebook.github.io/react-native/docs/flexbox.html#flex-direction
If you want your elements, that exceed the container size to be wrapped to the next line, you can set flexWrap:"wrap"
.
Here is the doc: https://facebook.github.io/react-native/docs/layout-props.html#flexwrap