0

Somehow a new line does not get started in my popup when I am using \n

Please see a code sample below.

data.forEach((element) => { dataClean.push({ position: { lng: element.Longitude, lat: element.Latitude }, text: priceData(element) }); }); function priceData(element) { let labelText = `No.: ${element.Number}, ${element.Bedrooms} rooms\n ${element.Address}\n\n`; const data = element.history; data[0].forEach((element, indx) => { labelText = `${labelText} ∙ ${element}: ${data[1][indx]} \n`; }); labelText = `${labelText}\n${element.days} days\nstatus: ${element.status}`; return labelText; } 
0

2 Answers 2

1

Try using <br> instead of \n.

Sign up to request clarification or add additional context in comments.

Comments

1

If by popup you actually mean a modal, try adding this css property to the element containing your text:

white-space: pre;

EDIT: Don't see no mention of React Native in your original post, so obviously my answer can help only if we're talking about a classic web project, not a React Native one.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.