Answers for "react native text font"

1

color text react native

// Some code....
<Text 
	// Topic 2: Text Style
	style={styles.headline}>Hi, Lunox!
</Text>

// Some code....

headline: {
	color: 'white', // <-- The magic
	textAlign: 'center', // <-- The magic
	fontWeight: 'bold',
	fontSize: 50,
	backgroundColor: 'purple',
}
// Some code....

Look how I use it here:
https://github.com/Lunox-code/100dayscode-react.native/blob/master/App.js
Posted by: Guest on October-28-2020
6

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