Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StandaloneSearchBox rendering problems #60

Closed
daniel17903 opened this issue Mar 13, 2019 · 4 comments
Closed

StandaloneSearchBox rendering problems #60

daniel17903 opened this issue Mar 13, 2019 · 4 comments

Comments

@daniel17903
Copy link

I am unable to get google maps rendering correctly when using the StandaloneSearchBox example code.

My code looks like this:

import React from 'react';
import { GoogleMap, LoadScript, StandaloneSearchBox } from "@react-google-maps/api";

class LocationSearchInput extends React.Component {
        
    render() {
        return (
            <LoadScript
            id="script-loader"
            googleMapsApiKey={"Api-Key"}
            language={"de"}
            region={"DE"}
            version={"weekly"}
            libraries={["places"]}
            onLoad={() => console.log("script loaded")}
            loadingElement={<div>Loading...</div>}
            >
                <GoogleMap
                    id="rectangle-example"
                    mapContainerStyle={{
                        height: "400px",
                        width: "800px"
                      }}
                      zoom={8}
                      center={{
                        lat: -34.397,
                        lng: 150.644
                      }}
                >
                    <StandaloneSearchBox>
                    <input
                        type="text"
                        placeholder="Customized your placeholder"
                        style={{
                        boxSizing: `border-box`,
                        border: `1px solid transparent`,
                        width: `240px`,
                        height: `32px`,
                        padding: `0 12px`,
                        borderRadius: `3px`,
                        boxShadow: `0 2px 6px rgba(0, 0, 0, 0.3)`,
                        fontSize: `14px`,
                        outline: `none`,
                        textOverflow: `ellipses`,
                        position: "absolute"
                        }}
                    />
                    </StandaloneSearchBox>
                </GoogleMap>
            </LoadScript>
        );
    }
}

export default LocationSearchInput;

And the map is rendering like this:
image

How can i get rid of these grey areas?

Environment

os: windows
node --version: v8.12.0
react version: 16.8.4
webpack version: 4.28.3
@react-google-maps/api: 1.1.0

@uriklar
Copy link
Collaborator

uriklar commented Mar 13, 2019

Are these grey areas constantly there? It looks a bit like tiles not loading due to connection problems

@daniel17903
Copy link
Author

daniel17903 commented Mar 14, 2019

Yes, they are there constantly. I can move the map around, zoom in or out but there are always grey areas. When looking in the chrome devtools I can not see any failed or pending network requests. There are no errors shown in the console.

Also the parts of the map that are rendered look blurred and distorted.

I tested the app in the chrome and firefox browser. The behaviour does not change.

image

image

@uriklar
Copy link
Collaborator

uriklar commented Mar 16, 2019

Hi @daniel17903,
I've tried putting your example in codesandbox and I don't get these grey bars.
Can you try editing this example: https://codesandbox.io/s/lxkw25j65q (or creating your own) that manages to re-create the issue?
Maybe you have some additional elements, css not included in your example code?

@daniel17903
Copy link
Author

While trying to re-create the issue I found the problem. I had some css included by another component that destroyed google maps:

img {
    display: block;
    max-width: 90px;
    max-height: 90px;
    width: auto;
    height: auto;
    margin: 2px;
}

Thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants