I'm new to React Native (0.59.3) and I'm trying to set default font for all Text
components in my app. I've read https://stackoverflow.com/a/47925418/811405 and How to disable font scaling in React Native for IOS app?.
In my App.js
I've put:
import { Text } from 'react-native';
Text.defaultProps.style = {
fontFamily: 'AmericanTypewriter' //just for testing
}
But I get Cannot set property 'style' of undefined
.
When I add the line Text.defaultProps = Text.defaultProps || {};
before that, I don't get an error, but nothing happens (all Text
components still use the default font). I've tried with different fonts (both built-in iOS fonts and my custom fonts that I've linked and verified), using their PostScript names, though nothing happens.
What am I doing wrong?