在airbnb/react-native-maps中自定义我的位置按钮

9

我使用了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>

enter image description here


1
你解决了吗? - Abanoub
1个回答

0
一个快速的解决方案是在地图顶部添加一个与您的custom-search-box高度相同的填充,以将myLocationButton推到其下方。
我查看了文档,但找不到任何自定义其位置或对齐方式的方法。
在GitHub上有一个类似的问题,已经提出了超过6个月,建议使用类似的解决方案:

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


2
我看到了那个问题。但在我的情况下不适用。此外,我只想自定义myLocationButton。需要帮助来完成。 - bpsourav21

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接