react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

In 5.0.0 release candidates: <Text /> without variant means no fontFamily is applied

Open getadapt opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. In 5.0.0 candidates, if you don't specify <Text /> variant=, no fontFamily is applied.

Describe the solution you'd like Perhaps there should be a fallback for variant? Maybe to "bodyMedium"?

Describe alternatives you've considered Or perhaps throw an error to make it clear that this property is required, though this would make upgrading more annoying.

In any case, without error message or default variant, it is strange for the basic Text component to get into any situation where it falls back to default font.

Additional context Context is that I tried out a release candidate and was surprised my fonts disappeared without error feedback.

getadapt avatar Sep 06 '22 10:09 getadapt

Couldn't find version numbers for the following packages in the issue:

  • react-native
  • react-native-paper
  • react-native-vector-icons

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

github-actions[bot] avatar Sep 06 '22 10:09 github-actions[bot]

Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link or link to a GitHub repo under your username).

Can you provide a minimal repro which demonstrates the issue? A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.

github-actions[bot] avatar Sep 06 '22 10:09 github-actions[bot]

Hey @getadapt, thanks for the feedback. I will investigate the problem.

lukewalczak avatar Sep 06 '22 10:09 lukewalczak

Hey @getadapt, I've checked your issue, however, I was not able to reproduce it. On the following snack, I was able to observe custom font on the Text component without specified variant. If I misunderstood your problem, please correct me or preferably attach your snack, presenting the bug.

lukewalczak avatar Sep 07 '22 21:09 lukewalczak

@lukewalczak Facing a similar issue. I think @getadapt is getting at that no font family is applied when you don't specify a variant and without inlining the font family as style prop.

In v2 it was defaulting to theme.fonts.regular but in v3 there is no font family being set: https://github.com/callstack/react-native-paper/blob/main/src/components/Typography/Text.tsx#L131

Is it possible to set a default value font family from the theme for v3, here? We have a use case where it would be great if the <Text> had a default font family without specifying a variant prop.

bsubedi26 avatar Oct 03 '22 22:10 bsubedi26

Fixed via #3409

lukewalczak avatar Oct 17 '22 08:10 lukewalczak