首页 > 解决方案 > MapView.Polyline 在 react-native-web-maps 中不起作用

问题描述

在我的 Android 应用程序中,它绘制了折线,但它在 Web 中不起作用。即使在那本故事书中我也找不到任何例子。但在文档中提到它支持折线。

我的代码

<MapView
    provider={this.props.provider}
    style={styles.map}
    initialRegion={this.state.region}
    onPress={e => this.onMapPress(e)}
    onLayout={()=>console.log('map on layout')}
    ref={(ref) => { this.mapRef = ref }}
    onRegionChange={this.onRegionChange}
>
    <MapView.Marker 
    coordinate={
                    {
                        latitude: 17.43745,
                        longitude: 78.48229
                        }
                }
    title={'pickup Location'}
    />

    <MapView.Marker 
    coordinate={
                    {
                        latitude: 17.4049696,
                        longitude: 78.4043356
                        }
                }
    title={'pickup Location'}
    pinColor="green"
    />
    <MapView.Polyline coordinates={this.dummyCoords} strokeWidth={2} strokeColor={'rgba(r,g,b,0.5)'} fillColor={'rgba(r,g,b,0.5)'}/>
</MapView>

任何人都可以分享示例,我被卡住了。

标签: react-nativegoogle-mapsreact-native-mapsreact-native-web

解决方案


推荐阅读