Estoy enfrentando este error. Las coordenadas almacenadas en la base de datos de App están en String . He encasillado las coordenadas de la cadena en Número, pero sigo enfrentándome a este error.
Este es mi código de mapa
import { View, Text, StyleSheet } from "react-native"; import MapView, { Marker } from "react-native-maps"; import MapboxGL from "@react-native-mapbox-gl/maps"; MapboxGL.setConnected(true); const Map = ({ data, locationData }) => { console.log(data); useEffect(() => { MapboxGL.setTelemetryEnabled(false); }, []); const [startCoordinate, setStartCoordinate] = useState([ Number(locationData.startLong), Number(locationData.startLat), ]); const [endCoordinate, setEndCoordinate] = useState([ Number(locationData.endLong), Number(locationData.endLat), ]); const renderMarkers = data.map((marker, index) => { return ( <MapboxGL.PointAnnotation coordinate={[ Number(marker.longitude), Number(marker.latitude), ]} // key={index} > <View style={{ height: 30, width: 30, backgroundColor: "red", borderRadius: 50, borderColor: "#fff", borderWidth: 3, }} /> </MapboxGL.PointAnnotation> ); }); return ( <View style={styles.page}> <View style={(StyleSheet.absoluteFillObject, styles.container)}> <MapboxGL.MapView style={styles.map}> <MapboxGL.Camera zoomLevel={7} centerCoordinate={startCoordinate} /> <MapboxGL.PointAnnotation coordinate={startCoordinate} /> {renderMarkers} <MapboxGL.PointAnnotation coordinate={endCoordinate} /> </MapboxGL.MapView> </View> </View> ); }; const styles = StyleSheet.create({ page: { flex: 1, justifyContent: "center", alignItems: "center", backgroundColor: "#F5FCFF", marginBottom: 50, }, container: { height: 300, width: "100%", backgroundColor: "tomato", }, map: { flex: 1, }, }); export default Map;En el código anterior, puede verificar que he encasillado la cadena en el número, pero sigo enfrentando el mismo error, las coordenadas deben contener números
Gracias de antemano
Utilice la geocodificación para este fin.