Restrict default phone font size

2
Hi all, I want to restrict default phone font size to app. Irrespective of the phone brand and default font size, the app font size should be in constant. Help me to achieve this
asked
3 answers
4

Hi Lavanya,

 

This question is not so easy to answer it depends on a lot of factors. By default Mendix has a function called "adjustFont" to recalculate the font size based on the device resolution. But then the user could have changed his font size through the device settings which will effect the size of the font in your application.

 

If your question is how to disable the setting that widgets will adhere to the device font size setting, you could add something like this to your native styling for example in your main.js file:

 

if (Text.defaultProps == null) {
    Text.defaultProps = {};
    Text.defaultProps.allowFontScaling = false;
}

if (TextInput.defaultProps == null) {
    TextInput.defaultProps = {};
    TextInput.defaultProps.allowFontScaling = false;
}

 

Link to allowFontScaling property Text · React Native

 

Keep in mind that if you have custom widgets the you could override this setting or ignore it completely. As I said the question is not so easy to answer, there is no one solution unfortunately. Hope this helps you.

 

Regards,

 

Taner.

answered
0

Did you read the documentation here: https://docs.mendix.com/refguide/mobile/designing-mobile-user-interfaces/images-icons-and-fonts/ ? It is in the 3.1 part.

Regards,

Ronald

 

 

answered
0

In addition to the previous answers, you may also check my article at:

https://vstram.medium.com/how-to-configure-custom-fonts-in-a-mendix-native-mobile-android-application-97d049ec40f4

answered