I have been having problems getting react-native-maps to work properly on android. The issue is that when I load my array data it works only on IOS. It generates like this :
<code>const locationData = [
{latitude: "52.4194975", longitude: "-1.5101260"},
{latitude: "52.403002", longitude: "-1.491740"}
];
</code>
<code>const locationData = [
{latitude: "52.4194975", longitude: "-1.5101260"},
{latitude: "52.403002", longitude: "-1.491740"}
];
</code>
const locationData = [
{latitude: "52.4194975", longitude: "-1.5101260"},
{latitude: "52.403002", longitude: "-1.491740"}
];
It is generated from a MYSQL database using PHP.
I display the markers like so:
<code>{locationData.map((data, index) => (
<Marker
key={index}
coordinate={{
latitude: data.latitude,
longitude: data.longitude
}}
/>
))}
</code>
<code>{locationData.map((data, index) => (
<Marker
key={index}
coordinate={{
latitude: data.latitude,
longitude: data.longitude
}}
/>
))}
</code>
{locationData.map((data, index) => (
<Marker
key={index}
coordinate={{
latitude: data.latitude,
longitude: data.longitude
}}
/>
))}
It will work on both IO and Android when I use this :
<code> const locationData = [
{latitude: 52.4194975, longitude: -1.5101260},
{latitude: 52.403002, longitude: -1.491740}
];
</code>
<code> const locationData = [
{latitude: 52.4194975, longitude: -1.5101260},
{latitude: 52.403002, longitude: -1.491740}
];
</code>
const locationData = [
{latitude: 52.4194975, longitude: -1.5101260},
{latitude: 52.403002, longitude: -1.491740}
];
But if I use this it does not work on Android but its OK on IOS :
<code> const locationData = [
{latitude: "52.4194975", longitude: "-1.5101260"},
{latitude: "52.403002", longitude: "-1.491740"}
];
</code>
<code> const locationData = [
{latitude: "52.4194975", longitude: "-1.5101260"},
{latitude: "52.403002", longitude: "-1.491740"}
];
</code>
const locationData = [
{latitude: "52.4194975", longitude: "-1.5101260"},
{latitude: "52.403002", longitude: "-1.491740"}
];
Its obvious it is because of the “” I have tried adding these but they do not work?
<code>latitude: data.latitude,replace('"', '')
latitude: data.latitude,str.replace('"', "")
</code>
<code>latitude: data.latitude,replace('"', '')
latitude: data.latitude,str.replace('"', "")
</code>
latitude: data.latitude,replace('"', '')
latitude: data.latitude,str.replace('"', "")
Is there a workaround or am I missing something? Thanks