I would like to have my page with N elements inside and each of these elements should be placed in group of 2 (ex : A B, bellow: C D, bellow: E).How do I make it so that when I do my return, the View change? I already got the part where I can put all elements together on one line and I also found a solution(
const length = letter.data?.length;const length2 = length % 2;const nbrlignes = 1 + (length + length2) / 2;
) for the issue of how many line/View it should have.What I want is to create something like a for before using my return :
{letter.data?.map((item, index) => { //for (let io; i <= nbrlignes; i++) {} return (<View style={{ width: "40%", marginLeft: 70 }}><Text style={{ fontSize: 18, fontWeight: "600", marginTop: 25, width: "50%", }}> {letter.data[index]} {"\n"}</Text><Text style={{ marginTop: 50, width: "50%" }}> {letter.description[index]} {"\n"}</Text></View> ); })}
Here is my data :
const letter = [ { id: "1", name: "A", data: ["Abricot", "Abricot", "Abricot"], description: ["Un abricot est un fruit","Un abricot est un fruit","Un abricot est un fruit", ], },]