2017-01-08 55 views
0

所以我想为mapbox设置我的初始中心坐标,所以它们不是0,0。的API,它说mapbox预计React Native Mapbox gl初始中心坐标

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。有人有主意吗?

编辑: 链接git的枢纽PAGE- https://github.com/mapbox/react-native-mapbox-gl

回答

0

在你的构造尝试:

this.state = { 
    position : { 
     latitude: 49.437090, 
     longitude: 1.097456, 
    } 
}; 

和:

<MapView initialCenterCoordinate={this.state.position}> </MapView>