React Native SDK - Styling text with custom fonts

Please fill out as many of the following questions as possible so we can help you promptly! If you don’t know how to answer or it does not apply, feel free to remove it or leave it blank.

Builder content link

Builder public api key
590f4251081d402c96f40922159dcfc5

What are you trying to accomplish
Fetch section model into React Native application

Screenshots or video link

Code stack you are integrating Builder with
React Native

I can not get the text block to render with the correct font. We are using NotoSans as our primary font in the react native app. I have imported it as a custom font into builder but the when displaying the content the system font is rendered.

Hey @tobias.akeblom I tested the Nano font on your space on a test page I created. I was able to apply it to the text blocks added.

Is there a specific Nano Sans font you are unable to use? Could you please share a screen recording or loom of the issue?

I am able to apply the font in the builder editor and there it looks like it working. But when I try to use the section in our react native application the correct font is not rendered.

Hey, @tobias.akeblom, could you please give me a step-by-step procedure to replicate the issue? A screen recording would be very helpful.

Hey, sorry for the late answer. Had to work on other stuff for a while. Here you can see a screen shot of how the content is displayed in the React Native application compared to how it looks in the builder editor.

This is how I am using it

Fetching entries:

fetchEntries({
      model: 'story',
      apiKey: key,
      options: { locale: builderLocale },
      cacheSeconds: INTERNAL_BUILD ? 0 : null,
      staleCacheSeconds: INTERNAL_BUILD ? 0 : null,
      userAttributes: { locale: builderLocale, urlPath: '/' },
    })

Displaying content
<Content apiKey={key} model="story" content={content} />

Took a dive into the sdk-react-native package and found this block of code in

components/content/content.tsx


{TARGET !== "reactNative" ? (
          <ContentStyles
            nonce={props.nonce || ""}
            isNestedRender={props.isNestedRender}
            contentId={builderContextSignal.content?.id}
            cssCode={builderContextSignal.content?.data?.cssCode}
            customFonts={builderContextSignal.content?.data?.customFonts}
          />
        ) : null}

Seems like the customFonts does not being used if the target is React Native.