react-native-htmlview
react-native-htmlview copied to clipboard
Can we customized font
In my html style, my p tag is using 'sukhumvit' font-family. I'm wondering how to show the text in that custom font.
I do have .otf in asset folder. Thank you in advance!
You can follow this guide, and after just add the fontFamily to the tags you want, e.g.:
import HTMLView from "react-native-htmlview";
const YourComponent = () => <HTMLView stylesheet={styles} />
const styles = StyleSheet.create({
// Make sure to add all tags you want to customize
h1: {
fontFamily: "YourCustomFontFamilyName"
},
h2: {
fontFamily: "YourCustomFontFamilyName"
},
p: {
fontFamily: "YourCustomFontFamilyName"
}
});
@edmundojr how to set font for all text tags, i dont want to set manually to h1, h2, h3,...
@huy-lv I haven't used this in a while, so not sure if there's a way to do for all the text tags at once.