【发布时间】:2018-02-27 10:14:41
【问题描述】:
我有以下问题,无法解决。我正在关注 react-native-maps 示例并尝试设置标记。但是 .map() 不断弹出错误:
this.props.screenProps.mapLoc.markers.map 不是函数
代码是:
<MapView
style={{ left:0, right: 0, top:0, bottom: 0, position: 'absolute', backgroundColor: '#fff' }}
region={this.state.region}
onRegionChange={this.onRegionChange.bind(this)}
>
{this.props.screenProps.mapLoc.markers.map(marker => (
<MapView.Marker
coordinate={marker.Coords}
title={marker.Name}
description={marker.Description}
/>
))}
</MapView>
数据是参数在那里并且应该:
{"screenProps":{"cats":[],"mapLoc":{"markers":{"Name":"Blank","Description":"Blank","Coords":{"latitude" :56.947902,"longitude":24.097722}}}},"navigation":{"state":{"key":"Map","routeName":"Map"}}}
不知道发生了什么。
【问题讨论】:
标签: javascript react-native react-native-android react-native-maps