MapView Typescript?


#1

I am trying to get MapView from Expo working with Typescript. I have pulled the types from react-native-maps, and have gotten a map to populate, but I cannot get the markers to show. When I try to use MapView.Marker, I get an error that “Property ‘Marker’ does not exist on type ‘typeof MapView’.” I have tried using just Marker, but that does not work, either. If anyone can help me, I would really appreciate it.

This is what I am returning:

<View style={styles.container}> <MapView style={{ alignSelf: 'stretch', height: 200 }} initialRegion={{ latitude: latitude, longitude: longitude, latitudeDelta: 0.004757, longitudeDelta: 0.006866 }} provider={'google' } showsUserLocation={true} annotations={markers} loadingEnabled = {true} showsBuildings={true} showsIndoors={true} > {markers.map((marker:any, i:number) => { return ( <MapView.Marker coordinate={marker.coordinate} title={marker.title} key={i} /> )} ) } </MapView> </View>


#2

Never mind, it throws an error, but renders in the simulator (wasn’t rendering before, not sure what changed).


closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.