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

Content cut off in tooltip #152

Open
dansimau opened this issue Apr 25, 2022 · 3 comments
Open

Content cut off in tooltip #152

dansimau opened this issue Apr 25, 2022 · 3 comments

Comments

@dansimau
Copy link

I am trying to build a simple tooltip:

const styles = StyleSheet.create({
  tooltipTitle: {
    marginBottom: 10,
    fontWeight: "bold",
  },
  tooltipText: {
    color: "#444",
    fontSize: 16,
    lineHeight: 20,
  },
});

export const makeTooltipContent = (opts: {title?: string; text: string}) => (
  <View style={{padding: 8}}>
    {opts.title !== undefined ? (
      <Text style={[styles.tooltipText, styles.tooltipTitle]}>
        {opts.title}
      </Text>
    ) : null}

    <Text style={styles.tooltipText}>{opts.text}</Text>
  </View>
);

Snippet from my component:

                <Tooltip
                  isVisible={true}
                  content={makeTooltipContent({
                    title: "Leave a personal note",
                    text: "Help others know why a place is great. ✨",
                  })}
                  placement="left">
                  <FilledButton style={Buttons.Text} title="Add tip" />
                </Tooltip>

The result is:

Screenshot 2022-04-25 at 17 01 09

Am I missing something?

@apfritts
Copy link

apfritts commented May 5, 2022

@dansimau did you find a solution to this? Or figure out what was causing it? We're QA'ing our app now and it's happening to our production builds but wasn't happening in dev builds 😭

@apfritts
Copy link

apfritts commented May 5, 2022

I ended up fixing this by adding {flex: 1, flexGrow: 1} to the text style.

@topherPedersen
Copy link

topherPedersen commented Jul 15, 2022

I ran into this issue today as well. I think the issue might have something to do with Text components? I tried removing the text component, and replaced it with a red square and things started working again.

Also, when you make CSS changes to the tooltip, you may need to reload the app by pressing 'r' in the metro bundler console. I noticed when I just hit save and the app does a hot reload, sometimes the tooltips won't render correctly. But if I press 'r' in the metro bundler terminal, and then log back into my organization's app, then things would start rendering properly.

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

3 participants