【问题标题】:Disable streetview, full screen of google map in react禁用街景,全屏谷歌地图反应
【发布时间】:2021-10-01 09:06:13
【问题描述】:

我使用了这个 npm 包,“google-maps-react” link,有什么方法可以禁用/删除全屏、街景功能?我试图找到方法,但似乎无法使用这个库,请帮助我。 这是我的代码。

const myComp = props => {
  return(
    <Map
                  google={props.google}
                  style={{ width: "100%", height: "100%" }}
                  zoom={12}
                  onDragend={handleMapCenterChanged}
                  onReady={fetchPlaces}
                >
               
    </Map>
  )
}
export default connect(
  mapStateToProps,
  {}
)(
  GoogleApiWrapper({
    apiKey: API_KEY,
    LoadingContainer: LoadingContainer,
  })(myComp)
)

【问题讨论】:

    标签: javascript reactjs google-maps google-maps-api-3 react-redux


    【解决方案1】:

    要在使用 google-maps-react 库时禁用这些控件,您需要将每个控件的 parameters 设置为 false。你可以按照这个:

       <Map
                google={this.props.google}
                zoom={14}
                style={mapStyles}
                initialCenter={{ lat: 40.756795, lng: -73.954298 }}
                fullscreenControl={false}
                streetViewControl={false}
              />
    

    【讨论】:

      猜你喜欢
      • 2015-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-04
      • 2015-10-09
      • 2022-09-26
      • 1970-01-01
      相关资源
      最近更新 更多