我在我的整个React本机应用程序中使用自定义字体.我使用react-native link命令链接了它们.除了Android的Webview组件之外,它们可以在任何地方工作.它在iOS Webview中正常运行.
import React, { Component } from "react"
import { View, StyleSheet, Text, WebView, ScrollView, Image } from "react-native"
import HTMLView from "react-native-htmlview"
export class PostDetailPage extends Component {
static navigationOptions = {
title: ({ state }) => state.params.post.title,
header: {
style: {
backgroundColor: '#FF9800',
},
titleStyle: {
color: 'white',
fontFamily: "Ekatra",
fontWeight: "normal"
},
tintColor: 'white'
}
}
constructor(props) {
super(props)
}
render() {
const post = this.props.navigation.state.params.post
const html = `
<!DOCTYPE html>
<html>
<head>
<style …Run Code Online (Sandbox Code Playgroud)