Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
Las coordenadas de error de React Native Mapbox-gl deben contener un número, he encasillado las coordenadas pero sigue dando el mismo error. ¿Cómo puedo arreglarlo?

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.

esto es 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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Utilice la geocodificación para este fin.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!