Skip to content

Marker position#1049

Draft
IBanda wants to merge 5 commits intogoogle-map-react:masterfrom
IBanda:marker-position
Draft

Marker position#1049
IBanda wants to merge 5 commits intogoogle-map-react:masterfrom
IBanda:marker-position

Conversation

@IBanda
Copy link
Copy Markdown

@IBanda IBanda commented Jul 20, 2021

PR to introduce the markerPosition prop to position the marker in regards to transform:translate(x,y).
The prop takes a string composed of the X axis value and Y axis value separated by a single white space
The prop can take following values for the X axis;

  • left === 0
  • center === -50%
  • right === -100%

and the following for the Y axis;

  • top === 0
  • center === -50%
  • bottom === -100%

For example

<GoogleMapReact>
<Marker markerPosition="left center"/>
</GoogleMapReact>

center: '-50%',
bottom: '-100%',
};
const isNotProduction = process.env.NODE_ENV !== 'production';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? :)

Copy link
Copy Markdown
Author

@IBanda IBanda Jul 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using it to determine whether to console.error when an invalid prop value is provided

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to match how proptypes works

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sounds good! We could call it isProduction instead, and then do if (!isProduction)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright :) I will make that update

...latLng,
};

const markerPosition = child.props.markerPosition || 'center center';
Copy link
Copy Markdown
Member

@itsmichaeldiego itsmichaeldiego Jul 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default should be google map's default, which is center bottom

Copy link
Copy Markdown
Author

@IBanda IBanda Jul 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marker positioning

Just for clarity, is that the same thing referenced in the docs? 👆

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IBanda We're changing the default position, yes, therefore we have to update the docs

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

Successfully merging this pull request may close these issues.

2 participants