question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fontFamily cannot be overriden

See original GitHub issue
const customTextProps = {
  style: {
    fontFamily: 'Nunito Sans'
  }
};

setCustomText(customTextProps);

When using the Inspector, the Text component’s fontFamily still shows up as System. Apparently, react-native automatically prepended {fontFamily: 'System', fontSize:16, color:'#000'} to Text’s style prop, which overrides our own custom style prop.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
anshuul-kaicommented, Jun 7, 2019

Here’s a version of the code from @ex3ndr that works in 2019

const sourceRender = Text.render;
Text.render = function render(props: any, ref: any) {
  return sourceRender.apply(this, [{ ...props, style: [{ fontFamily: 'CourierNewPSMT' }, props.style] }, ref]);
};
2reactions
pkecommented, May 20, 2020

It does not work with current react-native: 0.62.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overwrite font: in CSS
I thought I could use font-size: to override it, but I'm unclear as to how to set that to be whatever the browser...
Read more >
CSS not overriding default font-family - BB Theme
Thanks! I am trying to style a Class selector named “charles”. The color, alignment, and font size all work fine with the following...
Read more >
Override the font family and other Css styles in form
How can we override the theme styles to change the font family ,size and other styles for all k2 controls in the form....
Read more >
How to override the font?
Hello, After I apply the MDB Css and javascript, all of the website's fonts are changed and I do not like that font....
Read more >
font-face - CSS: Cascading Style Sheets - MDN Web Docs
Chrome Edge @font‑face Full support. Chrome1. Toggle history Full support... OpenType CBDT and CBLC rendering Full support. Chrome66. Toggle history Full support... OpenType COLRv0 rendering Full...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found