react-native-walkthrough-tooltip icon indicating copy to clipboard operation
react-native-walkthrough-tooltip copied to clipboard

Content cut off in tooltip

Open dansimau opened this issue 2 years ago • 3 comments

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?

dansimau avatar Apr 25 '22 16:04 dansimau

@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 :sob:

apfritts avatar May 05 '22 15:05 apfritts

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

apfritts avatar May 05 '22 18:05 apfritts

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.

topherPedersen avatar Jul 15 '22 23:07 topherPedersen