tamagui: Adding fontWeight: 600 with system-fonts doesn't make texts appear bold on Android

Current Behavior

I have a custom Tamagui theme that uses the system font on each platform. In my theme settings I set 600 as the value for weight number 3. When using this value in my custom components either inline or with the styled function as fontWeight="$3" it works on iOS, but on Android the fonts are rendered as regular weight.

I’m only developing for Android and iOS right now, so web doesn’t concern me. However I do use @storybook/addon-react-native-web for presentation and QA and in the browser based Storybook environment the font-weight works properly.

I think this might be related to an earlier issue reported here, but I see you’ve closed that for lack of reproducible example.

Expected Behavior

The value 600 for the fontWeight property should render a bolded text on both Android and iOS. If I add the basic Text component imported from react-native, that works on both platform.

<Text style={{ fontWeight: "600" }}>
    Native Text component that's bold
</Text>

Tamagui Version

1.91.3

Platform (Web, iOS, Android)

Tested on:

  • Android (Emulator): Pixel 7 Pro API level 34
  • Android physical device: Google Pixel 4, Android Version 13, Expo Go v2.30.11
  • iOS (Simulator): iPhone 15, iOS 17.2

Reproduction

  1. Clone the example repository
  2. Install dependencies (npm run install)
  3. Run npm run ios and npm run android in two separate terminal windows and open the app in two emulators (or physical devices using Expo Go).
  4. Tap on the “Toggle emphasis” button and observe that the text becomes bold on iOS, while it stays the same on Android.
  5. Also observe the text “Native Text component that’s bold” below the button, this is a native Text component with fontWeight set to 600 and it gets bolded on both platforms.

System Info

System:
    OS: macOS 14.2.1
    CPU: (8) arm64 Apple M1
    Memory: 59.23 MB / 16.00 GB
    Shell: 3.7.0 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.11.0 - /usr/local/bin/node
    npm: 10.2.4 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 123.1.64.122
    Chrome: 124.0.6367.60
    Safari: 17.2.1
  npmPackages:
    @babel/core: ^7.20.0 => 7.24.4 
    @tamagui/config: 1.91.3 => 1.91.3 
    @tamagui/core: 1.91.3 => 1.91.3 
    @types/react: ~18.2.45 => 18.2.79 
    expo: ~50.0.14 => 50.0.17 
    expo-status-bar: ~1.11.1 => 1.11.1 
    react: 18.2.0 => 18.2.0 
    react-native: 0.73.6 => 0.73.6 
    tamagui: 1.91.3 => 1.91.3 
    typescript: ^5.1.3 => 5.4.5

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

You need to specify your fontFamily name when using Text component, otherwise it will pick defaultFont value from your tamagui config which is body ( 'Inter' ).

you can change defaultFont to systemFont in your tamagui config as well.

just tested and it’s working fine what those changes, I’ll close this issue. let me know if there’s a need to re-open

in that github repo. just put this line to your tamagui.config file and it should work

const config = createTamagui({ defaultFont: “systemFont” })

@ShivamJoker like this

<Text fontFamily="yourCustomFontName">

systemFont is a custom name that you assigned to your font.