Home > database >  How can I disable font scalling for the entire application at once
How can I disable font scalling for the entire application at once

Time:06-08

I want to disable font scalling for the entire application at once, I disabled it setting useFontScalling to false in but I don't want to do it in this way, please let me know how can I disable it at once, no need to write useFontScalling for each and every file.

CodePudding user response:

For removing font-scaling in whole App paste this code in App.tsx | App.js

If you are using TS:-

interface TextWithDefaultProps extends Text {
    defaultProps?: { allowFontScaling?: boolean };
}

((Text as unknown) as TextWithDefaultProps).defaultProps =
    ((Text as unknown) as TextWithDefaultProps).defaultProps || {};
((Text as unknown) as TextWithDefaultProps).defaultProps!.allowFontScaling = false;

If you are using JS:-

Text.defaultProps = Text.defaultProps || {};
Text.defaultProps.allowFontScaling = false;

CodePudding user response:

In your index.js file try the following:

Text.defaultProps = Text.defaultProps || {};
Text.defaultProps.allowFontScaling = false;
  • Related