Does React Native pass fontSize unchanged to the native OS widget? I'm trying to debug discrepancy between the mock (Figma) and implementation and want to rule out any conversions of the font size happening in RN.
Asked
Active
Viewed 97 times
1 Answers
0
If you want to scale all text in your app, you can write custom scaleText() function, that will be scale your text according (PixelRatio) current running device. Check this article for more information.
If you want to disable native OS scaling TextInput or Text, you can read this article.
Try to do, something like that:
index.js file
import {AppRegistry} from 'react-native';
import App from './src/App';
import {name as appName} from './app.json';
import {Text, TextInput} from 'react-native';
AppRegistry.registerComponent(appName, () => App);
//ADD this
if (Text.defaultProps == null) {
Text.defaultProps = {};
Text.defaultProps.allowFontScaling = false;
}
if (TextInput.defaultProps == null) {
TextInput.defaultProps = {};
TextInput.defaultProps.allowFontScaling = false;
}
I hope its help you.

Ilya Ezy
- 34
- 2