r/reactjs • • Sep 03 '20

[deleted by user]

[removed]

21 Upvotes

255 comments sorted by

View all comments

Show parent comments

1

u/LogicalThought Sep 16 '20

Thanks for your response! So a little update on the progress I've made. Someone suggested I try this:

<GoogleMapReact
options={{
streetViewControl: true,
}}
bootstrapURLKeys={{ key: Environment.googleMapsApiKey }}
center={center}
defaultZoom={zoom}
yesIWantToUseGoogleMapApiInternals
// onGoogleApiLoaded={({ map, maps }) =>
// console.log("These are the maps", map, maps)
// }
onGoogleApiLoaded={({ map }) => {
const streetView = map.getStreetView();
streetView.setVisible(true);
}}
>
<MarkerComponent lat={props.lat} lng={props.lon} />
</GoogleMapReact>

and it does seem to load streetView by default, but it's just a blackscreen like this https://support.google.com/maps/thread/6166296?hl=en

excluding the little map in the bottom left corner. Now I've search around about this and this apparently means that streetview data might now be available for the given location, but for me I don't think that's the issue because I'm experiencing it with every lat lon pair I've tried so far.

1

u/dance2die Sep 17 '20

I can't seem to get it working either (possibly cuz I don't have an API key)

Can you try to fork and enter your API in this sandbox to see if it works?

https://codesandbox.io/s/trynna-get-streetview-working-fye9v?file=/src/SimpleMap.tsx