Answers for "react native font style"

6

react-native italics

<Text style={styles.bold}>I'm bold!</Text>
<Text style={styles.italic}>I'm italic!</Text>
<Text style={styles.underline}>I'm underlined!</Text>

const styles = StyleSheet.create({
    bold: {fontWeight: 'bold'},
    italic: {fontStyle: 'italic'},
    underline: {textDecorationLine: 'underline'}
})
Posted by: Guest on May-15-2020
2

react native italic text

<View flex={1}>
    <Text style={style}>Example of Italic Text</Text>
</View>

const style = StyleSheet.create({
    textAlign: 'center',
    fontWeight: 'bold'
    fontStyle: 'italic'
    fontSize: 20,
});
Posted by: Guest on November-10-2020
5

custom font in react native

create folder in your root directory assets/Fonts and add your custom fonts
you want.
create a file in root folder and called react-native.config.js
Add the following code to the file =>

module.exports = {
project: {
    ios: {},
    android: {},
},
assets: ['./assets/Fonts']
};


or 
module.exports = {
    assets: ['./assets/Fonts'],
  };


Then, run the following command in your terminal:
react-native link 

to use it declare this way in your styles:
fontFamily: 'your-font-name without extension'

If your font is Raleway-Bold.ttf then,
  fontFamily: 'Raleway-Bold'
Posted by: Guest on February-13-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language