1

다음 문제가 있습니다. 머리를 감쌀 수 없습니다. 나는 react-native-maps 예제를 따르고 있고 마커를 설정하려고한다.네이티브 this.props.screenProps.mapLoc.markers.map가 함수가 아닙니다.

this.props.screenProps.mapLoc.markers.map is not a function

코드는 다음과 같습니다 : 그러나 .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> 

데이터 PARAMS이 있고을 등을 수행해야합니다

{"screenProps":{"cats":[],"mapLoc":{"markers":{"Name":"Blank","Description":"Blank","Coords":{"latitude":56.947902,"longitude":24.097722}}}},"navigation":{"state":{"key":"Map","routeName":"Map"}}}

무슨 일이 일어나고 있는지 단서 .

답변

0

개체에는 기능이 없습니다 map(), only arrays do.

this.props.screenProps.mapLoc.markers이 대상입니다.