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

Fix tooltip width #4230

Closed
DoneDeal0 opened this issue May 9, 2022 · 2 comments
Closed

Fix tooltip width #4230

DoneDeal0 opened this issue May 9, 2022 · 2 comments
Labels
bug Something isn't working stale

Comments

@DoneDeal0
Copy link

DoneDeal0 commented May 9, 2022

Bug report

Custom tooltip's width are very narrow. Each character fills a line.

There are currently 3 ways to fix it:

  1. apply a fixed width (ex: width: 200), but it creates a weird ui depending of the text (too large or too small, rarely well adjusted)
  2. apply a position: relative property to the Callout element (as child of the Marker), but the Marker is not properly positioned on the map anymore (this is particularly true when zooming on a map with a circle. We clearly see that the Marker is out of range).
  3. stop using a custom tooltip and simply give title and/or description props to the marker, but the tooltip is ugly and can't be styled.

Suggested fixes:
a) give a width: "100% to the Callout's tooltip, so the problem is gone.
b) allow a tooltipStyle prop on the Marker so we can use the default tooltip with ease (relevant props would be: backgroundColor, borderRadius, titleColor, descriptionColor)

Environment info

  react-native: 0.64.3
  react: 17.0.1
  react-native-maps: 0.29.4

I'm using Expo.

For the moment, the best option I came up with is:

   <Callout style={getToolipStyle(title, description)} tooltip>
              <Tooltip title={title} description={description} />
    </Callout>

export const getToolipStyle = (title: string, description: string) => {
  const _width = title.length > titles.length ? description.length : description.length;
  return {
    display: "flex",
    justifyContent: "center",
    alignItems: "center",
    width: _width * 9,
    borderRadius: 8,
  };
};
@DoneDeal0 DoneDeal0 added the bug Something isn't working label May 9, 2022
@stale
Copy link

stale bot commented Jul 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 10, 2022
monholm added a commit that referenced this issue Jul 28, 2022
Stalebot has performed poorly lately, not labeling stale issues, not closing stale issues,
not removing stale label when updates occur etc. E.g.: #4230 and #3804. Looking at the stalebot repo
this isn't isolated to react-native-maps, and it also seems like the bot has been abandoned in favor
of the stale action.
monholm added a commit that referenced this issue Jul 28, 2022
Stalebot has performed poorly lately, not labeling stale issues, not closing stale issues,
not removing stale label when updates occur etc. E.g.: #4230 and #3804. Looking at the stalebot repo
this isn't isolated to react-native-maps, and it also seems like the bot has been abandoned in favor
of the stale action.
@jagthedrummer
Copy link

This is still a bug and should not have been closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

2 participants