我尝试在react原生应用程序上使用mapView.markers,它们工作得很好,但不知何故,当我试图从firebase数据库调用位置和信息列表时,它们没有显示在地图上。
配置文件
.........|_id: 1234
.........|_kind:"kind“
.........|_name:“名称”
.........|_location
.................|_0: 38.4015
.................|_1:-122.104641
和我的编程
<MapView
onPress={this.props.onPress}
rotateEnabled={false}
style={styles.map}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
>
{this.state.profiles.slice(profileIndex).reverse().map(profile => (
<MapView.Marker
key={profile.id}
coordinate={{ longitude: profile.location[0], latitude: profile.location[1] }}
Title={profile.name}
Description={profile.kind}
>
<View style={styles.radius2}>
<Image style={styles.marker} source={require('../images/marcador.png')} />
</View>
</MapView.Marker>
))}
</MapView>我希望能看到所有的标记。
发布于 2019-05-02 20:56:16
根据您的代码,您将使用数组名称profiles。但是在您的问题中,您提到了数组名称是profile
https://stackoverflow.com/questions/55945387
复制相似问题