【问题标题】:Customizing my location button in airbnb/react-native-maps在 airbnb/react-native-maps 中自定义我的位置按钮
【发布时间】:2018-02-18 18:42:21
【问题描述】:

我使用 airbnb/react-native-maps 来设计基于跟踪的应用程序。我设计了一个自定义搜索框。但问题是,搜索框与我的位置按钮重叠。有什么方法可以自定义我的位置按钮并更改其对齐位置?我附上了一张照片以获得更多规格。

这是我使用的示例代码

 <MapView
    provider={PROVIDER_GOOGLE}
    style={styles.map}
    region={{
        latitude: this.props.initialPosition.latitude,
        longitude: this.props.initialPosition.longitude,
        latitudeDelta: Latitude_Delta,
        longitudeDelta: Longitude_Delta
    }}
    zoomEnabled={true}
    minZoomLevel={5}
    maxZoomLevel={20}
    showsMyLocationButton={true}
    showsUserLocation={true}
    ... ... ...
   >
   {... ... ... ...}
 </MapView>

【问题讨论】:

  • 想通了吗?

标签: reactjs react-native react-native-maps


【解决方案1】:

一个快速的解决方案是在地图顶部添加一个与custom-search-box 高度相同的填充,以将myLocationButton 推到其下方。

我浏览了它的Docs,但找不到任何方法来自定义它的位置或对齐方式。

有一个类似的issue in the github 关于这个在 6 个多月前提出的建议类似的解决方案:

https://github.com/airbnb/react-native-maps/issues/1094

【讨论】:

  • 我已经看到了这个问题。但就我而言,这是不合适的。此外,我只想自定义 myLocationButton 。并且需要帮助来做到这一点
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-09-03
  • 1970-01-01
  • 2021-05-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多