所以我想设置mapbox的初始中心坐标,所以它们不是0,0。在api上,它表示mapbox需要支持
initialCenterCoordinate object Optional Initial latitude/longitude the map will load at. { latitude:0, longitude: 0 }
所以我在做
<Mapbox
initialCenterCoordinate={latitude: 40.444328, longitude: -79.953155} .... other props/>
这给了我一行错误,说出意想不到的令牌,期待}。
每当我做某事时
<Mapbox
initialCenterCoordinate={{latitude: 40.444328, longitude: -79.953155}} .... other props/>
它仍然将我的初始点设置为0,0。有人有主意吗?
编辑:链接到github page- qazxsw poi
在您的构造函数中尝试使用:
https://github.com/mapbox/react-native-mapbox-gl
和:
this.state = {
position : {
latitude: 49.437090,
longitude: 1.097456,
}
};
根据<MapView initialCenterCoordinate={this.state.position}> </MapView>
,值应该是一个数组
docs