The default font family in React Native is typically set in the App.js file of the project.
import { StyleSheet, Text, View } from 'react-native';
const styles = StyleSheet.create({
defaultFontFamily: {
fontFamily: "Arial"
}
});
export default function App() {
return (
<View style={styles.defaultFontFamily}>
{/* Your app components */}
</View>
);
}
Alternatively, you can set the default font family at the global level using the setDefaultFontFamily()
method from Expo's Font
module. To do this, you'll need to install the Expo CLI and import the module into your project:
import { setDefaultFontFamily } from 'expo-font';
Then, you can call the method and pass in the name of the font to use as the default:
setDefaultFontFamily('Arial');
This will set the default font family globally for your entire app.
Asked: 2021-09-10 11:00:00 +0000
Seen: 8 times
Last updated: Sep 07 '21