you don't return anything in the map function, try this:(您没有在map函数中返回任何内容,请尝试以下操作:)
<MapView style={styles.mapStyle} mapType={"mutedStandard"}>
{searchData.map((host, i) => {
if (host.location.latitude && host.location.longitude) {
console.log("TEST", host.location.latitude);
return(<Marker
key={i}
coordinate={{
latitude: host.location.latitude,
longitude: host.location.longitude
}}
title={host.name}
pinColor={"#ffd1dc"}
/>)
}
})}
</MapView>
you can see it document(你可以看到它的文件) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…