【问题标题】:Implement custom Mapbox map React Native实现自定义 Mapbox 地图 React Native
【发布时间】:2018-08-02 23:29:09
【问题描述】:

我目前正在尝试将我在 Mapbox Studio 中创建的自定义地图实现到我的 RN 应用程序中。代码如下所示:

render() {
 const {StyleURL} = 'url';
 const {mapLight} = 'url';
 return(
   <View style={styles.container}>
   <Mapbox.MapView
       accessToken={'token'}
       styleURL= {mapLight}
       zoomLevel={16}
       centerCoordinate={[this.state.xCoord, this.state.yCoord]}
       style={{flex: 1}}
       showUserLocation={true}
       pitchEnabled={false}>

   </Mapbox.MapView>
   </View>
 )

}

我确实在我的应用程序上实现了地图视图,但是,它不是我在 Mapbox Studio 中设计的地图。是的,我使用了正确的样式 url,是的,它是正确的访问令牌。关于为什么会这样的任何帮助/解释?谢谢,在这一点上,我真的很感激任何见解。

【问题讨论】:

    标签: react-native mapbox mapbox-gl-js mapbox-android


    【解决方案1】:

    鉴于手头的信息,这是一个非常简单的选择:根据上图从 Mapbox Studio 仪表板下载样式,并在包含地图的组件中使用它。

    const mapboxStyle = require("./downloadedFolderName/style.json")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-23
      • 2022-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多