Hasnain Ali
Hasnain Ali

Reputation: 103

Adding ellipses to placeholder in textinput in react native

I am trying to add ellipses to the end of the placeholder in my textinput in react native. I am actually using Google Maps API to get the location and display the current location as a placeholder of my text input. This is what is happening: https://i.sstatic.net/53R8I.png

How can I display the placeholder in one line, moreover add ellipses to it.

Upvotes: 0

Views: 536

Answers (1)

Nooruddin Lakhani
Nooruddin Lakhani

Reputation: 6967

When you get the location from API, just get extract 40 to 50 characters from the starts of the location string like

const userLocation = "C-5, Gilbertg Green Block C Gilbertg Green . . .";
var placeholder = userLocation.slice(0, 40);

Upvotes: 1

Related Questions