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

styling is overwritten from the javascript #9

Open
Szarko opened this issue Jul 18, 2016 · 11 comments
Open

styling is overwritten from the javascript #9

Szarko opened this issue Jul 18, 2016 · 11 comments

Comments

@Szarko
Copy link

Szarko commented Jul 18, 2016

I am not sure how you managed to apply the styles in the yelp clone demo.

The JS keeps applying 100% to width and height and position: absolute every time a Map is rendered.

@auser
Copy link
Contributor

auser commented Jul 18, 2016

Ah, yes... this is inside the component itself here: https://github.com/fullstackreact/google-maps-react/blob/master/src/index.js#L177

You can override this default or perhaps it makes sense to create an option to apply these styles conditionally.

What do you think?

@Szarko
Copy link
Author

Szarko commented Jul 18, 2016

I think a flag that is passable to the option is a good idea, if it is passed false it will apply no styles from the source component.

Thank you for your response. Great work with this.

@auser
Copy link
Contributor

auser commented Jul 18, 2016

Sure. Wanna try a PR, @Szarko ?

@auser
Copy link
Contributor

auser commented Sep 9, 2016

bump ^^

@TheMaverickProgrammer
Copy link

Did anyone fix this? I can't for the life of me set the position to 'relative'. Would fix all my problems. Tried changing the css, internal css, and it keeps forcing 'absolute'.

@rhiroy
Copy link

rhiroy commented Sep 27, 2017

@TheMaverickProgrammer did you manage to fix it? I struggled with this for a while but made it work. I took out the const style from Container and just put style={{height: '100vh', width: '100vw'}} directly into the render function in Map, on the line above 'Loading map...." and below <div ref='map'>

@TheMaverickProgrammer
Copy link

No I wrote my own

@auser
Copy link
Contributor

auser commented Sep 27, 2017 via email

@oScape
Copy link

oScape commented Jan 22, 2018

Anyone know how to remove the width and height 100% on the parent div ?
I override the styles but it recreate a parent div to override my override.

@danZheng1993
Copy link

The best way to fix this issue is this.
Apply className to the Map component.
And then define css style to the class.

<Map className="miniMap"/>

In the css file define css rules to the miniMap class

.miniMap {
  position: relative !important;
  with: 100% !important;
  height: 400px !important;
}

@ionutale
Copy link

ionutale commented Jun 9, 2020

No I wrote my own

hey @TheMaverickProgrammer can you publish the source code for the map component?

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

No branches or pull requests

7 participants